MikroElektronika PIC Microcontrollers PIC18 Manuel d'utilisateur Page 40

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 40
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 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
Vue de la page 39
1 2 ... 35 36 37 38 39 40

Commentaires sur ces manuels

Pas de commentaire