STANDARD AND PTS INTERRUPTS

Table 5-13. SSIO Transmit Mode PTSCBs

PTSCB1

PTSCB2

 

 

PTSVEC (H) = pointer to PTSCB2

Unused

 

 

PTSVEC (L) = pointer to PTSCB2

SAMPTIME = unused

 

 

BAUD (H) = 00H (9600 baud at 16 MHz)

DATA (H) = unused

 

 

BAUD (L) = D0H (9600 baud at 16 MHz)

DATA (L) = nnH (8 data bits)

 

 

EPAREG (H) = 1FH (EPA0_TIME)

PTSCON1 = 02H (transmit data on odd PTS cycles)

 

 

EPAREG (L) = 42H (EPA0_TIME)

PORTMASK = 04H (P2.2 = TXD)

 

 

PTSCON = 72H (SSIO transmit mode)

PORTREG (H) = 1FH (P2_REG)

 

 

PTSCOUNT = 10H (8 data bits x 2)

PORTREG (L) = D4H (P2_REG)

 

 

7.Enable EPA0 interrupt.

Set INT_MASK.2.

8.Load the number of bytes to transmit into the user_defined transmit count register (T_COUNT) and clear the user-defined transfer-done flag (TXDDONE).

LD T_COUNT, #16

CLRB TXDDONE

9.Select PTS service for EPA0.

Set PTSSEL.2.

10.Set-up EPA0 as a compare-only channel.

Set EPA0_CON.6 (Figure 11-10 on page 11-19).

11.Start the operation of the EPA0 channel by writing the time of the first interrupt to EPA0_TIME. To set-up the correct value, add the baud_value (0D0H) to the current TIMER1 value and store the result in EPA0_TIME. The baud_value determines the time to the first PTS interrupt and the first transition on SCK. The PTS transmits the first data bit on first transition of SCK in this example. The baud_value of 0D0H selects a baud rate of 9600.

12.Enable the PTS and conventional interrupts.

— Use the EI instruction to enable all standard interrupts and the EPTS instruction to enable the PTS.

13.The transmission will begin. Data is shifted out with the least-significant (rightmost) bit first. Each time a timer match occurs between EPA0_TIME and TIMER1, the EPA0 channel generates an interrupt and toggles the SCK signal. The PTS outputs the next bit of data on the pin configured as TXD on odd PTS cycles. When PTSCOUNT decrements to zero, the PTS calls the end-of-PTS interrupt (Figure 5-22). The interrupt service routine should disable the EPA channel because the final PTS cycle loads the next SCK toggle

5-45

Page 132
Image 132
Intel 8XC196MD, 8XC196MH, 8XC196MC manual Ssio Transmit Mode PTSCBs, PTSCB1 PTSCB2