[good news] DOG Display's the return

marcos.placona

Senior Member
Hi guys, I guess some of you may remember of my last post on this displays (http://www.picaxeforum.co.uk/showthread.php?t=9494). I'm posting here an update on what I have so far. I got the LCD's back, and it turns out there was nothing wrong with them.

Strangely, I've just tried the same circuit, and now they work :D

Well, in parts. It displays the cursor, but doesn't display any text on screen.

I used part of hippy's code, and made some changes to same variables the LCD needs. It starts fine now, but still doesn't display text.

I've made a video to show you how it stands up to now....

http://www.youtube.com/watch?v=ScAiFPifGVQ

As per my code, it looks like this now:

Code:
;               __
;    Input 2 -o|  |o- Input 1
; Serial Out -o|  |o- Input 0
;  Serial In -o|  |o- Input 7
;      Reset -o|  |o- Input 6
;         0V -o|  |o- +V
;   Output 0 -o|  |o- Output 7
;   Output 1 -o|  |o- Output 6
;   Output 2 -o|  |o- Output 5
;   Output 3 -o|  |o- Output 4
;               --
        SYMBOL  RS        = 0         ; 0 = Command   1 = Data
        SYMBOL  E         = 2         ; 0 = Idle      1 = Active
        SYMBOL  DB4       = 4         ; LCD Data Line 4
        SYMBOL  DB5       = 5         ; LCD Data Line 5
        SYMBOL  DB6       = 6         ; LCD Data Line 6
        SYMBOL  DB7       = 7         ; LCD Data Line 7

        SYMBOL  RSCMDmask = %00000000 ; Select Command register
        SYMBOL  RSDATmask = %00000100 ; Select Data register

        SYMBOL  get       = b11
        SYMBOL  byteo     = b12
        SYMBOL  rsbit     = b13
        
        
        ' Nibble commands - To initialise 4-bit mode

        EEPROM 0,( $33 )    ; set interface
        EEPROM 1,( $32 )    ; set interface

        ' Byte commands - To configure the LCD
        EEPROM 2,( $29 )    ; set lines
        EEPROM 3,( $14 )    ; set bias OSC
        EEPROM 4,( $78 )    ; set contrast
        EEPROM 5,( $00 )    ; set power, icon, contrat
        EEPROM 6,( $6D )    ; set follower
        EEPROM 7,( $0F )    ; set fidplay on/off
        EEPROM 8,( $01 )    ; Clear Screen
        EEPROM 9,( $06 )     ; entry mode set
              
        'Text to display
        EEPROM 10,("Hello")

     'Must pause in order to initialize
     pause 40

    PowerOnReset:
    {
        GOSUB InitialiseLcd

     }
     
    display:
     {
        FOR get = 10 TO 14
          READ 10,byteo
          GOSUB SendDataByte
        NEXT
           
    }
          
     
    InitialiseLcd:
     {
            'Function set
         READ 0,byteo
         GOSUB SendInitCmdByte
         pause 30
         
         'Function set
         READ 1,byteo
         GOSUB SendInitCmdByte
         pause 30
         
         
         'set line
         READ 2,byteo
         GOSUB SendInitCmdByte
         pause 30
         
         'Internal OSC Frequency
         READ 3,byteo
         GOSUB SendInitCmdByte
         pause 30
         
         'Contrast Set
         READ 4,byteo
         GOSUB SendInitCmdByte
         pause 30
         
         
         'Power / contrast control
         READ 5,byteo
         GOSUB SendInitCmdByte
         pause 30
         
         'Follower Control
         READ 6,byteo
         GOSUB SendInitCmdByte
         pause 30
         
         'Display on / off
         READ 7,byteo
         GOSUB SendInitCmdByte
         pause 30
         
         'Clear Display
         READ 8,byteo
         GOSUB SendInitCmdByte
         pause 200
         
         'Function set
         READ 9,byteo
         GOSUB SendInitCmdByte
         pause 30
        
        RETURN
     }        


    SendInitCmdByte:
    {

        PAUSE 50                        ; Delay 50mS
    }

    SendCmdByte:
    {

        rsbit = RSCMDmask               ; Send to Command register
    }

    SendDataByte:
     {
        pins = byteo & %11110000 | rsbit ; Put MSB out first
        PULSOUT E,1                     ; Give a 10uS pulse on E
        pins = byteo * %00010000 | rsbit ; Put LSB out second
        PULSOUT E,1                     ; Give a 10uS pulse on E

        rsbit = RSDATmask               ; Send to Data register next

        RETURN
     }
Any help would be appreciated.

At least no I know it's something on my code :p

UPD: I tried to also put an END after the inside the display function, but this just makes the cursor fade away
 
Last edited:

Dippy

Moderator
Is it just my browser or has a lot of code dropped out of the code window?

Howver, when I do this reply and scroll down the code window scrolls nicely?

Edit: Now I've gone back it works, so forget the above.
 

hippy

Ex-Staff (retired)
I couldn't really tell what was happening in that video on my PC; was that just a block cursor flashing or something else ?

Your link doesn't point to the previous DOG discussion so wasn't able to check the initialisation was correct.

Two things to try - Increase the initial PUASE 40 to PAUSE 5000 and add a PAUSE 100 just before the last RETURN. Also try with the program downloaded, powering off the PICAXE and LCD, leaving for a while, then powering both on.
 

marcos.placona

Senior Member
Hi Hippy, thanks for the answer. I'll try those. The video just shows a block blinking, and that's all :)

