Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: canMessage.h
- Revision:
- 5:38b2b8790b40
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/canMessage.h Sun Apr 11 09:08:16 2021 +0000 @@ -0,0 +1,54 @@ +#include "mbed.h" + +const BYTE gpioID = 0x72; +const BYTE uvID = 0x90; +const BYTE ovID = 0x50; +const BYTE utID = 0x99; +const BYTE otID = 0x49; +const BYTE toneID = 0x80; +const BYTE uartID = 0x81; +const BYTE uartRCID = 0x98; +const BYTE uartRRID = 0x97; +const BYTE uartTRID = 0x65; +const BYTE COMHID = 0x63; +const BYTE COMHRCID = 0x95; +const BYTE COMHRRID = 0x73; +const BYTE COMHTRID = 0x66; +const BYTE COMLID = 0x91; +const BYTE COMLRCID = 0x90; +const BYTE COMLRRID = 0x72; +const BYTE COMLTRID = 0x33; +const BYTE otpID = 0x94; +const BYTE railID = 0x32; +const BYTE ovuvBistID = 0x22; +const BYTE otutBistID = 0x26; +const BYTE tempID = 0x70; +const BYTE voltID = 0X71; + +extern CAN can1; +extern CANMessage message1; + + +void sendCANbyte(BYTE ID, BYTE data) +{ + message1.id = ID; + message1.data[0] = data; + can1.write(message1); +} + +void sendCAN(BYTE ID, int data) +{ + message1.id = ID; + + int j = 0; + BYTE dataMOD = data % 256 ; + int dataDIV = data; + + while(dataDIV > 0) + { + message1. data[j++]= dataMOD; + dataDIV = dataDIV >> 8; + dataMOD = dataDIV % 256; + } +} +