Page 2 of 2

Re: Look Up Tables using Flowcode and Microsoft Excel

Posted: Sat Jan 22, 2011 12:48 pm
by medelec35
Chirikas wrote: I have few other questions, maybe you have zens circuit drawn with some software? ?
Sorry have not got the circuit diagram
Chirikas wrote: Maybe it would help me to understand all connections. Maybe some other chip could be used instead of 16f884 and 16f887?
The great feature of flowcode is you don't have to sick with a circuit diagram posted.
You can load up the posted flowchart then select your own choice of microcontroller, o/p and i/p pins and osc type e.g crystal, ceramic, internal (so long as target device supports internal osc)
Just remember to set the configuration settings for your target device, or you will find hardware will not work.
See:
http://www.matrixmultimedia.com/mmforum ... =26&t=6936
For help and general advice.
There are plenty of people on this forum that are willing to help you when you get stuck.
As for drawing a schematic, if you want to give that a bash yourself, there seems to be a new popular packge called Designspark PCB. Only just downloaded and registered it all for free!
Plus unlike other free design software this one has no limitations, can import eagle libraries, good support and recommended by RS components.

Re: Look Up Tables using Flowcode and Microsoft Excel

Posted: Sat Jan 22, 2011 6:08 pm
by zen
I guess I should have explained the circuit drawing. You should scroll down to the bottom of the circuit schematic drawing to the detail on how I made the "reset" and "button" inputs. I did not have enough room to draw them in full on the top picture so I drew them on the bottom. I based the pushbutton design from some demo board made by microchip. If i'm ever in doubt about a design element I look up a microchip demo board that has what I want and use the schematic from their board. The pushbutton circuit is working fine on the board I built. I am not a professional or any kind of authority on embedded circuits. If in doubt listen to medelec. He is far more knowledgeable than I on this subject.

I liberally use capacitors(.1uf ..'104'/small yellow..most of the time) to create a low pass filters. ( limits circuit noise and/or minimizes contact bounce from the pushbutton for ex.).

