Long and ULong variables not working in fc8

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

Moderator: Benj

Post Reply
kg300
Posts: 18
Joined: Thu May 31, 2018 6:25 am
Contact:

Long and ULong variables not working in fc8

Post by kg300 »

i am using 30 days trail of fc8. test program working in Fc simulation but not working on physical lcd. string printing is working on physical LCD but Long and Ulong calculation not working.
Attachments
test.fcfx
(9 KiB) Downloaded 53 times

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8874
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: Long and ULong variables not working in fc8

Post by medelec35 »

Hi,
For displaying long and ulong numbers and maybe uint instead of using PrintNumber you need to use PrintFormattedNumber
If variable is Ulong then use 1 for format
If variable is long then use 0 for format
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

kg300
Posts: 18
Joined: Thu May 31, 2018 6:25 am
Contact:

Re: Long and ULong variables not working in fc8

Post by kg300 »

Still not working. but i think this is problem in calculation icon, when i put value directly in long variable, it display fine, but when i put the SUM of two values in this variable it not exceed more then 32000 (like an Int variable). Is flowcode Trail version support morer then Int Variables??
Attachments
working.fcfx
(8.66 KiB) Downloaded 54 times
No_working.fcfx
(9.03 KiB) Downloaded 49 times

kersing
Valued Contributor
Valued Contributor
Posts: 1937
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Contact:

Re: Long and ULong variables not working in fc8

Post by kersing »

For math to use long type you need to assign the first value to the long type and then perform the operation on that long type variable. If you multiply two integers the result will be integer and that will be 'expanded' to long. If you assign the value to a long and then multiply the long with an integer the result will be long. (That is standard C practice, not limited to Flowcode)
Applies to all calculations, not only multiplication but addition, subtraction etc.
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

kg300
Posts: 18
Joined: Thu May 31, 2018 6:25 am
Contact:

Re: Long and ULong variables not working in fc8

Post by kg300 »

but the same program working fine with FC5, FC6 & FC7, not in FC8. Calculation not exceed more then 32000
:(
Attachments
V6.fcfx
(5.61 KiB) Downloaded 60 times

kersing
Valued Contributor
Valued Contributor
Posts: 1937
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Contact:

Re: Long and ULong variables not working in fc8

Post by kersing »

Does it work on hardware or in simulation for the other versions?
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8874
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: Long and ULong variables not working in fc8

Post by medelec35 »

Hi,
I have to agree with kersing.
BoostC compiler which is all flowcode versions up to and including V6 will work the way you want it to.
All versions V7 or greater will not work unless you do what kersing has suggested since the Ulong is typecast to signed integer.
Can you confirm about v7 working as that uses same compiler as V8.
The way to get it to work could be:
Should work.png
(93.32 KiB) Downloaded 1828 times
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

kg300
Posts: 18
Joined: Thu May 31, 2018 6:25 am
Contact:

Re: Long and ULong variables not working in fc8

Post by kg300 »

kersing can u modify it for me.
it working both on hardware and in simulation in fc6.
but in fc8, it simulate ok but not working on hardware. if i do something wrong in fc8 so please modify it for better understand

kersing
Valued Contributor
Valued Contributor
Posts: 1937
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Contact:

Re: Long and ULong variables not working in fc8

Post by kersing »

See Martins message above your reply.
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

Post Reply