Updated 2020-04-27 for microcontroller code v3.23
1-SETTINGS
Settings are sent when communication between uC and PC are (re-)started.
Communicated in plain text, with message counter checksum.
Default values are stored on the microcontroller and are sent to the PC at startup.
When the user changes settings on the pc, these new settings are sent to the microcontroller and acknowledged
The checksum is 1 byte, computed as the XOR of all previous bytes in the message.
Format
Setting=value(float)=counter(1 byte)=checksum(1 byte)
Example
ACTIVE=1.0=F=?
List of settings
ALARM // 0 alarm state
RR // 1 respiratory rate
VT // 2 tidal volume
PK // 3 peak pressure
PS // 4 support pressure
PP // 5 peep
IE // 6 I/E as float ==> 1:2 = 0.33
RP // 7 Ramp time
TS // 8 Flow trigger
TP // 9 Pressure trigger
ADPK // 10 Peak pressure deviation
ADVT // 11 Tidal volume deviation
ADPP / 12 Peep pressure deviation
MODE // 13 Mode: 0 = pressure triggered, 1 = flow triggered
ACTIVE // 14 Active: 0 = disabled, 1 = startup peep, 2 = active
MT // 15 Mute: 0 = no mute / sound, 1 = mute, no sound
FIO2 // 16 Oxygen level
FW // 17 Firmware version
These messages require an acknowledgement.
2-MEASURED VALUES
Measured values are sent approx every 50 ms
They are communicated as a binary string to reduce message size.
The start is indicated by start of text (0x02), followed by message type (0x01) and the length of the message.
Then come all measured values, in the order described below.
The checksum is calculated on the measured values only and is computed as before.
The end is indicated by the newline character (0x0A)
Format
message[0] = 0x02;
message[1] = 0x01;
message[2] = messagelength;
message[3] = (char)TRIG;
message[4] = (char)((int)(VOL*10));
message[5] = (char)((int)(VOL*10) >> 8);
message[6] = (char)((int)(PRES*100));
message[7] = (char)((int)(PRES*100) >> 8);
message[8] = (char)((int)(TPRES*100));
message[9] = (char)((int)(TPRES*100) >> 8);
message[10] = (char)((int)(BPM*100));
message[11] = (char)((int)(BPM*100) >> 8);
message[12] = (char)((int)(FLOW*100));
message[13] = (char)((int)(FLOW*100) >> 8);
message[14] = (char)((int)(FIO2*100));
message[15] = (char)((int)(FIO2*100) >> 8);
message[16] = (char)(currenttime);
message[17] = (char)(currenttime >> 8);
message[18] = (char)(currenttime >> 16);
message[19] = (char)(currenttime >> 24);
message[20] = getCRCvalue(message, 18);
message[21] = 0x0A;
These messages don't require an acknowledgement.
Messages with the wrong checksum are discarded.
3-ALARMS & CPU
Alarms are being sent every 1 second.
Communicated in plain text as un unsigned integer, with message counter checksum.
The checksum is 1 byte, computed as the XOR of all previous bytes in the message.
Format
ALARM=value=counter=checksum
Alarm bits
0: 'Alarm not defined'
1: 'Pressure not within thresholds'
2: 'Volume not within thresholds'
3: 'Oxygen calibration failed'
4: 'Pressure sensor error'
5: 'Machine is overheating'
6: 'Flow sensor error'
7: 'Pressure sensor calibration failed'
8: 'Flow sensor calibration failed'
9: 'Limit switch sensor error'
10: 'HALL sensor error'
11: 'No external power, switch to battery'
12: 'Battery low'
13: 'Battery critical'
14: 'Fan not operational'
15: 'GUI not found' If an alarm state is triggered on the microcontroller, the microcontroller will activate the buzzer. If the connection to the PC is interrupted, the microcontroller will activate the buzzer. The PC does processing on the incoming measurement date, implementing the error ranges set on the PC. If the PC triggers an alarm, ALARM STATE=1 is set as in 1-Settings, and the microcontroller activates the buzzer. The cause of the alarm is shown on the interface, but is not communicated to the mcirocontroller.
4-CPU USAGE
Similar to the alarms, but on a 3 second interval.
Number between 0 and 100 to indicate % use.
5- ACK
Acknowledgement messages are used to confirm correct receipt of the setting values.
Communicated in plain text, with message counter of the message to be ack'ed and checksum.
The checksum is 1 byte, computed as the XOR of all previous bytes in the message.
Format
ACK=counter=checksum