Professional Documents
Culture Documents
#IFDEF NODE3
Tx_ID = 0x13 ‘ set transmit ID for CAN message
#ENDIF
#IFDEF NODE1
CANSPIWrite(Tx_ID, RxTx_Data, 1, Can_Send_Flags)
initial message
‘ Node1 sends
#ENDIF
while (TRUE) ‘ endless loop
Msg_Rcvd = CANSPIRead(Rx_ID, RxTx_Data, Rx_Data_Len, Can_Rcv_Flags)
‘ attempt receive message
if (Msg_Rcvd) then
#IFDEF NODE1
‘ if message is received then check id
with ready to use libraries such as: delay_ms(50) ‘ wait for a while between messages
CAN_SPI, GLCD, Ethernet etc. Functions used in the program CANSPIWrite(Tx_ID, RxTx_Data, 1, Can_Send_Flags)
one byte of data
‘ send
GO TO
end if
#ENDIF
end if
www.mikroe.com/en/article/ wend
end.
Microchip®, logo and combinations thereof, PIC® and others are registered trademarks or trademarks of Microchip Corporation or its
subsidiaries. Other terms and product names may be trademarks of others.