Technical information

SCI to SPI Peripheral Communication in V850ES Microcontrollers
The Temp_Init() routine initializes the temperature sensors to prepare them for reading.
Temp_Init() first sets the chip selects for the two temperature sensors to the inactive state, and then
calls CSI00_Init() to initialize the clocked serial interface 00 for operation.
For the MAX6627 temperature sensor (TEMP1), temperature conversions are done once per
second, and the most recent conversion is available for reading at any time. No further
initialization is necessary.
For the DS1722 temperature sensor (TEMP2), the default power-up state is for 8-bit resolution (to
the nearest 1ÂșC), and to enter power-down mode. In order to program the device for 10-bit
resolution and for continuous conversion, the Configuration register must be set.
Temp_Init() calls CSI00_SetType3( ) to set the CSI00 peripheral for the Type-3 interface required
for the DS1722, and then sets its chip select active. A delay of 400ns is necessary between chip
select active and the first SCK edge, so a delay is done.
In order to write to the Configuration register, two bytes of a transmit data buffer, txbuf, are
prepared. The first byte, txbuf[0], is set to 80H, which is the address used to write to the DS1722
Configuration register, the second byte, txbuf[1], is set to the value E4H. This value specifies 10-
bit resolution and continuous conversion.
The flag CSI00_SendDone is set FALSE, the CSI00_SendData(txbuf, 2) routine is called to start
transmission of two bytes of data contained in the buffer, and then Temp_Init() waits for the flag to
be set to TRUE.
After each byte of data is transmitted, the INTCSI00 interrupt will occur, and will be handled by
the MD_INTCSI00() interrupt service routine. After the last byte has been transmitted, the
CSI00_SendDone flag will be set to TRUE, and Temp_Init() will continue, setting the chip select
inactive. At this point, initialization of the temperature sensors is complete.
2.6.4 CSI00_Init(): Initialize Clocked Serial I/O 00 Peripheral
The CSI00_Init() routine sets up the CSI00 peripheral for operation. First the CSIM00 register is
set to 00, which disables the CSI00 peripheral, and the INTCSI00 interrupt is disabled by setting
the CSK0MK0 mask flag (bit 6 of interrupt control register CSI0IC0).
The port 4 pins used for CSI00 (P42, P41, and P40) are set to their alternate CSI00 functional uses
by setting the appropriate bits in the PMC4 Port Mode Control Register.
In the CSIM00 control register, the CCL0 bit is cleared to set 8-bit operation, and the DIR0 bit is
cleared for MSB-first data transfer.
19