Intel 8XC196MC User Manual page 131

Table of Contents

Advertisement

8XC196MC, MD, MH USER'S MANUAL
If the SCK signal is generated by the EPA channel, the first PTS cycle must be started manually.
Initialize the TXD port pin and the SCK signal to the system-required logic level before
starting a transmission.
Add the contents of the timer register to the Baud_value (Figure 5-19 on page 5-38) and
store the result into the EPA time register. This sets up the timing for the first interrupt and
causes the first bit transmission to occur at the proper baud rate.
The following example uses EPA0 to control the baud rate and output the SCK signal and P2.2
to output the data (TXD). It sets up a synchronous serial I/O PTS routine that transmits 16 bytes
with eight data bits at 9600 baud. This example uses several user-defined registers. T_COUNT
defines the number of bytes to transfer and TXDDONE is a flag that is set when all bytes are
transferred.
1.
Disable the interrupts and the PTS.
— Use the DI instruction to disable all standard interrupts and the DPTS instruction to
disable the PTS.
2.
Set-up the stack pointer.
3.
Reset all interrupt mask registers.
— Clear INT_MASK, INT_MASK1and PI_MASK.
4.
Initialize P2.0 to function as the EPA0 output (SCK) and P2.2 to function as TXD.
— Clear P2_DIR (selects output).
— Set P2_MODE.0 (selects special function).
— Clear P2_MODE.2 (selects LSIO function).
— Set P2_REG bits 0 and 2 (initializes TXD and SCK outputs to "1").
5.
Initialize and enable the timer. Select up counting, internal clock, and prescaler disabled.
— Set T1CONTROL bits 6 and 7 (Figure 11-8 on page 11-16).
6.
Initialize the PTSCB as shown in Table 5-13.
5-44
Get other manuals https://www.bkmanuals.com

Advertisement

Table of Contents
loading

This manual is also suitable for:

8xc196md8xc196mh

Table of Contents