Code:' LCD should be connected as follows: 12 ' LCD PIC 13 ' DB4 PortA.0 14 ' DB5 PortA.1 15 ' DB6 PortA.2 16 ' DB7 PortA.3 17 ' RS PortA.4 (add 4.7K pullup resistor to 5 volts) 18 ' E PortB.3 19 ' RW Ground 20 ' Vdd 5 volts 21 ' Vss Ground 22 ' Vo 20K potentiometer (or ground) 23 ' DB0-3 No connect
The comments give you a clue as to how to connect the LCD !
You don't have to use "dedicated" pins, but you do need to define what pins you use for the connections
This works with an LCD connected to port B
Code:'******************************************************************************* ' LCD (20 x 4) set up '******************************************************************************* DEFINE LCD_DREG PORTB ' LCD Data port DEFINE LCD_DBIT 0 ' starting Data bit (0 or 4) DEFINE LCD_EREG PORTB ' LCD Enable port DEFINE LCD_EBIT 5 ' Enable bit (on EasyPIC 5 LCD) DEFINE LCD_RSREG PORTB ' LCD Register Select port DEFINE LCD_RSBIT 4 ' Register Select bit (on EasyPIC 5 LCD) DEFINE LCD_BITS 4 ' LCD bus size (4 or 8 bits) DEFINE LCD_LINES 4 ' number of lines on LCD DEFINE LCD_COMMANDUS 2000 ' Command delay time in us DEFINE LCD_DATAUS 50 ' Data delay time in us![]()




Bookmarks