ComsIF default; default values
1;                    Comm.s Port No. - click [idle] to open the RS232 port, click [rx.ing] to close it
46;                   max.no.of rx.d bytes = the no.of bytes displayed in the 'received' field array - to prevent wrap-around
#;                    start char. - received bytes are ignored until this char.is received
1;                    baud rate selection: 1=2400, 2=9600, 3:19200, 4:57600, 5:115200
1;    see (*1) below  checksum  selection: 1=none, 2=bytesum, 3=bytesum^0xff, 4=bytsum^0xff+1, 5=chksum1, 6=chksum2, 7=bytecount3ASCII, 8=byteXOR
500;                  timeout (ms): all data bytes within this time frame are displayed on one line (or wrapped)
0;                    rx-to-tx min.delay (msec): minimum delay before a response is sent (e.g. uploading)
;                     day of week (1-7 = Su-Sa): if 1-7, this is inserted between day and hour
;                     clicking [msg.1] transmits the adjacent contents as message body
;                     [msg.2]
#V;                   [msg.3]
#P;                   [msg.4]
0x64aaa0x000x06;      DTG msg.-1 - this is transmitted after the preamble
DTG;                  DTG msg.-2 - this is replaced by year-month-day-(day of week)-hour-min-sec & transmitted after "DTG msg.-1" followed by crc
0x69aaa0x000x00;      upload hex file msg. - this message will start uploading of a HEX file according to a specific protocol
;                     message preamble (before crc) - this is transmitted before [msg.1,2,3,4,5] or [DTG msg.]
;                     message postamble (after crc) - this is transmitted after [msg.1,2,3,4,5] or [DTG msg.] and crc
;                     byte to be repeated (stuffed)
0x06;                 clicking [msg.5] transmits the adjacent contents with neither preamble, crc nor postamble
;                     char-2-char delay

