It appears that only the first byte of the long b_MyReceivedByte is copied to that particular byte array container (b_waitingToBeParsed[byteMoveIndex]), have I understood that correctly? The remaining 3 bytes are discarded whether they hold non zero data, a null value or terminating zeros? And then that single byte is added to the incrementing byte array?
First, it is a long because we need to catch the special case of -1, any other result will fit into the LSB. IOW, the possible results from RxCheck are $00..$FF and $FFFF_FFFF. Second, b_waitingToBeParsed[] appears to be a byte array so it only will accept bytes for assignment. Also, in terms of returned data there are noremaining 3 bytes in this long, RxCheck only returns a single character/byte (besides the no-data indicator).
This single byte is then added to the string array.
The code I had post previously had been bugging me all evening yesterday as I was away from my computer.
I had used the same variable to received the returned value from "rxcheck" in hopes of only making small changes to Brad's original code.
I usually use a local variable "localCharacter" to receive the return value. Since all local variables are longs, a local variable would have held the "-1" returned by "rxcheck".
Thank you both, I think I understand now. The -1 is bigger than a byte, I did not know that before and it appears it would be the $FFFF_FFFF, or a long with all binary 1's and that makes sense.
Comments
This single byte is then added to the string array.
The code I had post previously had been bugging me all evening yesterday as I was away from my computer.
I had used the same variable to received the returned value from "rxcheck" in hopes of only making small changes to Brad's original code.
I usually use a local variable "localCharacter" to receive the return value. Since all local variables are longs, a local variable would have held the "-1" returned by "rxcheck".