Technical information
CSI to SPI Peripheral Communication in V850ES Microcontrollers
the rxbuf[0] location. The first received data will not have been driven by the DS1722, so this first
receive byte does not contain temperature data.
While the dummy data in txbuf[1] is transmitted, the DS1722 will drive the Temperature low byte
out on its SDO pin, and this data will be clocked in on SI00.
After the second byte has been sent, INTCSI00 will occur, and MD_INTCSI00() will transmit
txbuf[2] and read the received temperature low byte into rxbuf[1]. While the dummy data in
txbuf[2] is transmitted, the DS1722 will have advanced its address to 02H, and will drive the
Temperature high byte data out on SDO.
After the third and final byte has been sent, INTCSI00 will occur again, and MD_INTCSI00() will
set the CSI00_SendDone flag, store the last received byte of data (temperature high byte) into
rxbuf[2].
At this point, Temp_Read_2() will see the flag as true, and set the temperature sensor chip select
off, to have the sensor resume temperature readings. It then combines the bytes in rxbuf[1] (first
eight bits from DS1722 = Temperature low byte), and rxbuf[2] (second eight bits from DS1722 =
Temperature high byte) into a signed 16-bit value. In the 10-bit data resolution selected for the
DS1722, this will be (temperature in ºC) × 256, to the nearest 1/4
th
degree.
To return a temperature value in the same scale as Temp_Read_1(), Temp_Read_2() divides the
signed 16-bit data by two, resulting in (temperature in ºC) × 128, and returns this value.
2.6.12 Temp_Display(temp): Show Temperature in LED
The Temp_Display() routine displays the temperature data in the two-digit LED, by scrolling the
data through the LED digits. The temp parameter is a signed 16-bit value, of temperature × 128.
The routine will display digits in the format of (sign)XXX.YY.
Since the details of this routine have nothing to do with the CSI/SPI interface, the flowchart for this
routine is not shown. A description of the display format follows. For those interested in the
mechanics of the routine, please see the listing in Section 4.
If the temperature is negative, a dash will precede the number for a minus sign, otherwise no sign
will be shown.
28