Objective
I have a global TX array, and a CRC function that has to progress through this array. The CRC function should not process the first byte. To avoid this I am trying to increment the array by doing TX++. This is causing problems.
Problem
Please take a quick look at the code below:
void Send_To_Manager(void)
{
TX[0] = 0x55;
TX[1] = 0x00;
TX[2] = 0x01;
TX[3] = 0x00;
TX[4] = COMMON_COMMAND;
TX++;
TX[5] = CRC8(TX,4);
TX[6] = CO_RD_VERSION;
TX += 5;
TX[7] = CRC8(TX,1);
TX -= 6;
UART_TX(8);
}
I would like to blind the CRC8 function of the first byte in the TX array. By executing TX++, I am expecting the TX[0] to be 0x00. However I am getting the error:
error: wrong type argument to increment
I am also getting the errors for TX += 5; and TX -= 6 as:
error: incompatible types in assignment
I played around with this, so instead if the function has an array such as:
void Send_To_Manager(unsigned char data[100])
{
data++;
}
The above works as intended.
Questions
- Why can I do this for Function based arrays and not Global arrays?
- If I do wish to do this for global arrays how can I do it?
- How would you prefer to achieve the above objective?
Thank you all for your time.