***************************************************************************************************
(*1)
checksum/crc is calculated as follows:
2=bytesum: all databytes are simply added, ignoring the carry bit
3=bytesum^0xff: as in 'bytesum' but the result is xor'ed with 255 (bit-inverted)
4=bytsum^0xff+1: as in 'bytesum' but the result is bit-inverted and incremented by 1 (=2's complement)
5=chksum1: 'newchksum(&crc,string[n]);' is performed for each byte:
//---------------------------------------------------------------------------
  char const CheckSumTable[256] = {
 0x00, 0x83, 0x85, 0x06, 0x89, 0x0a, 0x0c, 0x8f,
 0x91, 0x12, 0x14, 0x97, 0x18, 0x9b, 0x9d, 0x1e,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, 0x8a, 0x09, 0x0f, 0x8c,
 0x92, 0x11, 0x17, 0x94, 0x1b, 0x98, 0x9e, 0x1d,
 0xa2, 0x21, 0x27, 0xa4, 0x2b, 0xa8, 0xae, 0x2d,
 0x33, 0xb0, 0xb6, 0x35, 0xba, 0x39, 0x3f, 0xbc,
 0xc2, 0x41, 0x47, 0xc4, 0x4b, 0xc8, 0xce, 0x4d,
 0x53, 0xd0, 0xd6, 0x55, 0xda, 0x59, 0x5f, 0xdc,
 0x63, 0xe0, 0xe6, 0x65, 0xea, 0x69, 0x6f, 0xec,
 0xf2, 0x71, 0x77, 0xf4, 0x7b, 0xf8, 0xfe, 0x7d,
  };
//---------------------------------------------------------------------------

void newchksum(unsigned char *chksum, unsigned char data)
{
  unsigned char chkndx;

    chkndx = *chksum ^ data;
    *chksum ^= CheckSumTable[chkndx];
}
//---------------------------------------------------------------------------

6=chksum2: 'compute_crc16((unsigned char*)txstring,length);' is performed on the whole byte string:
//---------------------------------------------------------------------------
unsigned char const crc16_lo[256] = {
      0x00,0xc1,0x81,0x40,0x01,0xc0,0x80,0x41,
      0x01,0xc0,0x80,0x41,0x00,0xc1,0x81,0x40,
      0x01,0xc0,0x80,0x41,0x00,0xc1,0x81,0x40,
      0x00,0xc1,0x81,0x40,0x01,0xc0,0x80,0x41,
      0x01,0xc0,0x80,0x41,0x00,0xc1,0x81,0x40,
      0x00,0xc1,0x81,0x40,0x01,0xc0,0x80,0x41,
      0x00,0xc1,0x81,0x40,0x01,0xc0,0x80,0x41,
      0x01,0xc0,0x80,0x41,0x00,0xc1,0x81,0x40,
      0x01,0xc0,0x80,0x41,0x00,0xc1,0x81,0x40,
      0x00,0xc1,0x81,0x40,0x01,0xc0,0x80,0x41,
      0x00,0xc1,0x81,0x40,0x01,0xc0,0x80,0x41,
      0x01,0xc0,0x80,0x41,0x00,0xc1,0x81,0x40,
      0x00,0xc1,0x81,0x40,0x01,0xc0,0x80,0x41,
      0x01,0xc0,0x80,0x41,0x00,0xc1,0x81,0x40,
      0x01,0xc0,0x80,0x41,0x00,0xc1,0x81,0x40,
      0x00,0xc1,0x81,0x40,0x01,0xc0,0x80,0x41,
      0x01,0xc0,0x80,0x41,0x00,0xc1,0x81,0x40,
      0x00,0xc1,0x81,0x40,0x01,0xc0,0x80,0x41,
      0x00,0xc1,0x81,0x40,0x01,0xc0,0x80,0x41,
      0x01,0xc0,0x80,0x41,0x00,0xc1,0x81,0x40,
      0x00,0xc1,0x81,0x40,0x01,0xc0,0x80,0x41,
      0x01,0xc0,0x80,0x41,0x00,0xc1,0x81,0x40,
      0x01,0xc0,0x80,0x41,0x00,0xc1,0x81,0x40,
      0x00,0xc1,0x81,0x40,0x01,0xc0,0x80,0x41,
      0x00,0xc1,0x81,0x40,0x01,0xc0,0x80,0x41,
      0x01,0xc0,0x80,0x41,0x00,0xc1,0x81,0x40,
      0x01,0xc0,0x80,0x41,0x00,0xc1,0x81,0x40,
      0x00,0xc1,0x81,0x40,0x01,0xc0,0x80,0x41,
      0x01,0xc0,0x80,0x41,0x00,0xc1,0x81,0x40,
      0x00,0xc1,0x81,0x40,0x01,0xc0,0x80,0x41,
      0x00,0xc1,0x81,0x40,0x01,0xc0,0x80,0x41,
      0x01,0xc0,0x80,0x41,0x00,0xc1,0x81,0x40,};

unsigned char const crc16_hi[256] = {
      0x00,0xc0,0xc1,0x01,0xc3,0x03,0x02,0xc2,
      0xc6,0x06,0x07,0xc7,0x05,0xc5,0xc4,0x04,
      0xcc,0x0c,0x0d,0xcd,0x0f,0xcf,0xce,0x0e,
      0x0a,0xca,0xcb,0x0b,0xc9,0x09,0x08,0xc8,
      0xd8,0x18,0x19,0xd9,0x1b,0xdb,0xda,0x1a,
      0x1e,0xde,0xdf,0x1f,0xdd,0x1d,0x1c,0xdc,
      0x14,0xd4,0xd5,0x15,0xd7,0x17,0x16,0xd6,
      0xd2,0x12,0x13,0xd3,0x11,0xd1,0xd0,0x10,
      0xf0,0x30,0x31,0xf1,0x33,0xf3,0xf2,0x32,
      0x36,0xf6,0xf7,0x37,0xf5,0x35,0x34,0xf4,
      0x3c,0xfc,0xfd,0x3d,0xff,0x3f,0x3e,0xfe,
      0xfa,0x3a,0x3b,0xfb,0x39,0xf9,0xf8,0x38,
      0x28,0xe8,0xe9,0x29,0xeb,0x2b,0x2a,0xea,
      0xee,0x2e,0x2f,0xef,0x2d,0xed,0xec,0x2c,
      0xe4,0x24,0x25,0xe5,0x27,0xe7,0xe6,0x26,
      0x22,0xe2,0xe3,0x23,0xe1,0x21,0x20,0xe0,
      0xa0,0x60,0x61,0xa1,0x63,0xa3,0xa2,0x62,
      0x66,0xa6,0xa7,0x67,0xa5,0x65,0x64,0xa4,
      0x6c,0xac,0xad,0x6d,0xaf,0x6f,0x6e,0xae,
      0xaa,0x6a,0x6b,0xab,0x69,0xa9,0xa8,0x68,
      0x78,0xb8,0xb9,0x79,0xbb,0x7b,0x7a,0xba,
      0xbe,0x7e,0x7f,0xbf,0x7d,0xbd,0xbc,0x7c,
      0xb4,0x74,0x75,0xb5,0x77,0xb7,0xb6,0x76,
      0x72,0xb2,0xb3,0x73,0xb1,0x71,0x70,0xb0,
      0x50,0x90,0x91,0x51,0x93,0x53,0x52,0x92,
      0x96,0x56,0x57,0x97,0x55,0x95,0x94,0x54,
      0x9c,0x5c,0x5d,0x9d,0x5f,0x9f,0x9e,0x5e,
      0x5a,0x9a,0x9b,0x5b,0x99,0x59,0x58,0x98,
      0x88,0x48,0x49,0x89,0x4b,0x8b,0x8a,0x4a,
      0x4e,0x8e,0x8f,0x4f,0x8d,0x4d,0x4c,0x8c,
      0x44,0x84,0x85,0x45,0x87,0x47,0x46,0x86,
      0x82,0x42,0x43,0x83,0x41,0x81,0x80,0x40,};
//---------------------------------------------------------------------------

union
{
   unsigned int   crcWord;
   unsigned char  crc_char[2];
} crc16;
//---------------------------------------------------------------------------

unsigned short int compute_crc16(unsigned char *p, unsigned short int len)
{
  unsigned char crc_hi, crc_lo, dataByte;
  int i1;

  crc16.crcWord = 0;
  for (i1=0; i1<len; i1++)
  { dataByte = p[i1];
    crc_hi   =  crc16_hi[crc16.crc_char[0] ^ dataByte];
    crc_lo   =  crc16_lo[crc16.crc_char[0] ^ dataByte];
    crc16.crcWord = ((unsigned int)crc_hi << 8) | ((unsigned int)crc_lo ^ crc16.crc_char[1]);
  }
  return((unsigned short int)crc16.crcWord);
}
//---------------------------------------------------------------------------

7=bytecount3ASCII: as a "crc", 2 ascii characters are appended, representing the no.of bytes in decimal
8=byteXOR: starting with 0, each byte is XOR'ed with the previous result
***************************************************************************************************