#include "t89c51cc02.h"
#include "datatypes.h"
#include "can.h"
#include "command.h"
Go to the source code of this file.
Functions | |
void | CAN_init () |
initialize CAN Bus to receive and send packages | |
void | CAN_interrupt (void) |
ISR for handling incoming CAN Bus messages. | |
void | CAN_SendACK (BYTE cmd) |
acknowledge last recieved command via CAN Bus | |
void | CAN_SendNAK (BYTE cmd) |
reply when last command was accepted but could not be completed | |
void | CAN_SendMsg (BYTE length) |
transmits a message over the CAN Bus | |
Variables | |
volatile BYTE idata | can_data [8] |
data buffer to construct CAN messages to be send |
Definition in file can.c.
|
initialize CAN Bus to receive and send packages
CAN packets are recieved on CAN ID 0x400 (hardcoded into can.h) Definition at line 29 of file can.c. References CAN_setchannel, CH_DISABLE, and MSK_CANGCON_GRES. Referenced by main(). |
|
ISR for handling incoming CAN Bus messages. A small implicit state machine is used to decode valid CAN messages. Definition at line 119 of file can.c. References can_data, CAN_SendACK(), CAN_SendMsg(), CAN_SendNAK(), CAN_setchannel, Command_CheckTime, Command_ClearMonitor, Command_ClearRead, Command_DisableMonitor(), Command_DisableReport, COMMAND_EEPROM_CLEAR, COMMAND_EEPROM_SAVEMONITOR, Command_EnableMonitor(), Command_EnableReport(), COMMAND_MONITOR, COMMAND_MONITORSTATUS, COMMAND_READ, COMMAND_RECALLMONITOR, COMMAND_REPORT, COMMAND_RESET, Command_SetRead(), COMMAND_STOPALLMONITORS, COMMAND_STOPMONITOR, COMMAND_STOPREPORT, COMMAND_TIMECHECK_DISABLE, COMMAND_TIMECHECK_ENABLE, Command_TimecheckDisable, Command_TimecheckEnable, COMMAND_TIMECHECKSTATUS, monitor, read_eeprom_config, and write_eeprom_config. |
|
acknowledge last recieved command via CAN Bus The ACK message consists of the command byte to be acknowledged and an ASCII ACK
Definition at line 296 of file can.c. References CAN_ACK, CAN_enablechannel, CAN_setchannel, CH_DISABLE, and CH_TxENA. Referenced by CAN_interrupt(). |
|
transmits a message over the CAN Bus
The message content has to be specified in can_data and the data length code has to be given.
Definition at line 344 of file can.c. References can_data, CAN_enablechannel, CAN_setchannel, CH_DISABLE, and CH_TxENA. Referenced by CAN_interrupt(), and main(). |
|
reply when last command was accepted but could not be completed The function works similar to CAN_SendACK but a NAK is send instead of the ACK to signal an imcomplete command or wrong data format.
Definition at line 319 of file can.c. References CAN_enablechannel, CAN_NAK, CAN_setchannel, CH_DISABLE, and CH_TxENA. Referenced by CAN_interrupt(). |
|
data buffer to construct CAN messages to be send
The buffer resides in indirect addressable IRAM space of the T89C51CC02. Definition at line 19 of file can.c. Referenced by CAN_interrupt(), CAN_SendMsg(), and main(). |