Can component

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 6.

Moderator: Benj

Post Reply
JFinlayson
Posts: 93
Joined: Mon Sep 23, 2013 4:33 pm
Has thanked: 5 times
Been thanked: 6 times
Contact:

Can component

Post by JFinlayson »

I am having problems with extended addressing and printing to Glcd. using number to Hex does not display correctly as it does not have the range, example the ID that is being transmited is 127505 which is 1F211Hex hoever Hex to string only prints F211.
Trying to get the extended ID into long variable using GetRXIdent does not seem to give the correct results. As extended can uses 11 bit and an 18Bit address. Somewhere along the line things seem to be wrong maybe its me. Have you a help file somewhere that explains how you get the ID in extended addressing mode.
I have enclosed my test programe.
Attachments
CanTest1.fcfx
(23.13 KiB) Downloaded 244 times
The older the boy the bigger the toy

User avatar
JonnyW
Posts: 1230
Joined: Fri Oct 29, 2010 9:13 am
Location: Matrix Multimedia Ltd
Has thanked: 63 times
Been thanked: 290 times
Contact:

Re: Can component

Post by JonnyW »

Hello. I will raise a bug on the hex-conversion function, and we can make sure it handles 32-bit values in future releases.

As a workaround you could always do:
tmp_string = IntToHex$(id_word)
can_string = IntToHex$(id_word >> 16)
can_string = can_string + tmp_string

This should give you your full 32-bits.

Cheers,

Jonny

JFinlayson
Posts: 93
Joined: Mon Sep 23, 2013 4:33 pm
Has thanked: 5 times
Been thanked: 6 times
Contact:

Re: Can component

Post by JFinlayson »

Thanks!
The older the boy the bigger the toy

JFinlayson
Posts: 93
Joined: Mon Sep 23, 2013 4:33 pm
Has thanked: 5 times
Been thanked: 6 times
Contact:

Re: Can component

Post by JFinlayson »

OK using what you have said above
ID=Can1::GetRXIdent(0)

StrIDtp = NumberToHex$ (ID)
Temp = Length$ (StrIDtp)
StrIDtp = Right$ (StrIDtp,temp - 2)
strID = NumberToHex$ (ID >> 16)
strID = strID + StrIDtp

However it returns 0x19F21170 it should return 0x1F211 which is 127505 Dec
Where is extra comming from on Can ID
The older the boy the bigger the toy

JFinlayson
Posts: 93
Joined: Mon Sep 23, 2013 4:33 pm
Has thanked: 5 times
Been thanked: 6 times
Contact:

Re: Can component

Post by JFinlayson »

Hi
I have managed to get the correct CAN ID by the following
IDLow = ID >> 8
IDHigh = ID >> 24
IdHigh = IDHigh << 14
IDHigh = IDHigh >> 14
StrIDtp = NumberToHex$ (IDLow)
Temp = Length$ (StrIDtp)
StrIDtp = Right$ (StrIDtp,temp - 2)
strID = NumberToHex$ (IDHigh)
strIDHigh = strID
strID = strID + StrIDtp

Is it possible that there is a problem with the CAN component when used in extended addressing mode??

Regards
The older the boy the bigger the toy

User avatar
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: Can component

Post by Benj »

Hello,

I'll do some investigation for you on this and see if I can find the cause of the issue.

JFinlayson
Posts: 93
Joined: Mon Sep 23, 2013 4:33 pm
Has thanked: 5 times
Been thanked: 6 times
Contact:

Re: Can component

Post by JFinlayson »

Much obliged, It would be nice to confirm if there is something wrong with can component or not!
The older the boy the bigger the toy

JFinlayson
Posts: 93
Joined: Mon Sep 23, 2013 4:33 pm
Has thanked: 5 times
Been thanked: 6 times
Contact:

Re: Can component

Post by JFinlayson »

Hi Benj
How has investigation on can component going, have you found anything with extended addressing?
The older the boy the bigger the toy

Post Reply