Look Up Table - Size of elements

An area to discuss 8-bit PIC specific problems and examples

Moderator: Benj

Post Reply
George_B
Posts: 128
Joined: Wed Jul 04, 2012 11:21 pm
Location: Greece
Has thanked: 51 times
Been thanked: 19 times
Contact:

Look Up Table - Size of elements

Post by George_B »

Hi,

I have a question about the size of LUT in FC7.

Would it be possible to store large quantities of data such as 50000 elements as integers in first LUT
and another 50000 as float in a second LUT. :?

At the moment as far as i tested the component, it accepts approximately 6000 values.



Best Regards
George

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times
Contact:

Re: Look Up Table - Size of elements

Post by kersing »

The amount of elements you can add to a LUT depends on the microcontroller you want to use. For 8 bit pic 50000 would be a huge amount and I don’t thing it can be done. For int alone that would be 100000 flash positions in flash.
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

George_B
Posts: 128
Joined: Wed Jul 04, 2012 11:21 pm
Location: Greece
Has thanked: 51 times
Been thanked: 19 times
Contact:

Re: Look Up Table - Size of elements

Post by George_B »

kersing wrote:
Fri Mar 19, 2021 2:24 pm
The amount of elements you can add to a LUT depends on the microcontroller you want to use. For 8 bit pic 50000 would be a huge amount and I don’t thing it can be done. For int alone that would be 100000 flash positions in flash.
Thanks for your comment. I checked the LUT component again using larger memory and 16bit mcu but the maximum elements i can paste in are 6221.

So i hope it will be another way( maybe define the LUT in supplementary code) to support more elements in the table.


George

George_B
Posts: 128
Joined: Wed Jul 04, 2012 11:21 pm
Location: Greece
Has thanked: 51 times
Been thanked: 19 times
Contact:

Re: Look Up Table - Size of elements

Post by George_B »

just an update after some time trying different things..


I created 6 LUT droping 6 different components in my project's panel.

I then paste on each table the 4000 values. So in total i have 25000 values in those 6 LUT !

I compile the project and the result of the used space was amazingly vesy small!
Screenshot_1.jpg
Screenshot_1.jpg (16.06 KiB) Viewed 13618 times
:shock:


So now i am almost sure that the memory space is enough for holding the two LUT that i want to have (25000 elements on each table).

Do you think that there is any way of writing 25000 element in one LUT and not seperate the values in quantities of 6000 or less? :roll:


Thanks in advance!

George

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times
Contact:

Re: Look Up Table - Size of elements

Post by kersing »

This doesn’t make sense. If you have 4000 elements of 1 byte (let alone a larger integer) you need 4000 memory locations to store those values. None of the memory allocations in your output has 6 times 4000 elements = 24000 elements allocated. My guess is the lookup tables are truncated or the optimizer got rid of them (do you access any elements in your code?)
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

George_B
Posts: 128
Joined: Wed Jul 04, 2012 11:21 pm
Location: Greece
Has thanked: 51 times
Been thanked: 19 times
Contact:

Re: Look Up Table - Size of elements

Post by George_B »

kersing wrote:
Fri Mar 19, 2021 9:36 pm
This doesn’t make sense. If you have 4000 elements of 1 byte (let alone a larger integer) you need 4000 memory locations to store those values. None of the memory allocations in your output has 6 times 4000 elements = 24000 elements allocated. My guess is the lookup tables are truncated or the optimizer got rid of them (do you access any elements in your code?)

I thing you are right. In the simulation i can access all the elements of any of 6 LUT. After i checked the C code produced from the compiled project i realized that there are only the elements of the first LUT! The other 5 are mising from the code..




Flowcode8.c
(39.48 KiB) Downloaded 140 times

George_B
Posts: 128
Joined: Wed Jul 04, 2012 11:21 pm
Location: Greece
Has thanked: 51 times
Been thanked: 19 times
Contact:

Re: Look Up Table - Size of elements

Post by George_B »

I focused on the solution to my problem and not so much on how to write huge tables in the microcontroller.
Therefore i am wondering if it is good idea to use an external EEPROM chip to do the job. With what characteristics should i choose the EEPROM chip in order to be able to holt the amount of data i want?

Post Reply