Intel 8XC196MC User Manual page 135

Table of Contents

Advertisement

8XC196MC, MD, MH USER'S MANUAL
The following example uses EPA0 to capture the SCK signal and P2.3 to receive the data (RXD).
It sets up a synchronous serial I/O PTS routine that receives 16 bytes with eight data bits. Because
this example uses an external serial clock input, the TIMER1 and BAUD registers are not used.
The external clock source controls the baud rate. This example uses several user-defined regis-
ters. R_COUNT defines the number of bytes to receive and RXDDONE is a flag that is set when
all bytes are received.
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 input (SCK) and P2.3 to function as RXD.
— Set P2_DIR bits 0 and 3 (selects input).
— Set P2_MODE.0 (selects special function).
— Clear P2_MODE.3 (selects LSIO function).
— Set P2_REG bits 0 and 3 (initializes SCK and RXD input to "1").
5.
Initialize the PTSCB as shown in Table 5-14.
PTSCB1
PTSVEC (H) = pointer to PTSCB2
PTSVEC (L) = pointer to PTSCB2
BAUD (H) = unused
BAUD (L) = unused
EPAREG (H) = 1FH (EPA0_TIME)
EPAREG (L) = 42H (EPA0_TIME)
PTSCON = 32H (SSIO receive mode)
PTSCOUNT = 10H (8 data bits x 2)
6.
Enable EPA0 interrupt.
— Set INT_MASK.2.
7.
Load the number of bytes to transmit into the user_defined transmit count register
(R_COUNT) and clear the user-defined reception-done flag (RXDDONE).
— LD R_COUNT, #16
— CLRB RXDDONE
5-48
Table 5-14. SSIO Receive Mode PTSCBs
Get other manuals https://www.bkmanuals.com
PTSCB2
Unused
SAMPTIME = unused
DATA (H) = unused
DATA (L) = 00H (clear register to receive data)
PTSCON1 = 00H (receive data on even PTS cycles)
PORTMASK = 08H (P2.3 = RXD)
PORTREG (H) = 1FH (P2_REG)
PORTREG (L) = D4H (P2_REG)

Advertisement

Table of Contents
loading

This manual is also suitable for:

8xc196md8xc196mh

Table of Contents