#include "t89c51cc02.h"
#include "datatypes.h"
#include "command.h"
#include "eeprom.h"
Go to the source code of this file.
Functions | |
void | Command_SetRead (BYTE marker) |
marks a sensor for reading after next measurement | |
void | Command_EnableReport (BYTE timeframes) |
enables reporting of all sensors | |
BYTE | Command_ReportDue () |
signal if a report of the sensor values is due | |
void | Command_EnableMonitor (BYTE marker, WORD boundary, bit direction) |
marks one sensor for monitoring so it will report a value above or beyond a specified boundary value | |
void | Command_DisableMonitor (BYTE marker) |
disable monitoring for a given sensor | |
BYTE | CheckMonitor (BYTE marker, WORD value) |
checks whether the monitoring condition for a given sensor is true | |
WORD | Command_GetBoundary (BYTE marker) |
reports the current boundary value for a given sensor | |
void | Command_SetBoundary (BYTE marker, WORD bound) |
set the boundary value for a given sensor | |
void | Command_ReadDefaultConfiguration () |
load monitoring data from EEPROM and activate it again | |
void | Command_WriteDefaultConfiguration () |
writes the current monitoring conditions into the EEPROM | |
Variables | |
LONG | readenable |
stores a bit vector to mark which sensor values have to be sent after the current sampling cycle. | |
LONG | monitor |
LONG | monitor_direction |
volatile bit | reporting |
volatile bit | timecheck |
volatile bit | read_eeprom_config |
volatile bit | write_eeprom_config |
BYTE | report |
BYTE | report_reload |
WORD idata | monitor_boundary [NR_SENSORS] |
boundary values for monitoring | |
const unsigned long code | masks [] |
Definition in file command.c.
|
checks whether the monitoring condition for a given sensor is true
The sample value is compared to the boundary for the given sensor.
Definition at line 153 of file command.c. References masks, monitor, monitor_boundary, monitor_direction, and NR_SENSORS. Referenced by main(). |
|
disable monitoring for a given sensor
Definition at line 137 of file command.c. References masks, monitor, and NR_SENSORS. Referenced by CAN_interrupt(). |
|
marks one sensor for monitoring so it will report a value above or beyond a specified boundary value
Monitoring of a given sensor is enabled.
Definition at line 119 of file command.c. References masks, monitor, monitor_boundary, monitor_direction, and NR_SENSORS. Referenced by CAN_interrupt(). |
|
enables reporting of all sensors
The firmware will skip the given amount of timeframes between complete reports.
Definition at line 70 of file command.c. References report, report_reload, and reporting. Referenced by CAN_interrupt(). |
|
reports the current boundary value for a given sensor The boundary value is persistent, even if the monitoring condition has been disabled with a Command_EnableMonitor command for the given sensor.
Definition at line 184 of file command.c. References monitor_boundary. |
|
load monitoring data from EEPROM and activate it again This function reads the EEPROM contents and checks its checksum. If the checksum is correct the values are used to set the monitoring conditions for up to all sensors. Definition at line 206 of file command.c. References CHECKSUM_FILLER, EEPROM_BOUNDARY, EEPROM_CHECKSUM, EEPROM_DIRECTION, EEPROM_MONITOR, EEPROM_read(), monitor, monitor_boundary, and monitor_direction. Referenced by main(). |
|
signal if a report of the sensor values is due The routine counts the elapsed timeframes for reports and signals when the report is due at the current time slot.
Definition at line 84 of file command.c. References report, report_reload, and reporting. Referenced by main(). |
|
set the boundary value for a given sensor
Definition at line 195 of file command.c. References monitor_boundary. |
|
marks a sensor for reading after next measurement The marker corresponds to a bit number in the readenable status word
Definition at line 56 of file command.c. References masks, NR_SENSORS, and readenable. Referenced by CAN_interrupt(). |
|
writes the current monitoring conditions into the EEPROM
The needed checksum is calculated before writing the configuration. Definition at line 251 of file command.c. References CHECKSUM_FILLER, monitor, monitor_boundary, and monitor_direction. |
|
Initial value: { 0x00001,0x00002,0x00004,0x00008,0x00010,0x00020, 0x00040,0x00080,0x00100,0x00200,0x00400,0x00800, 0x01000,0x02000,0x04000,0x08000,0x10000,0x20000} Definition at line 46 of file command.c. Referenced by CheckMonitor(), Command_DisableMonitor(), Command_EnableMonitor(), and Command_SetRead(). |
|
stores a bit vector to mark which sensors are monitored Definition at line 20 of file command.c. Referenced by CAN_interrupt(), CheckMonitor(), Command_DisableMonitor(), Command_EnableMonitor(), Command_ReadDefaultConfiguration(), and Command_WriteDefaultConfiguration(). |
|
boundary values for monitoring The values are located in the indirect addressable IRAM of the T89C51CC02. Definition at line 43 of file command.c. Referenced by CheckMonitor(), Command_EnableMonitor(), Command_GetBoundary(), Command_ReadDefaultConfiguration(), Command_SetBoundary(), and Command_WriteDefaultConfiguration(). |
|
bit vector which indicates the direction of boundary monitoring Definition at line 23 of file command.c. Referenced by CheckMonitor(), Command_EnableMonitor(), Command_ReadDefaultConfiguration(), and Command_WriteDefaultConfiguration(). |
|
semaphore to schedule a reread of the EEPROM contents Definition at line 31 of file command.c. Referenced by CAN_interrupt(), and main(). |
|
stores a bit vector to mark which sensor values have to be sent after the current sampling cycle. The bit vector is automatically cleared when all scheduled readings have taken place. Definition at line 17 of file command.c. Referenced by Command_SetRead(), and main(). |
|
number of timeframes for reporting Definition at line 36 of file command.c. Referenced by Command_EnableReport(), and Command_ReportDue(). |
|
a flag that indicates if all sensor values should be reported Definition at line 26 of file command.c. Referenced by Command_EnableReport(), Command_ReportDue(), and main(). |
|
a flag that indicates whether the main loop shall report violations of the timing restrictions |
|
semaphore to schedule writing of new EEPROM contents Definition at line 33 of file command.c. Referenced by CAN_interrupt(). |