Intel 8XC196MC User Manual

Page of 579
5-51
STANDARD AND PTS INTERRUPTS
Figure 5-25.  Asynchronous SIO Transmit Timing
The first PTS cycle must be started manually by generating a start bit and then setting up the tim-
ing for the first EPA interrupt. 
Initialize the TXD port pin to one before starting a transmission.
Write a zero to the TXD port pin to start the transmission. The PTS uses this as the start bit.
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 P2.0 to output the data (TXD) and EPA0 to control the baud rate. It
sets up an asynchronous serial I/O PTS routine that transmits 16 bytes with eight data bits, one
parity bit, and one stop bit 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 TXD.
— Clear P2_DIR.0 (selects output).
— Clear P2_MODE.0 (selects LSIO function).
— Set P2_REG.0 (initializes TXD output to “1”).
A3119-01
Interrupts
Stop
Start
LSB
TXD
(Port pin)
Bit 0
Bit 1
Bit 2
Bit 3
Bit 4
Bit 5
Bit 6
Bit 7
Parity
MSB
1 Bit Time
Optional
Parity Bit
End-of-PTS
Conventional
Interrupt
10 PTS Serviced Interrupts
Software Clears TXD