
CAN_TX_PRIORITY_2 Transmit priority 2
CAN_TX_PRIORITY_3 Transmit priority 3
CAN_TX_STD_FRAME Standard identifier message
CAN_TX_XTD_FRAME Extended identifier message
CAN_TX_NO_RTR_FRAME Non RTR message
CAN_TX_RTR_FRAME RTR message
These flags can be bitwise AND’ed if desired.
9.11 CAN Bus Programming
To operate the PIC18F258 microcontroller on the CAN bus, perform the following
steps:
Configure the CAN bus I/O port directions (RB2 and RB3)
Initialize the CAN module (CANInitialize)
Set the CAN module to CONFIG mode (CANSetOperationMode)
Set the mask registers (CANSetMask)
Set the filter registers (CANSetFilter)
Set the CAN module to normal mode (CANSetOperationMode)
Write/read data (CANWrite/CANRead)
PROJECT 9.1—Temperature Sensor CAN
Bus Project
The following is a simple two-node CAN bus–based project. The block diagram of
the project is shown in Figure 9.15. The system is made up of two CAN nodes.
One node (called DISPLAY node) requests the temperature every second and
displays it on an LCD. This process is repeated continuously. The other node
(called COLLECTOR node) reads the temperature from an external semiconductor
temperature sensor.
www.newnespress.com
504 Chapter 9
Kommentare zu diesen Handbüchern