Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Since DB0 to DB3 are not connected, a rewrite is then required. However, since one operation is completed in
two accesses for 4-bit operation, a rewrite is needed to set the functions (see Table 12).
I think Mike thats the software one.....The table i posted is from the hardware pdf that shows how to control the LCD with switches etc. So just as a guess seeing as the little star where I badly drew a red box, says initialization, Maybe there is a hardware and software way, I know you can send hex commands to set bits in the chip inside, but also set them via direct signals to the pins on the outside (did that make sense???).
Which is exactly what I said!! actually its only DB3 and D0 and D1 dosnt matter what they are as denoted by the X, D2 is 7X5 dot mode if held low and 10x whatever if held high.Agree. On reviewing the HD44780 datasheet (assuming that is what the THS has), the data pins are tristate and have weak pull-ups (about 50 uA at 3 V):
View attachment 107089
The datasheet (p. 39) further refers to DB3 : B0 as "not connected:"
I suspect the real reason for the one-line display is that the controller expects the low nibble to be unconnected or high.
Elerion
Since you have both the breadboard and PCB made, perhaps a test with DB3 : B0 tied high with a 20K resistor and see whether it comes up in 1-line or 2-line mode.
John
Whats really neat is unless you read the two articles in the pdf's, the assumption is they are software controlled. When i first used them Pommie gave me some code snippits in swordfish basic, he then went on holiday.Looks like your right ghostie, I didnt know that and I've used these displays for over 20 years.
Everytime I've used them it was 4 bit mode with the unused 4 floating.
But I goto wonder why they made it so everything could be displayed with switches etc??
While you're far too younger to remember it, many early experimenters micro-processor systems were programmed using toggle switches - you set the address bus with a row of toggle switches, you set the data bus with another row, and pressed a 'store' button. This programmed the set address with the set data, you repeated this for the entire program, a byte at a time, incremented the address bus as you went.
Yeah I guess i think in terms of databus etc, things like SPI.Fairly obviously they didn't, ANY similar logic system can be worked with switches - and micro-controller outputs (or logic gates) are simply electronic 'switches'.
The only reason you're really aware of it in this case is that it was commonly done in tutorials to demonstrate the operation of the device, and not for actual use.
While you're far too younger to remember it, many early experimenters micro-processor systems were programmed using toggle switches - you set the address bus with a row of toggle switches, you set the data bus with another row, and pressed a 'store' button. This programmed the set address with the set data, you repeated this for the entire program, a byte at a time, incremented the address bus as you went.
Same here. So looks like the initialization dosnt set things in stone, hence why grounding the lower data pins puts it into 1 line mode. Works other way as well, tying high makes them 2 line even if your code set it 1 line during initialization. Something to watch for when people have trouble with LCD's.LG, can you try adding one more command to the initialization code. Add a new command of 0x3c to see if that sets it to two lines and the right charset.
Edit, I just checked some of my code and I set the LCD to 2 row mode after the initialization shown above.
Mike.
__delay_ms(30); //delay for LCD to initialise.
WriteNibble(0x30); //Required for initialisation
__delay_ms(5); //required delay
WriteNibble(0x30); //Required for initialisation
__delay_ms(1); //required delay
WriteCommand(0x20); //set to 4 bit interface
WriteCommand(0x2c); //set to 4 bit interface, 2 line and 5*10 font
WriteCommand(0x01); //clear display
WriteCommand(0x06); //move cursor right after write
WriteCommand(0x0C); //turn on display
Thats the bit I can confirm, my LCD is on a bread board, I spotted the code mistake as I followed your code closely. If you ground the first 4 pins you normally leave floating in 4 bit mode. Lets call them D0 -D3.Whoops, just had a look at the initialization code for a project that used a 4x20 LCD and I write the command during the init. It should also be 0x2c not 0x3c as I posted above (bad memory).
Here's my init.
Code:__delay_ms(30); //delay for LCD to initialise. WriteNibble(0x30); //Required for initialisation __delay_ms(5); //required delay WriteNibble(0x30); //Required for initialisation __delay_ms(1); //required delay WriteCommand(0x20); //set to 4 bit interface WriteCommand(0x2c); //set to 4 bit interface, 2 line and 5*10 font WriteCommand(0x01); //clear display WriteCommand(0x06); //move cursor right after write WriteCommand(0x0C); //turn on display
I checked the board and I'd left D0-D3 floating so can't confirm if this works with the pins grounded.
Mike.