Page 1 of 1

LCD getting number of columns

Posted: Wed Sep 08, 2010 1:26 pm
by yfands
Hello,

For a neat scrolling effect regarding the LCD, I'am in need of the Columns (and rows) used by the LCD. (16, 20, 40, 80)

So far I tried to use C Code and the variable %s_COLCNT (used by the LCD macro's) to assign to the flowcode variable Xp.

and to create a custom LCD macro getcol (return %s_COLCNT) also trying to assign it to the variable Xp.

even tried replacing the %s by the devicename (After compiling available in the .c file).

In common, how can I access the variable's used by the components?

attached file is a small attempt with no luck.

regards Frank

Re: LCD getting number of columns

Posted: Thu Sep 09, 2010 3:33 pm
by Benj
Hello Frank,

Your function looks good but will only work on the hardware as it is using custom C code. Have you tried it out on the hardware?

Re: LCD getting number of columns

Posted: Sun Sep 12, 2010 8:49 am
by yfands
Hello Ben,

Thanks for your reply, I didn't think it would be usefull to test it on the hardware,
because the simulation didn't work. I will try it today (sunday) and will let you know.

regards Frank,

Re: LCD getting number of columns

Posted: Sun Sep 19, 2010 9:37 pm
by yfands
Hello Ben,

Sorry fot the late reply,
The code doesn't work, and I wanted to try some other options.

The problem lies with the %s_COLCNT, the %s must be substituted by the unique
number that the LCD component gets (by the linker ?)

If I replace the %s by that number in the functioncall in flowcode it works and I get the
columnnumber. unfortunately the number is "random" and can't therefore be used in the flowcode.

The only option I see is to modify the PIC_LCD.c file and add a variable i.e.
define FCV_COLCNT %u
(the %u is substituted into (this time) 16)

I added in the project options menu the sublementary code

unsigned char Get_LCD_Col(void)
{
return FCV_COLCNT;
}

and voila the columncount is available :P

The only downside is what is happening if 2 LCD's are connected!


Everyday I learn more about flowcode :mrgreen:

Thanks for the advice to try the software on the hardware.

reagrds Frank