LCD 16x2 and 24x2 newbie issues

Brooklyn187m

New Member
Hello,

I am brand new to microcontrollers and a somewhat novice to electronics in general. I picked up the AXE090 kit with a PICAXE 18X chip. My goal thus far is to interface the 18X with either one of my parallel LCD screens that I picked up on the cheap. Just getting it to work is it, nothing special.

The 16x2 LCD is a Powertip LCD PC1602-F
The 24x2 LCD is a EDT EW24210BFW

I have the LCD connected exactly the way it describes on the boards and other places. Both LCDs use HD44780 compatible controllers and have identical pinouts.

When I upload the code to the picaxe, nothing happens on the powertip. It just displays black boxes. The EDT shows garbage characters and sometimes scrolls them.

I think my problem is that I am not getting the initialization codes right. I am not sure how to modify the code to use either one of my LCDs. I have tried sample code from here and other places. I would appreciate any help offered. Thanks! :)


Here is the code without the main writing loop.



Code:
' **** Constant Definitions ****

symbol            En = 3         ' LCD Enable pin connected to PICAXE output 3 

symbol            RS = 2         ' LCD RegSel pin connected to PICAXE output 2





' **** Variable Definitions **** 


symbol         char = b1         ' character to be sent to LCD

symbol        index = b2         ' used as counter in For-Next loops



' **** Subroutine init **** 

init:  pins = 0                  ' clear all PICAXE output lines

pause 200                        ' pause 200 mS for LCD initialization



pins = 48                        ' instruction: set to 8-bit operation 
pulsout En,1                     ' send data to LCD                    

pulsout En,1                     ' send data (necessary)               



pins = 32                        ' instruction: set to 4-bit operation 

pulsout En,1                     ' send data to LCD

pulsout En,1                     ' send again (necessary in 4-bit mode)



pins = 128                       ' instruction: set to 2 line operation

pulsout En,1                     ' send data to LCD 

char = 14                        ' instruction: screen on, cursor on 

gosub wrins                      ' send instruction to LCD 

char = 1                         ' instruction: clear display, cursor home 

gosub wrins                      ' send instruction to LCD 

char = 12                        ' instruction: hide cursor 

gosub wrins                      ' send instruction to LCD 

return 

  
' **** Subroutine wrchr **** 

wrchr: pins = char & 240         ' place high nibble of char onto pins 

high RS                          ' make sure RS is high 

pulsout En,1                     ' send data to LCD 

pins = char * 16                 ' place low nibble of char onto pins 

high RS                          ' make sure RS is high 

pulsout En,1                     ' send data to LCD 

return 



' **** Subroutine wrins **** 



wrins: pins = char & 240         ' place high nibble of char onto pins 

pulsout En,1                     ' send data to LCD 

pins = char * 16                 ' place low nibble of char onto pins 

pulsout En,1                     ' send data to LCD 

return
 

Brooklyn187m

New Member
Disregard

Well thanks to hippy's code I was able to tweak this thing into working. Thanks for looking though. Appreciate it. :)
 
Top