Introduction
One of the main characteristics of the control panel features - controlled by the ChipKit PI board - is that it supervise all the Meditech status changes, manages the alarms and does not need a control menu. Despite what is shown on the LCD color screen display - controlled by the RPI master Raspberry PI - the control panel is autonomous supporting a bidirectional communication meta-language with the RPI master. In this scenario the LCD display will constantly show the most updated useful information reflecting the current status of the probes and the entire Meditech device.
The control panel LCD display
The control panel LCD alphanumeric display receives the strings to be shown in the various conditions directly from the RPI master device; this has the advantage to reduce the code size of the micro controller board and in the meantime can be easily localized for different countries.
To reach this goal in a fast and reliable way, every different status to be shown should follow a specific architecture taking in account of the size limits of the hardware: 20 characters x 2 lines only. These are sufficient for spot information and dome frequently updated data i.e. the internal temperature of the Meditech device. In addition depending on the probe that is currently selected, when needed the control panel analog potentiometer can be used for some signal / level calibration with an immediate feedback.
To make possible this behavior with a reasonably small amount of code on the ChipKit board I have introduced the use of a templates for every composite display setting that should be presented on the LCD display.
How LCD templates are coded
LCD Templates are defined as a series of different objects in the LCDTemplates class. This reduces the LCD definition of a template to a simple case switch. Depending on the selected template, all the fields positions are defined as shown in the following scriptlet:
case TID_HEARTBEAT: fields.row[HEARTBEAT_TITLE] = 0; fields.col[HEARTBEAT_TITLE] = 0; fields.row[HEARTBEAT_SPOT] = 1; fields.col[HEARTBEAT_SPOT] = 0; fields.row[HEARTBEAT_SPOTVAL] = 1; fields.col[HEARTBEAT_SPOTVAL] = 5; fields.row[HEARTBEAT_AVERAGE] = 1; fields.col[HEARTBEAT_AVERAGE] = 10; fields.row[HEARTBEAT_AVERAGEVAL] = 1; fields.col[HEARTBEAT_AVERAGEVAL] = 15; numFields = HEARTBEAT_FIELDS; break;
As you can see, the advantage is that while the entire LCD screen content is described, only few integers are used. For the better readability every name is defined with a symbolic constant in the corresponding LCDTemplates.h header file (see below).
//! Heartbeat frequency template #define TID_HEARTBEAT 2 #define HEARTBEAT_FIELDS 5 #define HEARTBEAT_TITLE 0 #define HEARTBEAT_SPOT 1 #define HEARTBEAT_SPOTVAL 2 #define HEARTBEAT_AVERAGE 3 #define HEARTBEAT_AVERAGEVAL 4
The variable number of fields in every template is represented by an array of the simple field structure as shown in the following scriptlet
typedef struct LCDTemplateField { int row[6]; ///< Field row int col[6]; ///< Field column } field;
Thus every LCD template is encoded with its own ID (in the example above we have used the TID_HEARBEAT ID) there are two further simplifications in the mechanism, improving the response of the system and simplifying the communication.
- Accordingly with this case example, the RPI master send the 'L' command with the sequence including the Template ID to be used and only the fields content in the same order as they are defined in the class template: @L;02;"Heart Beat";"Spot";"110";"Avg.";"107"
- The class and header can be used specular in the RPI master communication process to create the commands. The only difference is that the master also includes the strings definitions sent to the control panel board for visualisation.
Template examples
The following images shows a gallery of templates generated by the commands sent to the control panel by the RPI master.
{gallery:width=640,height=480} Control Panel LCD Template |
---|
Reference
- The code repository of the code can be accessed on GitHub at the following address: https://github.com/alicemirror/chipkit_serial_pi
- The updated version of the documentation can be found on the documentation site at the following address: Meditech control panel software: Main Page
A preview copy of the documentation is attached below (PDF format)
Top Comments