I've also just updated the link to the original thread.
 

marcos.placona

Senior Member
Hi Hippy, I've just tried that, but still no text. It's weird, but I feel like I'm getting there. The main problem I can see with my code is that there's nothing to stop it to go to the reset procedure again. I could just try one "END" there, but when I put it, it just display's the cursor for a fraction of a second and then goes blank.
 

hippy

Ex-Staff (retired)
You need an END ( or you could try DO:LOOP ) to stop falling into the InitaliseLcd again or it will keep re-initialising.

There are a number of possibilities why it doesn't work ...

Nothing is being written. Is RS actually connected correctly ? Is it on the right pin ?

Something is being written but to the wrong place so it's not shown ( try setting the CGRAM address ), or the initialisation isn't correct.

It just looks like it's working but isn't, are the data and other pins wired correctly ? Do the unused data pins need tying via R's to 0V or should they be floating ? Is R/W tied to +V or 0V as required ?

Another thing to try is a PAUSE 10 after the first PULSOUT E,1 and you could try increasing the 1. Basically, add delays everywhere so it runs at slow speed to ensure it's not a timing issue.

Do you have a scope ( a logic analyser would be better with six signal lines ) so you can see what is happening on the bus ?

The other thing you can do is play with the initialisation sequence, select no cursor, block cursor, underline cursor, flashing or static. You can also remove various parts of the initialisation such as the Clear Screen; can you get to initialise with blocks and cleared etc. Anything to prove that the initialisation is being received and understood by the display.

Otherwise it's that long haul working through the datasheet and confirming that what you send out is what's required. You can do that by simulating and looking to see what goes out on the data pins, using SERTXD to report what's being written or by slowing everything down and putting LED+R's on the data pins.

Also, Google and see what others do to control the LCD and compare what you're doing to what they do. If "there's no difference" it's then a brain-storming session with yourself to determine why they get a different result to what you do. There will be a reason, you just have to find it. Yes, that is easier said than done.

Finally, we know the circuit is dodgy ( it works now but didn't ) and it could be dodgy again. Maybe strip that down and start again or build another circuit.
 
Last edited:

hippy

Ex-Staff (retired)
PS : Your link is still pointing to your GreaseMonkey script details not anything about previous LCD work. I'd take a look at the datasheet if I didn't have to plough through Forum Search to find it :)

Ok found it ...

http://www.picaxeforum.co.uk/showthread.php?t=9494

Not sure why but your link goes to a different page than that shown as text. Could be my browser.

Anyway ...

What you have by way of initialisation doesn't seem to match what the manual says. The $33/$32 used for HD44780 do something different here and you don't seem to switch back to Instruction Set 1.

Read through the manual, choose the initialisation sequence which most closely matches what you need, reference the command set details and adjust initialisation to what you actually need.

Also check that the LCD is hardware configured for what you're doing, not that it's set for SPI mode or something like that. Particularly note that D0-D3 need to be connected to +V for 4-bit mode.
 
Last edited:

hippy

Ex-Staff (retired)
I knew we'd get there, but didn't expect to see my name in lights. Thanks :)

One thing which would be worthwhile is posting you code and circuit to the Finished Projects section. You don't have to do that immediately, and perhaps best to take your time on getting it into a reasonable shape because you'll be a Reference Design for others ( here, and the web generally ).

It's also worthwhile higlighting the important things to take account of, the things which tripped you up or might get over-looked. I wouldn't have guessed D0-D3 had to be tied to +V for instance.
 
Top