Hi all,
I have the PICDEM 2Plus Demo Board 2006
and i started plaing with it, and now i'm tring to use the LCD dispaly
i only have the LCD inputs but not the commands
were can i find the LCD data sheet ?
Hi all,
I have the PICDEM 2Plus Demo Board 2006
and i started plaing with it, and now i'm tring to use the LCD dispaly
i only have the LCD inputs but not the commands
were can i find the LCD data sheet ?
Thank you
now to the digging part
Do you know any tutarial using the LCD on the PICDEM Board with 16F877A ?
Are you actually using MeLabs PicBasic (or PicBasicPro)?..................................... ...
Disregard earlier statement...didn't realize PicBasic doesn't have an LCDOUT command.
4 options as I see it
1)Dive into the datasheets and figure out the timing of the signals of the LCD modules
2)Search these forums for some premade examples (they're here somewhere)
3)Search the internet for some premade examples (they're out there somewhere)
4)Upgrade to PicBasicPro and be done with it...
Last edited by skimask; - 17th July 2008 at 21:04.
From MeLabs website
http://melabs.com/resources/samples/x1/pbc/lcdx.basCode:' Demonstrate operation of an LCD in 4-bit mode Symbol PORTD = 8 ' PORTD is register 8 Symbol PORTE = 9 ' PORTD is register 9 Symbol TRISD = $88 ' PORTD data direction is register hexadecimal 88 Symbol TRISE = $89 ' PORTD data direction is register hexadecimal 89 Symbol ADCON1 = $9f ' ADCON1 is register hexadecimal 9f Poke ADCON1, 7 ' Set analog pins to digital Poke TRISD, 0 ' Set all PORTD lines to output Poke TRISE, 0 ' Set all PORTE lines to output Poke PORTE, 0 ' Start with enable low Pause 100 ' Wait for LCD to power up Gosub lcdinit ' Initialize the lcd loop: Gosub lcdclr ' Clear lcd screen For B4 = 0 to 4 ' Send string to lcd one letter at a time Lookup B4, ("Hello"), B2 ' Get letter from string Gosub lcddata ' Send letter in B2 to lcd Next B4 Pause 500 ' Wait .5 second Gosub lcdclr ' Clear lcd screen For B4 = 0 to 4 ' Send string to lcd one letter at a time Lookup B4, ("world"), B2 ' Get letter from string Gosub lcddata ' Send letter in B2 to lcd Next B4 Pause 500 ' Wait .5 second Goto loop ' Do it forever ' Subroutine to initialize the lcd - uses B2 and B3 lcdinit: Pause 15 ' Wait at least 15ms Poke PORTD, $33 ' Initialize the lcd Gosub lcdtog ' Toggle the lcd enable line Pause 5 ' Wait at least 4.1ms Poke PORTD, $33 ' Initialize the lcd Gosub lcdtog ' Toggle the lcd enable line Pause 1 ' Wait at least 100us Poke PORTD, $33 ' Initialize the lcd Gosub lcdtog ' Toggle the lcd enable line Pause 1 ' Wait once more for good luck Poke PORTD, $22 ' Put lcd into 4 bit mode Gosub lcdtog ' Toggle the lcd enable line B2 = $28 ' 4 bit mode, 2 lines, 5x7 font Gosub lcdcom ' Send B2 to lcd B2 = $0c ' Lcd display on, no cursor, no blink Gosub lcdcom ' Send B2 to lcd B2 = $06 ' Lcd entry mode set, increment, no shift Goto lcdcom ' Exit through send lcd command ' Subroutine to clear the lcd screen - uses B2 and B3 lcdclr: B2 = 1 ' Set B2 to clear command and fall through to lcdcom ' Subroutine to send a command to the lcd - uses B2 and B3 lcdcom: Poke PORTE, 0 ' Set RS to command lcdcd: B3 = B2 & $f0 ' Isolate top 4 bits Poke PORTD, B3 ' Send upper 4 bits to lcd Gosub lcdtog ' Toggle the lcd enable line B3 = B2 * 16 ' Shift botton 4 bits up to top 4 bits Poke PORTD, B3 ' Send lower 4 bits to lcd Gosub lcdtog ' Toggle the lcd enable line Pause 2 ' Wait 2ms for write to complete Return ' Subroutine to send data to the lcd - uses B2 and B3 lcddata: Poke PORTE, 1 ' Set RS to data Goto lcdcd ' Subroutine to toggle the lcd enable line lcdtog: Peek PORTE, B0 ' Get current PORTE value B0 = B0 | %00000010 ' Set lcd enable line high Poke PORTE, B0 B0 = B0 & %11111101 ' Set lcd enable line low Poke PORTE, B0 Return
If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
.
Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
.
There simply is no "Happy Spam" If you do it you will disappear from this forum.
'***************************** LCD Demo For The PICDEM 2 PLUS Board ********************************
' Device used pic16F877
' port.a1 LCD E enable input
' port.a2 LCD R/W read/write bit
' port.a3 LCD RS register select bit
' port.d0 LCD DB4 data port
' port.d1 LCD DB3 data port
' port.d2 LCD DB2 data port
' port.d3 LCD DB1 data port
'**************************** Hardware Setup ************************************************** ******
trisa = %11110001 ' Set port a I/O
trisb = %11111111 ' Set port b I/O
trisc = %10000000 ' Set port c I/O
trisd = %11110000 ' Set port d I/O
ADCON1 = %10000110 ' Set porta & porte as digital I/O
'*************************** Program Defines ************************************************** ******
DEFINE LCD_DREG PORTD ' Set LCD port
DEFINE LCD_DBIT 0 ' Set starting bit (0 or 4) if 4-bit buss
DEFINE LCD_RSREG PORTA ' Set LCD register select port
DEFINE LCD_RSBIT 3 ' Set LCD register select port bit
DEFINE LCD_EREG PORTA ' Set LCD enable port
DEFINE LCD_EBIT 1 ' Set LCD enable port bit
DEFINE LCD_BITS 4 ' Set LCD bus size 4 0r 8 bits
DEFINE LCD_LINES 2 ' Set number of lines on LCD
DEFINE LCD_COMMANDUS 2000 ' Set command delay time in usec
DEFINE LCD_DATAUS 50 ' Set data delat time in usec
'*************************** Presets ************************************************** **************
low porta.2 ' Set write bit
'**************************** Main Program ************************************************** ********
DisplayOut:
lcdout $FE,1,"It is easy to" ' Clear the LCD display,display first line message
lcdout $FE,$C0,"dislay a message." ' Display second line message
pause 1000
goto DisplayOut
end
Bookmarks