MikroElektronika PIC Microcontrollers PIC18 Manual de usuario Pagina 40

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 40
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 39
node filter is set to accept identifier 500). This is a request to the COLLECTOR
node to send the temperature reading. The program then reads the temperature from
the CAN bus, converts it to a string in array txt, and displays it on the LCD. This
process repeats after a one-second delay.
COLLECTOR Program
Figure 9.18 shows the program listing of the COLLECTOR program, called
COLLECTOR.C. The initial part of this program is the same as the DISPLAY
program. The receive filter is set to 500 so that messages with identifier 500 are
accepted by the program.
Inside the program loop, the program waits until it receives a request to send the
temperature. Here the request is identified by the reception of character “T”. Once a
valid request is received, the temperature is read and converted into
C (stored in
variable temperature) and then sent to the CAN bus as a byte with an identifier value
equal to 3. This process repeats forever.
Figure 9.19 summarizes the operation of both nodes.
www.newnespress.com
514 Chapter 9
Vista de pagina 39
1 2 ... 35 36 37 38 39 40

Comentarios a estos manuales

Sin comentarios