I have powered 5 rgb led's without any problems right from my 16f887, 16f877 and 18f4685. I suppose one of the benefits of using PWM and utilizing POV is that it minimizes power consumption. My entire circuit is powered from a modified moto. razr usb cell phone charger rated at aprx. 500mA/5v. You do not need a switching transistor to make this work for 5 rgb led's (=15 regular led's) as far as I can tell.
-------------------------------------------------------------
edit....here are a few pictures showing some the various colors and the board I built....

Re: Look Up Tables using Flowcode and Microsoft Excel

Posted: Fri Feb 11, 2011 5:12 pm
by zen
I decided to activate the free trial of the Hi-Tech C compiler and tried to compile the RGB LED LUT program using it. The BoostC compiler has no problems with the code but the HTC compiler didn't like the program and is returning the following errors:

Warning [374] C:\...\RGB_lut_MAIN.C; 105.5 missing basic type; int assumed
Error [314] C:\...\RGB_lut_MAIN.C; 105.5 ";" expected
Warning [374] C:\...\RGB_lut_MAIN.C; 112.5 missing basic type; int assumed
Error [314] C:\...\RGB_lut_MAIN.C; 112.5 ";" expected
Warning [374] C:\...\RGB_lut_MAIN.C; 119.5 missing basic type; int assumed
Error [314] C:\...\RGB_lut_MAIN.C; 119.5 ";" expected
Error [192] C:\...\RGB_lut_MAIN.C; 479.15 undefined identifier "RED"
Error [981] C:\...\RGB_lut_MAIN.C; 479.33 pointer required
Error [981] C:\...\RGB_lut_MAIN.C; 479.33 pointer required
Error [192] C:\...\RGB_lut_MAIN.C; 480.17 undefined identifier "GREEN"
Error [981] C:\...\RGB_lut_MAIN.C; 480.37 pointer required
Error [981] C:\...\RGB_lut_MAIN.C; 480.37 pointer required
Error [192] C:\...\RGB_lut_MAIN.C; 481.16 undefined identifier "BLUE"
Error [981] C:\...\RGB_lut_MAIN.C; 481.35 pointer required
Error [981] C:\...\RGB_lut_MAIN.C; 481.35 pointer required

Ive tried several different ways to declare the " rom char* RED |BLUE|GREEN {1,2,3,......}; " array and get a different error every time. I'm not sure what must be done differently to make the LUT work for both compilers.

edit--------------------link to htc website on this topic

http://www.htsoft.com/support/faqs.php#faq22


edit #2---------------------------------------------

note: the original code that won't work with HTC used the format: "rom char * red = {1,2,3....}; "

I was able to make this program work by using any one of the following 3 formats:

1. char* red[]= {1,2,3....}; // All of these examples worked the same from what I could tell
2. unsigned char* red[] = {1,2,3....};
3. volatile unsigned char* red[] = {1,2,3....};

char* red[] = {red, array, here,....};

unsigned char* green[] = {green, array, here,....};

volatile unsigned char* blue[] ={blue, array, here,....};

I'm still getting a massive list of warnings saying "illegal conversion of integer to pointer", especially if I compile the code in MPlab instead of FC. I sort of understand the problem but don't either. All I know is that the program is working as usual and compileable with HTC.

Re: Look Up Tables using Flowcode and Microsoft Excel

Posted: Mon Feb 14, 2011 8:08 am
by Steve
This might be a better way:

In BoostC, define constant arrays like this:

Code: Select all

rom char* my_const_array = {1,2,3};
And in HITECH, use this:

Code: Select all

const char my_const_array[] = {1,2,3};
In fact, to make the code work with either compiler without modification, do something like this:

Code: Select all

#ifdef _BOOSTC
  rom char* my_const_array = {1,2,3};
#endif
#ifdef HI_TECH_C
  const char my_const_array[] = {1,2,3};
#endif

Re: Look Up Tables using Flowcode and Microsoft Excel

Posted: Wed Apr 27, 2011 7:24 pm
by JohnCrow
medelec35 wrote:To help you are are two different ways you can convert from byte to integer and vice-versa

IntValue = ByteLow+(ByteHigh << 8)

ByteLow = IntValue & 0xFF
ByteHigh = (IntValue >> 8) & 0xFF


IntValue = ByteLow+(ByteHigh * 256)

ByteHigh = (IntValue/ 256)
ByteLow = IntValue - ByteHigh* 256

Not tried the lower three formulas within Flowcode but have included them so you will know how conversions can be done mathematically
Written a simple flowchart to combine HighByte LowByte values entered on the keypad, using above formula

Re: Look Up Tables using Flowcode and Microsoft Excel

Posted: Wed Apr 27, 2011 7:27 pm
by JohnCrow
medelec35 wrote:To help you are are two different ways you can convert from byte to integer and vice-versa

IntValue = ByteLow+(ByteHigh << 8)

ByteLow = IntValue & 0xFF
ByteHigh = (IntValue >> 8) & 0xFF


IntValue = ByteLow+(ByteHigh * 256)

ByteHigh = (IntValue/ 256)
ByteLow = IntValue - ByteHigh* 256

Not tried the lower three formulas within Flowcode but have included them so you will know how conversions can be done mathematically
Written a simple flowchart to combine HighByte LowByte values entered on the keypad, using above formula

Re: Look Up Tables using Flowcode and Microsoft Excel

Posted: Sat Feb 18, 2012 2:09 pm
by Eissa88
hello there,

I want to use LUT to navigate between some words, can you show me how to do that in flowcode v4 please?

Re: Look Up Tables using Flowcode and Microsoft Excel

Posted: Mon Feb 20, 2012 11:36 am
by Benj
Hello,

Do you mean you need to store string data into a lookup table?

One way to do this is to have two arrays of data one for your string data and the other for the string lengths. Both variables should probably be byte based.

StringData[] = "HelloWorldMyNameIsBen"
IndexData[] = 0,5,10,12,16,18,21

Then when you need to pull out a word you first need to know its index so say you want to pull out word 2 - "World".

First you would look up the second index remembering that the numbering starts from 0.

idx = 1
Index = IndexData[idx] which equals 5

You then pull out the index for the next string so you know where the end of the current string is.

idx = idx + 1
NextIndex = IndexData[idx] which equals 10

You can then create a loop to cycle through each of the bytes in the string.

counter = Index
while (counter < NextIndex )
{
... = StringData[counter]
}

Hope this helps.

Re: Look Up Tables using Flowcode and Microsoft Excel

Posted: Tue May 31, 2016 7:21 pm
by joe nova
http://www.matrixmultimedia.com/softwar ... _Table.zip[/quote]


Hi !

I did not get access to table the link above, someone help me, shows 404 error page not found

Re: Look Up Tables using Flowcode and Microsoft Excel

Posted: Wed Jun 01, 2016 12:25 pm
by Benj
Hello,

Thanks for letting us know, here is the file.
Look_Up_Table.zip
(12.94 KiB) Downloaded 706 times