Technical information

SCI to SPI Peripheral Communication in V850ES Microcontrollers
Figure 21. Temp_Read_2(): Read Temperature Sensor 2 (DS1722)
Delay 100ns after CS activeDelay 100ns after CS active
II
TEMP2_CS_ON (P9H.6 = 1)TEMP2_CS_ON (P9H.6 = 1)
CSI00_SendDone = FALSE
CALL CSI00_SendData(txbuf, 3)
CSI00_SendDone = FALSE
CALL CSI00_SendData(txbuf, 3)
FF
CALL CSI00_ReceiveData(rxbuf, 3)CALL CSI00_ReceiveData(rxbuf, 3)
Yes
No
SendDone
== FALSE?
Yes
No
SendDone
== FALSE?
TEMP2_CS_OFF (P9H.6 = 0)TEMP2_CS_OFF (P9H.6 = 0)
Return retval
GG
txbuf[0] = 0x01txbuf[0] = 0x01
CALL CSI00_SetType3( )CALL CSI00_SetType3( )
DD
Retval = rxbuf[2] << 8
Retval = retval | rxbuf[1]
Retval = retval / 2
Retval = rxbuf[2] << 8
Retval = retval | rxbuf[1]
Retval = retval / 2
The routine then calls CSI00_ReceiveData(rxbuf, 3) to set the location and count of bytes to be
read from the CSI00 peripheral. The first parameter, rxbuf, is a pointer to an array of byte values
to hold the data read; the second parameter, 3, is the count of bytes to receive.
The routine then sets the first byte of a transmit buffer, txbuf[0], to the address of the temperature
low byte, 01H. The routine sets the CSI00_SendDone flag to FALSE, and starts the write of the
address plus two dummy bytes by calling CSI00_SendData(txbuf, 3). The Temp_Read_2() routine
then waits for the CSI00_SendDone flag to be set.
On the call to CSI00_SendData(txbuf, 3), the transfer is started by writing the first byte of data
(01H) to the SOTB0L register. This data will be sent out the SO00 output and received at the SDI
input of the DS1722.
After the first byte has been sent, the INTCSI00 interrupt will occur, and the MD_INTCSI00()
interrupt service routine will transmit the next byte from txbuf[1], and read the received data into
27