Long and ULong variables not working in fc8
Moderator: Benj
Long and ULong variables not working in fc8
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 208 times
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: Long and ULong variables not working in fc8
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
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
Re: Long and ULong variables not working in fc8
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 193 times
-
- No_working.fcfx
- (9.03 KiB) Downloaded 203 times
-
- Valued Contributor
- Posts: 2045
- Joined: Wed Aug 27, 2008 10:31 pm
- Location: Netherlands
- Has thanked: 553 times
- Been thanked: 1081 times
- Contact:
Re: Long and ULong variables not working in fc8
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.
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
― C.S. Lewis
Re: Long and ULong variables not working in fc8
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 194 times
-
- Valued Contributor
- Posts: 2045
- Joined: Wed Aug 27, 2008 10:31 pm
- Location: Netherlands
- Has thanked: 553 times
- Been thanked: 1081 times
- Contact:
Re: Long and ULong variables not working in fc8
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
― C.S. Lewis
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: Long and ULong variables not working in fc8
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:
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:
Martin
Re: Long and ULong variables not working in fc8
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
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
-
- Valued Contributor
- Posts: 2045
- Joined: Wed Aug 27, 2008 10:31 pm
- Location: Netherlands
- Has thanked: 553 times
- Been thanked: 1081 times
- Contact:
Re: Long and ULong variables not working in fc8
See Martins message above your reply.
“Integrity is doing the right thing, even when no one is watching.”
― C.S. Lewis
― C.S. Lewis
- AbhijitR
- Posts: 298
- Joined: Fri Nov 07, 2014 12:48 pm
- Location: Pune, India
- Has thanked: 279 times
- Been thanked: 78 times
- Contact:
Re: Long and ULong variables not working in fc8
Hello! KERSING
Abhi
Many thanks for the post, it worked for me.kersing wrote: ↑Sat Oct 13, 2018 12:44 pmFor 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.
Abhi