Directed Electronics 3200HS Información técnica Pagina 23

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 99
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 22
SCI to SPI Peripheral Communication in V850ES Microcontrollers
Main( ) then calls Temp_Init( ) to initialize the temperature sensors and the CSI/SPI interface used
to communicate with the sensors. If an error is detected, an error code is displayed and the program
enters an endless loop.
To indicate proper initialization, a pair of dashes is shown in the LED. TM00_Start( ) is called to
start the TM00 timer for a periodic 1 millisecond interrupt, used for debouncing the input switches.
The main( ) program then enters the main program loop. The program checks the state of the SW2
and SW3 switches for the action to perform.
Figure 12. Main( ): Main Program for NEC Electronics CSI to SPI Serial Communication
Yes
No
SW2 only?
Yes
No
SW2 only?
AA
Initialize switches and LED displayInitialize switches and LED display
CALL Temp_Init( )CALL Temp_Init( )
BB
Display “- -” in LED display
CALL TM00_Start( ) to debounce
Display “- -” in LED display
CALL TM00_Start( ) to debounce
Get state of SW2 and SW3Get state of SW2 and SW3
CC
temp = Temp_Read_1( )temp = Temp_Read_1( )
CALL Temp_Display(temp)
Wait for switches different
CALL Temp_Display(temp)
Wait for switches different
EE
Temp = Temp_Read_2( )Temp = Temp_Read_2( )
DD
Yes
No
SW3 only?
Yes
No
SW3 only?
CALL Temp_Display(temp)
Wait for switches different
CALL Temp_Display(temp)
Wait for switches different
EE
If SW2 is pressed, the MAX6627 temperature sensor is read by calling Temp_Read_1( ), and the
variable temp is set to the value read. The temperature is then displayed in the LED by calling
Temp_Display(temp). Main() then waits for the switch state to be different.
If SW3 is pressed, the DS1722 temperature sensor is ready by calling Temp_Read_2( ), setting
temp to the value read. The temperature is then displayed in the LED by calling
Temp_Display(temp). Main() then waits for the switch state to be different.
17
Vista de pagina 22
1 2 ... 18 19 20 21 22 23 24 25 26 27 28 ... 98 99

Comentarios a estos manuales

Sin comentarios