Page 1 of 1

Lookup table 32 bit ints

Posted: Tue Aug 04, 2020 10:30 pm
by mnf
The lookup table doesn't seem to work with long (32 bit) ints.
test_lut.fcfx
(9.16 KiB) Downloaded 196 times
Has a lookup table (32 bit unsigned) - and two values stored GetInt(0) (returns a ULONG) returns 64 which is the LSB of the first item stored. It obviously just returns a byte - but the docs imply if should return an int.

Martin

Re: Lookup table 32 bit ints

Posted: Wed Aug 05, 2020 3:36 pm
by LeighM
Thanks for the spot. Yes, looks like a bug in the Arduino/AVR implementation

Re: Lookup table 32 bit ints

Posted: Wed Aug 12, 2020 1:15 pm
by LeighM
Hi Martin,
Please try the attached, to go into C:\ProgramData\MatrixTSL\FlowcodeV8\Components
Thanks
Leigh

Re: Lookup table 32 bit ints

Posted: Wed Aug 12, 2020 1:36 pm
by mnf
Thanks Leigh,

I'll give it a try...

Martin

Re: Lookup table 32 bit ints

Posted: Wed Aug 12, 2020 4:14 pm
by mnf
Thanks - seems to work AOK.. I've tried 16/32 bit signed and unsigned and float and all seems good..

The only gotcha I can find - is because GetInt returns an unsigned long - retrieving a signed 16 bit value to a 32 bit signed variable the result doesn't get sign extended. (so -2345 will give 63191 as a result.) - so have to use the right 'size' variable for the result.

Martin

Re: Lookup table 32 bit ints

Posted: Wed Aug 12, 2020 6:50 pm
by LeighM
Thanks Martin