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.

1x16 LCD code problem

Status
Not open for further replies.

OY2L

Member
I'am trying to modify this code for my 1x16 display but can only get the first 8 characters to light up, i think it must be something in the function set but i cant realy find out, so if someone can take a look at the code and datasheet??
 

Attachments

  • frq.asm
    20.4 KB · Views: 262
  • DEM16102SYH-PY.pdf
    218.7 KB · Views: 532
am on my cell so can't really look into it, but I believe a 16x1 display is basically an 8x2 with the 8s side by side. So to address the 2nd 8 characters you need to issue a second line command
 
To add to what Norlin said, to write to characters 8 to 15 send command 0xc0. The second line (or in your case the right hand side of the display) starts at address 0x40 and the command to set address is 0x80 - combined is 0xc0.

Mike.
 
I have tryid over and over now but still not got the second 8 characters to light up, so i am not shore where i need to add the second line command.
 
OY2L said:
I have tryid over and over now but still not got the second 8 characters to light up, so i am not shore where i need to add the second line command.

hi,
You write the start location of the left handside to the LCD, using the control cmd, [0x00] just before you start writing the data to the LCD, then after the 1st 8 characters, write the righthand start address [0x40], then continure with the data write.

Code:
hallo
write the LCD location 1 here use 
movlw '0x80'
Call OutLcdControl

	movlw	'H'
	movwf	LcdDaten	; LCD data
	call	OutLcdDaten	; LCD data out
	movlw	'a'
	movwf	LcdDaten	; LCD data
	call	OutLcdDaten	; LCD data out
	movlw	'l'
	movwf	LcdDaten	; LCD data
	call	OutLcdDaten	; LCD data out
	movlw	'l'
	movwf	LcdDaten	; LCD data
	call	OutLcdDaten	; LCD data out
	movlw	'o'
	movwf	LcdDaten	; LCD data
	call	OutLcdDaten	; LCD data out

	movlw	' '
	movwf	LcdDaten	;LCD data
	call	OutLcdDaten	;Ud data LCD

	movlw	'O'
	movwf	LcdDaten	; LCD data
	call	OutLcdDaten	; LCD data out
	movlw	'Y'
write the LCD location 1+8  here use 
movlw '0xC0'
Call OutLcdControl
	movwf	LcdDaten	; LCD data
	call	OutLcdDaten	; LCD data out
	movlw	'2'
	movwf	LcdDaten	; LCD data
	call	OutLcdDaten	; LCD data out
	movlw	'L'
	movwf	LcdDaten	; LCD data
	call	OutLcdDaten	; LCD data out



Do you follow.?

EDIT:
LCD display addrees from your datasheet.

EDIT: Corrected addressing with bit7
 
Last edited:
Thanks Eric
Have just try it, but still not working, so i think now i change over to use a 2x16 lcd, i know a 2x16 works with this program, i have try it before. But the program anyway just use the first line of the lcd
 
Eric,

You forgot the command bit, it should be,
Code:
        ;write the LCD location 1+8  here use 
        movlw '0xC0'
        Call OutLcdControl

Mike.
 
Pommie said:
Eric,

You forgot the command bit, it should be,
Code:
        ;write the LCD location 1+8  here use 
        movlw '0xC0'
        Call OutLcdControl

Mike.

Woops! Sorry OY2L :eek:

OY2L they do work I have used then often in the past, unless you have a defective one.?
 
Last edited:
I wonder if you couldn't design a somewhat 'generic' PutLCD routine that could keep track of and increment a Tab variable and automatically issue the position control command when needed? Perhaps using assembler equates for determining 1x16, 2x16, 1x20, 2x20, 4x20, etc., display types?

Mike
 
Mike said:
I wonder if you couldn't design a somewhat 'generic' PutLCD routine that could keep track of and increment a Tab variable and automatically issue the position control command when needed? Perhaps using assembler equates for determining 1x16, 2x16, 1x20, 2x20, 4x20, etc., display types?

Mike

We know you can.:D

Mike.
 
I suspect you could too Mike (Pommie) but who's got time (grin)...

I did just get a couple 2x20 displays and a single 4x20 display recently but not sure when I'll get a chance to 'play'. The new 128x64 GLCD with touchscreen and RGB backlight has higher priority for me right now. I'm going to use an 18F4431 with its multiple PWM outputs as a high performance controller and I only just finished writing and testing a bootloader for that device so it's going slowly.

Take care my friend. Mike
 
Pommie said:
I'm considering changing my name to Bruce.:D

Loved the Bruce sketch! :p

Edit: Thinking on, a line from that seems to fit?

"Just seen a Pommie streaker in the Earl's Court Road"
"Must have looked like a bald wallabie, Bruce!"
 
Wow! I just found my very first LCD display from many years ago. It's a very large 2x16 display without a backlight. It's really physically huge compared to the compact 2x20 and 4x20 backlit units I received recently.

I remember stopping by a new (at the time) local company called Optrex and speaking with one of their engineers and he gave me this particular display as a sample which I then used it in an EPROM/EEPROM programmer project of my own design which used a Motorola 68HC11FN1 controller.

Nigel,

Do I need to change my name too Sir?
 
Now i have change over to a 2x16 lcd and everything works great, so i think my next project must be to learn write to a 1x16 or 2x 1x8 lcd
 
OY2L said:
Now i have change over to a 2x16 lcd and everything works great, so i think my next project must be to learn write to a 1x16 or 2x 1x8 lcd

Are you able to write to both lines of the 2x16, essentially it's just like writing to the second 8 of the 1x16.

Try printing all ASCII characters at it, loop 0 to 127, and print the ASCII value to the display, when you do this the second part of the display should be filled, starting forty charcaters in.

LCD displays are essentially all 2x40, with the second line continuing from the end of the first 40 character line - the display itself is a 'window' on this 2x40 buffer, and you can scroll it along the buffer with commands.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top