Charles Jenkinson
New Member
Dear all,
This is my first post to picaxeforum, though I have read many pages prior to this.
Please let me start by saying that I feel I have exhausted the official handbook, Google, this forum, my close circle of friends, and even my pet parakeet about this issue I'm having with parallel interface of the LCD screen.
I have seen Hippy's code mentioned many times, yet all the links to his work seem to result in 404 errors.
Having tried perhaps 4 or 5 methods, involving different code, I am still stuck. I have tried on the AXE022 protoboard with the same results, so tried on a breadboard with no further luck.
I own an AXE033 which I'm sending back to the seller, since it will not correctly initialise ANY of the screens I have tried (ie: I don't think my LCD is broken) - however for knowledge/education/experience, I would like to create a parallel interface. Not particularly keen on going down the line of the easiest way to interface picaxe with an LCD - I'm just unsure why parallel isn't working.
I am using both the LCD screen from AXE033 and one purchased from Altronics (Z7011) with exactly the same results (although I need to increase contrast by more on the screen included with the AXE033 to see the solid blocks). Both are 16x2 displays, with similar specifications (apart from backlight).
My picaxe is on a breadboard with the minimum circuitry as per the handbook. I have then wired the following pins from the picaxe to the LCD:
23 (B.2) to 4
24 (B.3) to 6
25 (B.4) to 11
26 (B.5) to 12
27 (B.6) to 13
28 (B.7) to 14
I have tried this with and without 330 ohm resistors as per the guidebook.
A 10K potentiometer is plugged into pin 3 on the LCD.
All other pins on the LCD (ie: 5, 7, 8-10) are connected to 0V, however I have tried with these pins floating as well.
For troubleshooting, I have wired LED + 330 ohm resistors in parallel with each of the 6 pins, and included suitable pauses in the programming.
Despite this, no LEDs light up, and the LCD screen maintains its solid array of blocks on the top line, which other threads have said is a sign that it is not initialising correctly.
My code is as follows:
(From http://galia.fc.uaslp.mx/~cantocar/microcontroladores/PICAXE/PICAXE_LCD_INTERFACING.HTM)
<code>
SYMBOL RS = B.2 ; 0 = Command 1 = Data
SYMBOL E = B.3 ; 0 = Idle 1 = Active
SYMBOL DB4 = B.4 ; LCD Data Line 4
SYMBOL DB5 = B.5 ; LCD Data Line 5
SYMBOL DB6 = B.6 ; LCD Data Line 6
SYMBOL DB7 = B.7 ; LCD Data Line 7
SYMBOL RSCMDmask = %00000000 ; Select Command register
SYMBOL RSDATmask = %00000100 ; Select Data register
SYMBOL get = b11
SYMBOL byte = b12
SYMBOL rsbit = b13
' Nibble commands - To initialise 4-bit mode
EEPROM 0,( $33 ) ; %0011---- %0011---- 8-bit / 8-bit
EEPROM 1,( $32 ) ; %0011---- %0010---- 8-bit / 4-bit
' Byte commands - To configure the LCD
EEPROM 2,( $28 ) ; %00101000 %001LNF00 Display Format
EEPROM 3,( $0C ) ; %00001100 %00001DCB Display On
EEPROM 4,( $06 ) ; %00000110 %000001IS Cursor Move
; L : 0 = 4-bit Mode 1 = 8-bit Mode
; N : 0 = 1 Line 1 = 2 Lines
; F : 0 = 5x7 Pixels 1 = N/A
; D : 0 = Display Off 1 = Display On
; C : 0 = Cursor Off 1 = Cursor On
; B : 0 = Cursor Steady 1 = Cursor Flash
; I : 0 = Dec Cursor 1 = Inc Cursor
; S : 0 = Cursor Move 1 = Display Shift
EEPROM 5,( $01 ) ; Clear Screen
PowerOnReset:
GOSUB InitialiseLcd
DisplayTopLine:
EEPROM 6,("Hello")
FOR get = 6 TO 10
READ get,byte
GOSUB SendDataByte
Pause 1500
NEXT get
MoveCursorToStartOfSecondLine:
byte = $C0
GOSUB SendCmdByte
DisplayBottomLine:
EEPROM 11,("World!")
FOR get = 11 TO 16
READ get,byte
GOSUB SendDataByte
Pause 1500
NEXT get
END
InitialiseLcd:
FOR get = 0 TO 5
READ get,byte
GOSUB SendInitCmdByte
Pause 1000
NEXT get
' Nibble commands - To initialise 4-bit mode
EEPROM 0,( $33 ) ; %0011---- %0011---- 8-bit / 8-bit
EEPROM 1,( $32 ) ; %0011---- %0010---- 8-bit / 4-bit
' Byte commands - To configure the LCD
EEPROM 2,( $28 ) ; %00101000 %001LNF00 Display Format
EEPROM 3,( $0C ) ; %00001100 %00001DCB Display On
EEPROM 4,( $06 ) ; %00000110 %000001IS Cursor Move
; L : 0 = 4-bit Mode 1 = 8-bit Mode
; N : 0 = 1 Line 1 = 2 Lines
; F : 0 = 5x7 Pixels 1 = N/A
; D : 0 = Display Off 1 = Display On
; C : 0 = Cursor Off 1 = Cursor On
; B : 0 = Cursor Steady 1 = Cursor Flash
; I : 0 = Dec Cursor 1 = Inc Cursor
; S : 0 = Cursor Move 1 = Display Shift
EEPROM 5,( $01 ) ; Clear Screen
RETURN
SendInitCmdByte:
PAUSE 1500 ; Delay 1.5sec
SendCmdByte:
rsbit = RSCMDmask ; Send to Command register
SendDataByte:
pinsB = byte & %11110000 | rsbit ; Put MSB out first
PULSOUT E,1000 ; Give a pulse on E
pause 1000
pinsB = byte * %00010000 | rsbit ; Put LSB out second
PULSOUT E,1000 ; Give a pulse on E
pause 1000
rsbit = RSDATmask ; Send to Data register next
RETURN
</code>
I have attached a photograph of my breadboard below.
Loading a program that individually flashes LEDs works fine, and there doesn't seem to be a problem downloading the code.
Many thanks for your ideas and help.
Charles
This is my first post to picaxeforum, though I have read many pages prior to this.
Please let me start by saying that I feel I have exhausted the official handbook, Google, this forum, my close circle of friends, and even my pet parakeet about this issue I'm having with parallel interface of the LCD screen.
I have seen Hippy's code mentioned many times, yet all the links to his work seem to result in 404 errors.
Having tried perhaps 4 or 5 methods, involving different code, I am still stuck. I have tried on the AXE022 protoboard with the same results, so tried on a breadboard with no further luck.
I own an AXE033 which I'm sending back to the seller, since it will not correctly initialise ANY of the screens I have tried (ie: I don't think my LCD is broken) - however for knowledge/education/experience, I would like to create a parallel interface. Not particularly keen on going down the line of the easiest way to interface picaxe with an LCD - I'm just unsure why parallel isn't working.
I am using both the LCD screen from AXE033 and one purchased from Altronics (Z7011) with exactly the same results (although I need to increase contrast by more on the screen included with the AXE033 to see the solid blocks). Both are 16x2 displays, with similar specifications (apart from backlight).
My picaxe is on a breadboard with the minimum circuitry as per the handbook. I have then wired the following pins from the picaxe to the LCD:
23 (B.2) to 4
24 (B.3) to 6
25 (B.4) to 11
26 (B.5) to 12
27 (B.6) to 13
28 (B.7) to 14
I have tried this with and without 330 ohm resistors as per the guidebook.
A 10K potentiometer is plugged into pin 3 on the LCD.
All other pins on the LCD (ie: 5, 7, 8-10) are connected to 0V, however I have tried with these pins floating as well.
For troubleshooting, I have wired LED + 330 ohm resistors in parallel with each of the 6 pins, and included suitable pauses in the programming.
Despite this, no LEDs light up, and the LCD screen maintains its solid array of blocks on the top line, which other threads have said is a sign that it is not initialising correctly.
My code is as follows:
(From http://galia.fc.uaslp.mx/~cantocar/microcontroladores/PICAXE/PICAXE_LCD_INTERFACING.HTM)
<code>
SYMBOL RS = B.2 ; 0 = Command 1 = Data
SYMBOL E = B.3 ; 0 = Idle 1 = Active
SYMBOL DB4 = B.4 ; LCD Data Line 4
SYMBOL DB5 = B.5 ; LCD Data Line 5
SYMBOL DB6 = B.6 ; LCD Data Line 6
SYMBOL DB7 = B.7 ; LCD Data Line 7
SYMBOL RSCMDmask = %00000000 ; Select Command register
SYMBOL RSDATmask = %00000100 ; Select Data register
SYMBOL get = b11
SYMBOL byte = b12
SYMBOL rsbit = b13
' Nibble commands - To initialise 4-bit mode
EEPROM 0,( $33 ) ; %0011---- %0011---- 8-bit / 8-bit
EEPROM 1,( $32 ) ; %0011---- %0010---- 8-bit / 4-bit
' Byte commands - To configure the LCD
EEPROM 2,( $28 ) ; %00101000 %001LNF00 Display Format
EEPROM 3,( $0C ) ; %00001100 %00001DCB Display On
EEPROM 4,( $06 ) ; %00000110 %000001IS Cursor Move
; L : 0 = 4-bit Mode 1 = 8-bit Mode
; N : 0 = 1 Line 1 = 2 Lines
; F : 0 = 5x7 Pixels 1 = N/A
; D : 0 = Display Off 1 = Display On
; C : 0 = Cursor Off 1 = Cursor On
; B : 0 = Cursor Steady 1 = Cursor Flash
; I : 0 = Dec Cursor 1 = Inc Cursor
; S : 0 = Cursor Move 1 = Display Shift
EEPROM 5,( $01 ) ; Clear Screen
PowerOnReset:
GOSUB InitialiseLcd
DisplayTopLine:
EEPROM 6,("Hello")
FOR get = 6 TO 10
READ get,byte
GOSUB SendDataByte
Pause 1500
NEXT get
MoveCursorToStartOfSecondLine:
byte = $C0
GOSUB SendCmdByte
DisplayBottomLine:
EEPROM 11,("World!")
FOR get = 11 TO 16
READ get,byte
GOSUB SendDataByte
Pause 1500
NEXT get
END
InitialiseLcd:
FOR get = 0 TO 5
READ get,byte
GOSUB SendInitCmdByte
Pause 1000
NEXT get
' Nibble commands - To initialise 4-bit mode
EEPROM 0,( $33 ) ; %0011---- %0011---- 8-bit / 8-bit
EEPROM 1,( $32 ) ; %0011---- %0010---- 8-bit / 4-bit
' Byte commands - To configure the LCD
EEPROM 2,( $28 ) ; %00101000 %001LNF00 Display Format
EEPROM 3,( $0C ) ; %00001100 %00001DCB Display On
EEPROM 4,( $06 ) ; %00000110 %000001IS Cursor Move
; L : 0 = 4-bit Mode 1 = 8-bit Mode
; N : 0 = 1 Line 1 = 2 Lines
; F : 0 = 5x7 Pixels 1 = N/A
; D : 0 = Display Off 1 = Display On
; C : 0 = Cursor Off 1 = Cursor On
; B : 0 = Cursor Steady 1 = Cursor Flash
; I : 0 = Dec Cursor 1 = Inc Cursor
; S : 0 = Cursor Move 1 = Display Shift
EEPROM 5,( $01 ) ; Clear Screen
RETURN
SendInitCmdByte:
PAUSE 1500 ; Delay 1.5sec
SendCmdByte:
rsbit = RSCMDmask ; Send to Command register
SendDataByte:
pinsB = byte & %11110000 | rsbit ; Put MSB out first
PULSOUT E,1000 ; Give a pulse on E
pause 1000
pinsB = byte * %00010000 | rsbit ; Put LSB out second
PULSOUT E,1000 ; Give a pulse on E
pause 1000
rsbit = RSDATmask ; Send to Data register next
RETURN
</code>
I have attached a photograph of my breadboard below.
Loading a program that individually flashes LEDs works fine, and there doesn't seem to be a problem downloading the code.
Many thanks for your ideas and help.
Charles
Attachments
-
500.8 KB Views: 66