Dear All,
I am trying to store array of bytes as an integer and the compare this value to the value of Timer Count Register.
Referring to the code I have here, I am only interested in values of ASN.
app_vars.uart_txFrame[0] = app_vars.rxpk_buf[17]; // ASN #1
app_vars.uart_txFrame[1] = app_vars.rxpk_buf[18]; // ASN #2
app_vars.uart_txFrame[2] = app_vars.rxpk_buf[19]; // ASN #3
app_vars.uart_txFrame[3] = app_vars.rxpk_buf[20]; // ASN #4
app_vars.uart_txFrame[4] = app_vars.rxpk_buf[21]; // ASN #5
app_vars.uart_txFrame[5] = 0xff; // closing flag
app_vars.uart_txFrame[6] = 0xfb; // closing flag
I have declared another varriable uint64_t ASN to make sure that maximum values can be stored.
Initially I thought that unit64_t ASN = apps.vars.uart_txFrame[0] + apps.vars.uart_txFrame[1] + apps.vars.uart_txFrame[2]+apps.vars.uart_txFrame[3] + apps.vars.uart_txFrame[4] would do the job
However, this just add bytes not representing the right values. For instance,
apps.vars.uart_txFrame[0] = 0X61;
apps.vars.uart_txFrame[1] = 0XCC;
apps.vars.uart_txFrame[2] = 0X06;
apps.vars.uart_txFrame[3] = 0X00;
apps.vars.uart_txFrame[4] = 0X00;
which ASN should represent value of 445537; bytes are encoded in little endian.
If anyone could give me advice storing the byte array correctly, it will be really helpful.
Thank you