robertpeach
- 11th September 2009, 13:14
hi ive got a real simple lcd program, just trying to see what it does over long periods of time. however it works for a while, but everynow and then only half the word appears on an update and then after 5 minutes it just gets stuck with the same output. it works at first real smooth just as i want it to. watchdog timer doesnt reset it either...
im using an 18f2431 and this is my simple code:
define OSC 20 'define oscillator at 20mhz
Define LCD_DREG PORTC 'defining portC for the databits
define LCD_DBIT 4 'defining bits 4-7 as the 4 data bits for lcd
define LCD_RSREG PORTC 'defining the RS register to be on PORTC
define LCD_RSBIT 0 'defining bit0 of portC as the RSbit for LCD
Define LCD_EREG PORTC 'defining the LCD enable bit to be on portC
define LCD_EBIT 3 'defining the lcd enable bit on portc to be bit0
define LCD_BITS 4 'set number of lcd data bits, 4 is standard
define LCD_LINES 2 'define the number of lines on LCD, 2 lines is standard
define LCD_COMMANDUS 3000 'set command delay time in microseconds
define LCD_DATAUS 150 'set data delay time in microseconds
pause 1000 'pause for initialization of lcd
main: 'start of program, where the program loops back to
lcdout $FE,1,"hello" 'clears display and shows "hello" on first line
'$FE,1 clears display
'"hello" shows hello on lcd
lcdout $FE,$C0,"world" 'goes to second line of lcd and displays "world"
'$FE,$C0 = move cursor to beginning of second line
'"world" displays world
pause 1000 'pause so not to update lcd too quickly
lcdout $FE,1,"EVANCE" 'clears display and shows "hello" on first line
'$FE,1 clears display
'"hello" shows hello on lcd
lcdout $FE,$C0,"ISKRA" 'goes to second line of lcd and displays "world"
'$FE,$C0 = move cursor to beginning of second line
'"world" displays world
pause 1000
goto main 'end of program and looping back to start of program
end
thanks
im using an 18f2431 and this is my simple code:
define OSC 20 'define oscillator at 20mhz
Define LCD_DREG PORTC 'defining portC for the databits
define LCD_DBIT 4 'defining bits 4-7 as the 4 data bits for lcd
define LCD_RSREG PORTC 'defining the RS register to be on PORTC
define LCD_RSBIT 0 'defining bit0 of portC as the RSbit for LCD
Define LCD_EREG PORTC 'defining the LCD enable bit to be on portC
define LCD_EBIT 3 'defining the lcd enable bit on portc to be bit0
define LCD_BITS 4 'set number of lcd data bits, 4 is standard
define LCD_LINES 2 'define the number of lines on LCD, 2 lines is standard
define LCD_COMMANDUS 3000 'set command delay time in microseconds
define LCD_DATAUS 150 'set data delay time in microseconds
pause 1000 'pause for initialization of lcd
main: 'start of program, where the program loops back to
lcdout $FE,1,"hello" 'clears display and shows "hello" on first line
'$FE,1 clears display
'"hello" shows hello on lcd
lcdout $FE,$C0,"world" 'goes to second line of lcd and displays "world"
'$FE,$C0 = move cursor to beginning of second line
'"world" displays world
pause 1000 'pause so not to update lcd too quickly
lcdout $FE,1,"EVANCE" 'clears display and shows "hello" on first line
'$FE,1 clears display
'"hello" shows hello on lcd
lcdout $FE,$C0,"ISKRA" 'goes to second line of lcd and displays "world"
'$FE,$C0 = move cursor to beginning of second line
'"world" displays world
pause 1000
goto main 'end of program and looping back to start of program
end
thanks