It does not matter, 15 or 16.
It does not matter, 15 or 16.
Dave
Always wear safety glasses while programming.
Finaly managed to find five minutes to connect the back-light up using a 150ohm
resistor, however:
Before connection I had 4 lines of text. Then I connected the back-light which came on a nice blue colour but the text vanished. I then disconnected the back-light,the text didn't reappear, reloaded the program still no text (with or without the back-light on). I then loaded the program into my other 16F684 with the same outcome
Could it be the DATAUS number again?
Or something more worrying.
Dave
Hmmm, from where do you pull the current for the backlight and is that supply rated/capable of supplying the current? Measure the voltage as you turn on the backlight and see if it sags.
Do you have a PAUSE at the beginning of the program to allow the LCD to boot up properly before writing to it? Something like PAUSE 1000 or whatever....
/Henrik.
Hi Henrik
I've measured the voltage, it doesn't blip from 4.6v, even when the back-light is switched off - on.
I added the pause.Still no text showing.
Here's the program:
DaveCode:ANSEL = %00000000 'Disable analog select so ports work as digital i/o. CMCON0 = %00000111 'Disable analog comparators. TRISA = %00000000 'Set PORTA as OUTPUT. PORTA = %00000000 'Set PORTA pins all low. TRISC = %00000000 'Set PORTC as OUTPUT. PORTC = %00000000 'Set PORTC pins all low. DEFINE LCD_DREG PORTC 'PORTC.0 WILL CONNECT TO DB4, PORTC3 TO DB7 DEFINE LCD_DBIT 0 DEFINE LCD_RSREG PORTC DEFINE LCD_RSBIT 4 'PORTC.4 CONNECT TO LCD PIN4 DEFINE LCD_EREG PORTC DEFINE LCD_EBIT 5 'PORTC.5 CONNECT TO LCD PIN6 DEFINE LCD_BITS 4 DEFINE LCD_LINES 4 DEFINE LCD_COMMANDUS 2000 DEFINE LCD_DATAUS 75 DEFINE OSC 4 MAIN: PAUSE 1500 LCDOUT $FE,1,"*Hello WORLD*!" LCDOUT $FE,$C0,"I't WORKS!" LCDOUT $FE,$94,"I't WORKS!" LCDOUT $FE,$d4,"Oh dear it stopped!" GOTO MAIN
Last edited by LEDave; - 22nd April 2010 at 18:29.
Hi Dave,
Try adding a LED to an unused pin and blink it a few times at start-up. Just to verify that the PIC is still actually executing code. Are you using an extarnal crystal or are you running on the internal oscillator?
If it appears to not executing code and you're using an external source for the osciallator then check and double check that.
/Henrik.
Hi Henrik,
Will do.Try adding a LED to an unused pin and blink it a few times at start-up. Just to verify that the PIC is still actually executing code.
Internal oscillator.Are you using an extarnal crystal or are you running on the internal oscillator?
It does seem strange that the PIC wrote the test lines to the LCD then stopped when the back-light was fired up. It would be nice if it were something not too serious.
Dave
Hi Henrik,
I've added the LED and pause to the program and no (unless I've made another mistake) the LED doesn't blink,so program not / stopped running? Program doesn't 'run' with the back-light turned off either.
Here's the code:
DaveANSEL = %00000000 'Disable analog select so ports work as digital i/o.
CMCON0 = %00000111 'Disable analog comparators.
TRISA = %00000000 'Set PORTA as OUTPUT.
PORTA = %00000000 'Set PORTA pins all low.
TRISC = %00000000 'Set PORTC as OUTPUT.
PORTC = %00000000 'Set PORTC pins all low.
DEFINE LCD_DREG PORTC 'PORTC.0 WILL CONNECT TO DB4, PORTC3 TO DB7
DEFINE LCD_DBIT 0
DEFINE LCD_RSREG PORTC
DEFINE LCD_RSBIT 4 'PORTC.4 CONNECT TO LCD PIN4
DEFINE LCD_EREG PORTC
DEFINE LCD_EBIT 5 'PORTC.5 CONNECT TO LCD PIN6
DEFINE LCD_BITS 4
DEFINE LCD_LINES 4
DEFINE LCD_COMMANDUS 2000
DEFINE LCD_DATAUS 75
DEFINE OSC 4
MAIN:
PAUSE 500
HIGH PORTA.5
PAUSE 500
LOW PORTA.5
PAUSE 500
HIGH PORTA.5
PAUSE 500
LOW PORTA.5
PAUSE 1500
LCDOUT $FE,1,"*Hello WORLD*!"
LCDOUT $FE,$C0,"I't WORKS!"
LCDOUT $FE,$94,"I't WORKS!"
LCDOUT $FE,$d4,"Oh dear it stopped!"
PAUSE 500
HIGH PORTA.5
PAUSE 500
LOW PORTA.5
PAUSE 500
HIGH PORTA.5
PAUSE 500
LOW PORTA.5
PAUSE 50
GOTO MAIN
Last edited by LEDave; - 22nd April 2010 at 19:52.
Bookmarks