View previous topic :: View next topic |
Author |
Message |
rfjhh
Joined: 31 Mar 2011 Posts: 51 Location: Mexico
|
LCD programing |
Posted: Tue Jan 24, 2017 8:07 am |
|
|
Why in the LCD.c file, if I want to write (lcd_putc), a read routine is performed before the writing routine?
What is being checked before the execution of data writing? There is some documentation about it??? |
|
|
newguy
Joined: 24 Jun 2004 Posts: 1907
|
|
Posted: Tue Jan 24, 2017 8:42 am |
|
|
Before you attempt to access the LCD you first need to "ask" it if it is busy; it will hold its data bit 7 high if it is busy. All the driver is doing is checking this busy flag and waiting until it clears, if it is set, before proceeding.
You can omit the read if you respect the delays that you'll need to give the LCD between accesses in order to allow it to complete one task before giving it another. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Jan 24, 2017 10:59 am |
|
|
The flex lcd driver in the code library forum has the option of not using
the R/W line and therefore it doesn't poll the busy bit. It uses delays
as newguy said. |
|
|
rfjhh
Joined: 31 Mar 2011 Posts: 51 Location: Mexico
|
|
Posted: Wed Feb 01, 2017 9:35 am |
|
|
Thanks.
Another question: What's lcdlat, where is it??? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9221 Location: Greensville,Ontario
|
|
Posted: Wed Feb 01, 2017 10:06 am |
|
|
lcdlat could refer to the 'latch' or output port of a PIC. Newer PICs have them.
My version of LCD.C and FlexLCD.c do not have 'lcdlat' though.
Jay |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Feb 01, 2017 10:07 am |
|
|
Come on Jay, the search engine shows it to be in the Code Library.
It's a #byte statement for the LCD's data port. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9221 Location: Greensville,Ontario
|
|
Posted: Wed Feb 01, 2017 11:29 am |
|
|
hmm.. I just checked again and neither my copies of lcd.c and flex_lcd.c have 'lcdlat' in them, according to edit>find......
now I'm thinking I may have old versions and they've been 'updated' over the past few years ?
Jay |
|
|
rfjhh
Joined: 31 Mar 2011 Posts: 51 Location: Mexico
|
|
Posted: Wed Feb 01, 2017 2:02 pm |
|
|
Guys
I've find where, in LCD.c, the lcdlat definition is made:
#if defined(__PCB__)
LCD_PIN_MAP lcd, lcdlat;
#byte lcd = LCD_DATA_PORT
#byte lcdlat = LCD_DATA_PORT
#elif defined(__PCM__)
LCD_PIN_MAP lcd, lcdlat, lcdtris;
#byte lcd = LCD_DATA_PORT
#byte lcdlat = LCD_DATA_PORT
#byte lcdtris = LCD_DATA_PORT+0x80
#elif defined(__PCH__)
LCD_PIN_MAP lcd, lcdlat, lcdtris;
#byte lcd = LCD_DATA_PORT
#byte lcdlat = LCD_DATA_PORT+9
#byte lcdtris = LCD_DATA_PORT+0x12
#elif defined(__PCD__)
LCD_PIN_MAP lcd, lcdlat, lcdtris;
#word lcd = LCD_DATA_PORT
#word lcdlat = LCD_DATA_PORT+2
#word lcdtris = LCD_DATA_PORT-0x02
#endif
#endif //LCD_DATA4 not defined
Thanks |
|
|
|