Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Write data to LCD

Status
Not open for further replies.
Thanks for the response I"ll use the link and the AND/OR way.

Ive got the LCD initialized in 4 bit mode . I first send the high nibble and then the low nibble , but when I look at my display I get other characters :s. I send a S and I get a J , I send a +- and I get a 2.

Someone maybe know why this happened?

View attachment LCD4BIT.asm
 
You're doing something wrong - compare the bit patterns of the characters and see what's happening - you will probably find one bit is always high or low, or two bits are shorted together.
 
Thanks for the response I"ll use the link and the AND/OR way.

Ive got the LCD initialized in 4 bit mode . I first send the high nibble and then the low nibble , but when I look at my display I get other characters :s. I send a S and I get a J , I send a +- and I get a 2.

Someone maybe know why this happened?

View attachment 45592

hi,
If I am reading your write LCD correctly, you are not writing data nibbles to the LCD.?? but a 8 bit byte.??
[CODE
writeLCD
movwf ctemp
bsf EN ; EN high
call endelay
movf ctemp,w
movwf PORTC
bcf EN ; EN low
call endelay
return

][/CODE]
 
You're right , I"m now just trying to write correct (BYTE ) data to the LCD and then I"ll do the trick with and/or( nibble) .
DB7-DB4 = RC3-RC0 and the other DB3-DB0 are not connected. Still I get wrong data on the display .

I think I configured it right with the data sheet you had yesterday.
 
You're right , I"m now just trying to write correct (BYTE ) data to the LCD and then I"ll do the trick with and/or( nibble) .
DB7-DB4 = RC3-RC0 and the other DB3-DB0 are not connected. Still I get wrong data on the display .

I think I configured it right with the data sheet you had yesterday.

To write the two data nibbles to the display,this is a an example from another program. Its not written to suit your pin designations, its an example
Look at this Tutorial by Nigel.



Code:
; 
Lcdout Routine
LC01:    MOVWF R4L
    BSF 0x05,4
    BCF 0x05,6
    SWAPF R4L,F
    MOVLW 0xF0
    ANDWF 0x05,F
    MOVF R4L,W
    ANDLW 0x0F
    IORWF 0x05,F
    CALL LCX1
    SWAPF R4L,F
    MOVLW 0xF0
    ANDWF 0x05,F
    MOVF R4L,W
    ANDLW 0x0F
    IORWF 0x05,F
    CALL LCX1
    MOVLW 0x64
    MOVWF R4L
    CALL X001
    RETURN
LCX1:    BSF 0x05,7
    NOP
    BCF 0x05,7
    NOP
    RETURN

; Lcdcmdout Routine
LC02:    MOVWF R4L
    BCF 0x05,4
    BCF 0x05,6
    SWAPF R4L,F
    MOVLW 0xF0
    ANDWF 0x05,F
    MOVF R4L,W
    ANDLW 0x0F
    IORWF 0x05,F
    CALL LCX1
    SWAPF R4L,F
    MOVLW 0xF0
    ANDWF 0x05,F
    MOVF R4L,W
    ANDLW 0x0F
    IORWF 0x05,F
    CALL LCX1
    MOVLW 0x88
    MOVWF R4L
    MOVLW 0x13
    MOVWF R4H
    CALL Y001
    RETURN
; End of listin
 
Last edited:
Hello,


Thanks for the advice and a good link "http://www.winpicprog.co.uk" , I see you use a lower and higher nibble thanks.

I'm still trying to find the problem why my display isnt displaying the correct data.
 
Hello,


Thanks for the advice and a good link "http://www.winpicprog.co.uk" , I see you use a lower and higher nibble thanks.

I'm still trying to find the problem why my display isnt displaying the correct data.

Like I said above, check the bit patterns, write them down above each other in binary.
 
I've told you twice what to check, but you don't seem to have bothered?.

Here are the binary values of the two letters you mentioned, from which it's immediately obvious that the right hand bit of each nibble is coming out as zero, when it's supposed to be one. Find out why that is!!!

S = 0101 0011
J = 0100 1010

But why try and reinvent the wheel?, my tutorial LCD code is tried and tested 4 bit code, in use by many people all over the world.
 
I've told you twice what to check, but you don't seem to have bothered?.
But why try and reinvent the wheel?, my tutorial LCD code is tried and tested 4 bit code, in use by many people all over the world.

Hello , I'm trying to enlarge my knowledge about ASM. I try to make my own program because my LCD is NOT the Hitachi HD44780 ,, I have the ( ST7066U)

I'm converting you program () into my LCD standards !


EDIT2 : tried that again no succes ffs
 
Last edited:
hi S,
Do you have a 16F series PIC that could be used to drive the LCD in order to debug/prove the LCD's operation.??
If yes, and you want to run a test program I will post a simple program for debugging.

What clock freq are you using.?
also I assume that you are driving the PIC and LCD with the same voltage.

Look at this pdf for the 7066 its got a more details.

If you cannot open the pdf please contact Electromaster.
 

Attachments

  • GS-CB16277BNWJ.pdf
    2.4 MB · Views: 275
Hello , I'm trying to enlarge my knowledge about ASM. I try to make my own program because my LCD is NOT the Hitachi HD44780 ,, I have the ( ST7066U)

Which is compatible with the HD44780, as almost all text LCD's are.

I'm converting you program () into my LCD standards !

Do it the other way, convert your hardware to match the code - my connections were specifically chosen to make the code easy whilst only using a single port.

If you want 18F code, heres a tutorial converted to 18F.
 

Attachments

  • tut3_2.asm
    10.6 KB · Views: 126
Last edited:
hi S,
Do you have a 16F series PIC that could be used to drive the LCD in order to debug/prove the LCD's operation.??
If yes, and you want to run a test program I will post a simple program for debugging.

What clock freq are you using.?
also I assume that you are driving the PIC and LCD with the same voltage.

Look at this pdf for the 7066 its got a more details.

If you cannot open the pdf please contact Electromaster.

Thanks for the PDF , thats the 3rd PDF I have about my LCD :D.

Well I don't have a PIC16F , nether a board to program it . My LCD is fed from the same supply as my PIC. I"ve compared the ST7066 and ST7066U Data sheet.

ST7066U.jpg
View attachment ASM 4 bit.txt

I initialized my LCD by following the LEFT PDF , when I programmed the LCD I get weird marks on the display even after the command clear display. Then i tried to swap that NF ( like RIGHT ) the and I got the same , but now I have a cursor at the start and still those weird characters on my display.

Remark that I don't use the upper nibble of PORTC .

I think I'll try the suggestion that Nigel said.

Thanks !
 
hi,
Why not copy/paste Nigels LCD 4bit LCD program section into new assembler window and add the 18F14 header and PIC set up SFR's to the window.
Rewire the LCD to suit his program.
I think the problem is at the moment you have too many unknowns in the project, it would be wise to take a step back and get a known LCD program working, at least then you can be confident that the LCD hardware works.
All the data I have read states that the ST is compatible with the HD, LCD, except for some additional character memory.
 
Did you find why it was originally sending zero instead of one for the right hand bit?, if you have a hardware problem that could be preventing it initialising.

Presumably you have a contrast pot, and are adjusting it correctly? - incorrect setting of that will produce solid bars.

If you've got two black bars that's the most likely cause, not initialising usually gives just a single bar.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top