Hello,
I am currently working on a project using Flowcode with E-Blocks where I need to receive CAN mesages (both STD and EXT message IDs), break them down to 1 byte and send them out over RS232. The STD IDs are easy as they are already broken down for me into Hi an Lo bytes by Flowcode. Is there a way to break down the EXT ID (32 bit) into four 8-bit bytes? I read somewhere in the Flowcode documentation that Flowcode does not do 32-bit math - is this true? I believe that I can just use a series of logical ANDs to break down the EXT ID into 4 bytes, is this right?
Any help would be greatly appreciated!
Thanks,
Phil
CAN2 message ID - breaking it down to 1 byte
-
- Posts: 10
- Joined: Wed Apr 15, 2009 3:50 pm
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: CAN2 message ID - breaking it down to 1 byte
Hi Phil
Yes this can be done fairly easily.
32-bit maths is supported by the compiler but not currently by Flowcode itself. This just makes things easier to understand in most cases.
You can use the "GetRxIsExt" function to detect if an incoming message has an extended ID.
The function "GetRxExtID" allows a byte from the extended ID portion of the ID to be retrieved. Giving the parameter 0 returns the low byte, 1 returns the middle byte and 2 returns the highest 2 bits in byte form.
The function "GetRxExtIDAsFull" allows a byte from the complete ID (standard and extended) to be retrieved. Giving the parameter 0 returns the low byte, 1 returns the low middle byte, 2 returns the high middle byte and 3 returns the highest 5 bits in byte form.
Hope this helps.
Yes this can be done fairly easily.
32-bit maths is supported by the compiler but not currently by Flowcode itself. This just makes things easier to understand in most cases.
You can use the "GetRxIsExt" function to detect if an incoming message has an extended ID.
The function "GetRxExtID" allows a byte from the extended ID portion of the ID to be retrieved. Giving the parameter 0 returns the low byte, 1 returns the middle byte and 2 returns the highest 2 bits in byte form.
The function "GetRxExtIDAsFull" allows a byte from the complete ID (standard and extended) to be retrieved. Giving the parameter 0 returns the low byte, 1 returns the low middle byte, 2 returns the high middle byte and 3 returns the highest 5 bits in byte form.
Hope this helps.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 10
- Joined: Wed Apr 15, 2009 3:50 pm
Re: CAN2 message ID - breaking it down to 1 byte
Hi Ben,
Thanks! That is exactly what I needed!!
Phil
Thanks! That is exactly what I needed!!
Phil