Hi:
I am a newbie to the PICAXE and I'm having a problem trying to get a PICAXE20X2 to drive a 16x2 LCD. I saw a similar recent thread using a PICAXE 18M2 and an 8 bit connection, but I've wired mine up to operate in 4 bit mode. I've tried to code up the simple example from the PICAXE manual (modifying it for my different pin connections) and just get a line of square blocks on the LCD, which appear only on the second line of the LCD.
The data pins B.2-B.5 are connected to DB4-DB7 on the LCD, respectively, B.0 is connected to RS and B.1 is connected to ENABLE. I've attached my code and a photo of the LCD. In the initialization subroutine you'll see what may be a somewhat non-standard approach of shifting the two nibbles two places by multiplying or dividing by 4. This is done to match the result with the pin locations (i.e. so that the digits in each nibble map to the appropriate pins B.2-B.5). Hopefully it won't be too confusing, but I need to stick with this arrangement because once I get this to work, the PICAXE chip is going to pop into another circuit board that is hard wired with that pin usage. I've walked through the simulate function in the PICAXE editor watching the pins go high and low and believe that the proper pins are being activated. But, since the code is not working to correctly drive the LCD it could be a source of the problem.
I have my PICAXE20X2 mounted to an AXE118 board and I've added 8 pin headers to the 16 data pins on the two sides of the PICAXE20x2 to interconnect things. Let me know if you need to see a photo of that or anything else. I've also wired an off board 10Kohm potentiometer to adjust the backlighting for contrast adjustment of the LCD - that seems to work fine.
I'd appreciate any help anyone can provide as I'm totally lost at this point. Thanks!!
I am a newbie to the PICAXE and I'm having a problem trying to get a PICAXE20X2 to drive a 16x2 LCD. I saw a similar recent thread using a PICAXE 18M2 and an 8 bit connection, but I've wired mine up to operate in 4 bit mode. I've tried to code up the simple example from the PICAXE manual (modifying it for my different pin connections) and just get a line of square blocks on the LCD, which appear only on the second line of the LCD.
The data pins B.2-B.5 are connected to DB4-DB7 on the LCD, respectively, B.0 is connected to RS and B.1 is connected to ENABLE. I've attached my code and a photo of the LCD. In the initialization subroutine you'll see what may be a somewhat non-standard approach of shifting the two nibbles two places by multiplying or dividing by 4. This is done to match the result with the pin locations (i.e. so that the digits in each nibble map to the appropriate pins B.2-B.5). Hopefully it won't be too confusing, but I need to stick with this arrangement because once I get this to work, the PICAXE chip is going to pop into another circuit board that is hard wired with that pin usage. I've walked through the simulate function in the PICAXE editor watching the pins go high and low and believe that the proper pins are being activated. But, since the code is not working to correctly drive the LCD it could be a source of the problem.
I have my PICAXE20X2 mounted to an AXE118 board and I've added 8 pin headers to the 16 data pins on the two sides of the PICAXE20x2 to interconnect things. Let me know if you need to see a photo of that or anything else. I've also wired an off board 10Kohm potentiometer to adjust the backlighting for contrast adjustment of the LCD - that seems to work fine.
I'd appreciate any help anyone can provide as I'm totally lost at this point. Thanks!!
Attachments
-
310 KB Views: 17
-
3.6 KB Views: 12