LUT Look Up Tables and Variable Types

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

Moderator: Benj

Post Reply
User avatar
Jay Dee
Posts: 398
Joined: Tue Aug 18, 2009 6:42 pm
Has thanked: 121 times
Been thanked: 154 times
Contact:

LUT Look Up Tables and Variable Types

Post by Jay Dee »

Hi Guys,
Using ECIO40P and FC v6.0.3.0
I have a need to use a Look Up Table, My understanding is 8 Bit PICs (18F4455 in this case) allow you to store a max of 256, 8 bit integer values in a single LUT.
What seemed odd, is the LUT component calls for a UInt index value and will return a ULong ? Can I just supply an Integer Index and get a Integer Value back from the LUT ?

Regarding variables...
Again I thought 8 bit PICs only allow the use of integers?
The variables interface however allows me to specifc Int, UInt, Long and ULong. I'm pretty sure the 8 bit PICs do not natively handle these so is there some fancy little FC maths in the background making it possible for us to use these larger range numbers in our programs?

Even if this is possible, I guess for speed its best to stay within the native 8 bit byte values??
Thanks for anyone who can clear this confusion up. :?
Regards,
J.

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: LUT Look Up Tables and Variable Types

Post by JonnyW »

Hi. On download the LUT will return whatever bit-width you set it to.

Flwocode can not (at the moment) dynamically alter the variable type returned from a macro. So in simulation it always returns a 32-bit integer. I believe the bit-width is a property of the LUT.

It is always best to stick with the bit-width of the target chip for speed - 8 for PIC, 16 for dsPIC, 32 for ARM, etc. It is actually the C compiler that deals with the 32-bit maths for us, but if it did not we would ensure there were routines to handle this, yes. 32-bit maths on the PIC is very slow in comparison.

Cheers,

Jonny

Post Reply