Here a bit of information for any one thats wanting to setup the datalogging using demons datalogging stream.
First you need to setup the datastream.
You want to use the DR command for this.
Code:
byte[] array = new byte[11] //DR command for demon.
//'D'+'R'+a+b+c+d+x+m1+n1+B(1,1)+…+B(x,mx)+CS
{
68, //D
82, //R
31, //ADC fetch mask 0
23, //baud rate divisor
0, //nothing
0, //nothing
1, //Request rate
1, //Respond rate
52, //Datalogging length
32, //Request byte to send.
0
};
Now now that the datalogging stream is setup you can request datalogging packets by sending "d" command.
Heres a sample request and packet.
Code:
//Request
0x64 d
//Responce
4F 1E 92 3A F9 7F 4C 3A 02 00 0C 06 05 00 20 00 O.’:ùL:...... .
00 00 F9 08 8B 8B 08 39 20 E8 70 80 00 80 00 80 ..ù.‹‹.9 èp€.€.€
5B 85 80 80 80 80 80 00 40 00 00 00 00 02 7F C7 […€€€€€.@.....Ç
00 00 1D 15 8B 03 8E 03 80 03 72 03 66 03 85 4F ....‹.Ž.€.r.f.…O
2E .
1st byte = Datalogging stream Status O = ok, T = timeout
Bytes 2 onwards normal 52 byte data stream
Last byte = Checksum.
2nd last byte analog status O = ok, T = timeout.
Conversion for Demon Analog 2 bytes to single byte for ease of use.
Code:
DemonA1 = (byte)ConvertRange(0, 1024, 0, 255, (Byte[54] | Byte[53] << 8));
DemonA2 = (byte)ConvertRange(0, 1024, 0, 255, (Byte[56] | Byte[55] << 8));
DemonA3 = (byte)ConvertRange(0, 1024, 0, 255, (Byte[58] | Byte[57] << 8));
DemonA4 = (byte)ConvertRange(0, 1024, 0, 255, (Byte[60] | Byte[59] << 8));
DemonA5 = (byte)ConvertRange(0, 1024, 0, 255, (Byte[62] | Byte[61] << 8));