PDA

View Full Version : Lcd



savnik
- 20th July 2006, 10:59
I have this defines in my code:

DEFINE LCD_DREG PORTB 'Selection of the port B
DEFINE LCD_DBIT 0 'Selection one RB0 with RB3
DEFINE LCD_RSREG PORTA 'RS on port A
DEFINE LCD_RSBIT 2 'RS on RA2
DEFINE LCD_EREG PORTA 'E on port A
DEFINE LCD_EBIT 3 'E on RA3
DEFINE LCD_BITS 4 'Mode 4 bits
DEFINE LCD_LINES 2 '2 lines

Which is the difference if add this code:

DEFINE LCD_COMMANDUS 2000 ' Command Delay (uS)
DEFINE LCD_DATAUS 50 ' Data Delay (uS)

paul borgmeier
- 20th July 2006, 15:52
...Which is the difference if add this code:

DEFINE LCD_COMMANDUS 2000 ' Command Delay (uS)
DEFINE LCD_DATAUS 50 ' Data Delay (uS)
Actually, NOTHING - these two lines as written are the default values already defined in the library file.

However, if your display for some reason cannot keep up with PIC's command issuing speed, you can increase the LCD_COMMANDUS term. If your display for some reason cannot keep up with your PIC's data issuing speed, you can increase the LCD_DATAUS term. These two conditions might happen when you run your PIC at "higher" clock rates (e.g., 20MHz) - it depends on your particular display. You also can decrease the values if you run your PIC at "slow" speeds.

So ... if you are running at higher speeds and the LCDOUT appears not to work, you can increase these values until the command works (provided this is the problem as to why it is not working :)).

Paul Borgmeier
Salt Lake City, Utah
USA

savnik
- 20th July 2006, 18:13
Thank you for your answer.
PIC clock is 4 MHZ. Sometimes only when power up the pic the Lcd is not show correct.

mister_e
- 20th July 2006, 21:39
you may need to add a LCD start up delay. Something between 500mSec to 2Sec in worst case.

Be sure that your PIC don't have any Analog stuff on the pins you're using. If so, you must disable it.

That could be the issue

savnik
- 20th July 2006, 22:18
you may need to add a LCD start up delay. Something between 500mSec to 2Sec in worst case.

Be sure that your PIC don't have any Analog stuff on the pins you're using. If so, you must disable it.

That could be the issue
MY code is:

DEFINE LCD_DREG PORTB 'Selection of the port B
DEFINE LCD_DBIT 0 'Selection one RB0 with RB3
DEFINE LCD_RSREG PORTA 'RS on port A
DEFINE LCD_RSBIT 2 'RS on RA2
DEFINE LCD_EREG PORTA 'E on port A
DEFINE LCD_EBIT 3 'E on RA3
DEFINE LCD_BITS 4 'Mode 4 bits
DEFINE LCD_LINES 2 '2 lines

ADDR1=$C2

PAUSE 100

LCDOUT $FE, 1 ' Clear LCD screen
LCDOUT "TUNER VHF - UHF" ' post text during 2 second
LCDOUT $FE,$C0
LCDOUT " LESVOS "
PAUSE 2000



EEPROM 0,[$0,$0]

How to add start up delay for the LCD;

savnik
- 24th July 2006, 12:17
any help ;

Rob
- 24th July 2006, 14:14
How to add start up delay for the LCD;

It REALLY is as simple as what Mister_E said... where you have your "pause 100" command at the moment, change it to "pause 500". This SHOULD allow enought time for the LCD to settle. If this still does not help, change it to "Pause 2000" and try that. If that still does not work, your problem is unlikely to be LCD settle time. Post back if these do not work

Regards

Rob

mister_e
- 24th July 2006, 16:14
also we don't know your PIC model, it can have analog stuff on any port. If they're not disabled .. it will never work.

savnik
- 24th July 2006, 19:55
also we don't know your PIC model, it can have analog stuff on any port. If they're not disabled .. it will never work.
I use pic16f84a and pic16f628a

mister_e
- 24th July 2006, 22:42
on PIC16F628a you'll have to disable the analog comparator
CMCON=7

On both you should make sure the LVP fuse is disabled before programming.

If your Crystal is >4MHZ be sure the OSC fuse is set to HS AND you have the according DEFIN at the top of your code.

Be sure the MCLR pin is tie to somewhere

etc
etc

The blink program idea is still remain so far ;)

savnik
- 25th July 2006, 11:15
i change PAUSE 100 to PAUSE 200 and it's ok.
thank you.