6.5 Example
Purpose: To receive 128 bytes of serial data via the serial communication interface.
Conditions:
• Operating mode: Minimum mode
• Received data are to be stored in consecutive addresses starting at H'FC00.
• DTC control register information for the RXI interrupt is stored at addresses H'FB80 to H'FB87.
• Accordingly, the DTC vector table contains H'FB at address H'00AA and H'80 at address
H'00AB.
• The desired interrupt mask level in the CPU status register is 4, and the desired SCI interrupt
priority level is 5.
Procedure
1. The user program sets DTC control register information in addresses H'FB80 to H'FB87 as
shown in table 6-7.
Table 6-7 DTC Control Register Information Set in RAM
2. The program sets the RI (SCI Receive Interrupt) bit in the data transfer enable register (bit 5 of
register DTED) to “1.”
3. The program sets the interrupt mask in the CPU status register to 4, and the SCI interrupt
priority in bits 6 to 4 of interrupt priority register IPRD to 5.
4. The program sets the SCI to the appropriate receive mode, and sets the receive interrupt enable
(RIE) bit in the serial control register (SCR) to “1” to enable receive interrupts.
5. Thereafter, each time the SCI receives one byte of data, it requests an RXI interrupt, which the
interrupt controller directs toward the DTC. The DTC transfers the byte from the SCI’s receive
data register (RDR) into RAM, and clears the interrupt request before ending.
Address Register Description Value Set
Byte transfer
H'FB80 DTMR Source address fixed H'2000
Increment destination address
H'FB82 DTSR Address of SCI receive data register H'FFDD
H'FB84 DTDR Address H'FC00 H'FC00
H'FB86 DTCR Number of bytes to be received: 128 H'0080
125
Downloaded from Elcodis.com electronic components distributor