To simplify my question, how do you access a given byte of a register?
Reading a register and testing for a bit set is usually done by performing a bit-wise AND.
In C-language (as you certainly know) is done with the "&" operator. There are several bit-masks already defined for CAN-registers making the code more readable and as such life easier.
Thanks for the reply. I have experience bitmasking, however, I do not know how to get the regester in the first place. In the examples, the ISR uses this line to clear the interrupt.
CAN_INT_SR_REG.byte[1u] = CAN_TX_MESSAGE_MASK;
However, it does not specifiy which TX buffer caused the interrupt.
It would help to be able to view the status of this register in the debugger, however, I have yet to find a way to view registers.
"Register" is in the case of CAN only a name within a structure. You may see the structure's address and contents in the debugger. You have to investigate through the generated code. Easier could be to store the value into a local var and observe it in debugger;
Thanks for the suggestions. I had to be sure to set build options to debug mode so unused variables could be viewed in the debugger for easier debugging. Otherwise, the compiler would remove them.
Also, I found a solution to my problem. Instead of trying to directly access the register, I used a snippet of code from the generated CAN_TX_RX_func file that servers a similar purpose.
For the PSoC5LP:
(CAN_TX[1u].txcmd.byte[0u] & CAN_TX_REQUEST_PENDING)
This line of code checks the status of TX message buffer 1. It returns zero if the message has already been sent, and one if the message is waiting to be sent.