CAN packing
At the moment I am having to manually pack CAN messages using bit shifts, masks, mux etc in order to construct 8 bytes of data to transmit a CAN message. An example of one such message is shown below...
johngreenjets_0-1684499366144.png
However, this is very tedious especially when there are lots of CAN messages to pack.
I came across the embedded coder block 'CAN pack' which imports the CAN database, but unfortunately I cannot get this to work.
There is a data type mismatch because the 'CAN Pack' output is not a structure...
johngreenjets_1-1684499782245.png
The 'CAN pack' block does not seem to output structures...
johngreenjets_2-1684499952227.png
Should this 'CAN pack' block work with the 'FCAN_Send' block and if so, how ?
If not, is there another way of packing the CAN messages (preferably by importing a CAN database) ?
CAN unpacking
I haven't tried unpacking signals from the 'FCAN_Receive' block yet, so far I have only unpacked the 8 raw bytes of data as shown below...
johngreenjets_3-1684500311364.png
For testing purposes I have made byte 1 control a digital output (LED).
How can I extract the signals from the 8 bytes of raw data, without having to manually implement the unpacking using bit shifts, masks, mux etc
I tried the embedded coder block 'CAN unpack' which imports the CAN database, but unfortunately I cannot get this to work.
There is a data type mismatch because the 'CAN unpack' input does not allow structures...
johngreenjets_4-1684501055288.png
Should this 'CAN unpack' block work with the 'FCAN_Receive' block and if so, how ?
If not, is there another way of unpacking the CAN messages (preferably by importing a CAN database) ?