Technical information
SCI to SPI Peripheral Communication in V850ES Microcontrollers
#if (TEMP_DEBUG == 1)
int i;
/* set up continuous select, 1 buffer mode of operation */
ADM = 0x00; /* clear to reset value to stop converter and
generator */
/* also sets select mode, normal conversion,
14.4 us conversion time */
ADMK = 1; /* mask interrupt */
ADS = 0x00; /* no edge detect, software trigger, select ANI0 */
ADCS2 = 1; /* set ADCS2 (ADM.0) to enable reference voltage
generator */
/* delay 14 microseconds; 1 NOP takes 50 nanoseconds at 20 MHz, */
/* so we need to do 20 NOPs per microsecond; 14 x 20 = 280 = 28 x 10 */
for (i = 0; i < 28; i++) {
__asm("nop");
__asm("nop");
__asm("nop");
__asm("nop");
__asm("nop");
__asm("nop");
__asm("nop");
__asm("nop");
__asm("nop");
__asm("nop");
}
ADCS = 1; /* set ADCS (ADM.7) to enable conversion */
#else
TEMP1_CS_OFF; /* deselect chips to allow conversion */
TEMP2_CS_OFF;
CSI00_Init(); /* initialize the CSI00 interface */
/* for Temp Sensor 1 (MAX6627), no further initialization necessary */
/* for Temp Sensor 2 (DS1722), set configuration */
CSI00_SetType3(); /* set CSI00 interface for Type 3
transfer */
TEMP2_CS_ON; /* select chip to enable writing */
/* delay 400ns between CS true and SCK rise */
/* one NOP takes 50ns at 20MHz, so do eight */
__asm("nop"); __asm("nop");
__asm("nop"); __asm("nop");
__asm("nop"); __asm("nop");
__asm("nop"); __asm("nop");
txbuf[0] = 0x80; /* address set to write configuration register
*/
txbuf[1] = 0xE0 | /* top three bits 111 */
0x00 | /* bit 4 = 0, 1SHOT is off */
0x04 | /* bits 3-1 = 010 for 10-bit accuracy, 0.3 sec
conversion time */
0x00; /* bit 0 = 0, SD shutdown bit is off, do continuous
conversion */
47