|
A lot of that jibes with what the schematic suggested. I think you're right about V0 for example.
The short answer is no, I don't know what I'm doing. I used to build simple circuits when I was little. After that I took up programming. I've never taken classes or read books about this.
Eventually I got this Arduino and here I am. So I'm learning.
*steps off your lawn*
Real programmers use butterflies
|
|
|
|
|
Ok, let's try it a different way, then.
I assume you use a small breadboard to wire everything up. Ignore the wiring guide for the breadboard. Use a schematic instead, like this one[^]. I hope this is the right one, please check that.
First you should understand howw to use a breadboard[^]. It's not really hard to understand, but you do not want to produce shorts or unwanted connections.
First you hook up the voltages. VSS or GND are ground, VCC, VDD or +5V are typically supply voltages. V0 is a special voltage that is provided by the display. It's an output, not an input, so you do not have to worry about it right now. You must be very careful with voltages. You can really fry your hardware when they are reversed. Double and triple check everything before ever switching it on.
Now you can take care of the backlight. Here you can do less harm, but you have the additional complication of having to use external potis and resistors. Just follow the schematic and check your wiring then it will be ok. The A and K signals might also be labled as LED+ and LED-.
RW is simply tied to ground (aka VSS). That means you can only write to the display and not read anything. That's good, because this way the display will never use D0 - D7 as outputs and a collision with the Arduino's I/O pins is impossible.
The Arduino does not have the old 6800 bus signals. It's a microcontroller that has to emulate these signals on its general I/O pins. Let's assume for now that the little software library you have does this correctly. On the hardware side it's relatively simple. You must hook up the right Arduino signal to the right signal of the display, as shown in the schematic. On the Arduino side you will have signals named D0 - D(whatever). These are the general I/O pins. They have nothing to do directly with D0 - D7 on the display. Don't confuse them. They are different signals that just happen to use similar naming conventions. Just follow the schematic and the labels on the connectors. Do not go by pin numbers, because they may not be as standardized as we would like them to be. Once you have wired up the display's RS, E and D0 - D7 signals to the right Arduino signals you are almost done.
Last thing to do: Check everything. This is debugging. Question everything, rethink everything and make sure that everything as it should be. Assume nothing. Just like debugging software.
Good luck.
I have lived with several Zen masters - all of them were cats.
His last invention was an evil Lasagna. It didn't kill anyone, and it actually tasted pretty good.
modified 2-Oct-20 20:23pm.
|
|
|
|
|
Thank you! This is even more than enough information for me to tinker with. I greatly appreciate it.
Real programmers use butterflies
|
|
|
|
|
I don't want to spoil your fun, but this is not playing with Lego and it will never be. It's programming and you know how far cut and paste solutions will get you. The real trophy here is not getting that display to work. It's learning why it does not work right now and learning from it. You should know how addictive that can get once you get a taste of accomplishment. Just ask Tom Hanks[^].
I have lived with several Zen masters - all of them were cats.
His last invention was an evil Lasagna. It didn't kill anyone, and it actually tasted pretty good.
|
|
|
|
|
I'm not doing cut and paste solutions. I'm learning. There's a difference. Understand the difference.
Edit: I'm not done. If I wanted a copy and paste solution I would have asked someone for that. I never did. I asked about a way to test a device i suspected i broke (or came broke) for signs of life. If anything I'm debugging.
I did not ask you to develop a monitor for my father in law's pump house. If I had wanted a cut and paste solution I would have asked for that.
Instead, you didn't even know what I was building.
I don't know where you got that, and frankly, it was offensive. I am working with a kit that came with no instructions, no labels, and in an area where I haven't had any practice since 1986 when i was a small child.
I've already build several working widgets with this. I just wanted to know a way to figure out if I broke the LCD or not. That's all I was asking for.
Sincerely, thank you for you help with that. But you can keep your most recent comment.
Real programmers use butterflies
modified 3-Oct-20 8:01am.
|
|
|
|
|
I don't now what specific device you're talking about, as you only specified "16 pin"; some identification could have been useful, or even a link to the thing you bought.
However, most low-end LCD displays include a control chip that is either a Hitachi HD44780 or some derivative thereof. It has been launched over 30 years ago, it got its own Wiki page here[^] and you can find its complete datasheet everywhere[^].
I used it a couple of times, but that was long ago (using 8-bit microcontroller and assembly code); I can't remember but I would expect the backlight to be working as soon as you apply 5V to the appropriate pins with a double caveat:
My best guess is you already killed the backlight, either by applying a reverse voltage, or by not including a series resistor; some if not all such LCD displays need a resistor in pin 15, and yes there are Youtube-quality instructions that don't show that. But this one does.[^]
Anyway the best way to test is by properly connecting everything up, and sending the appropriate commands and data. A library is not essential, you could perform each of the steps required using simple instructions, even when the backlight isn't working (use incident light at an angle of some 45 degrees). It is all a matter of sending some bytes to some addresses (which is true for all software of course).
Using the Arduino "LiquidCrystal" library can make it a little easier: Example (warning: the essential resistor is lacking here!)[^].
PS: You can't just try and retry until it works, your hardware deteriorates when maltreated so you better get it mostly right from the start. It ain't software, it is called hardware for a reason.
Luc Pattyn [My Articles]
If you can't find it on YouTube try TikTok...
modified 2-Oct-20 15:39pm.
|
|
|
|
|
Luc Pattyn wrote: is either a Hitachi HD44780 or some derivative thereof
Yes, this is it. I didn't know the model number. I just knew the interface was a hitachi type and it's used by a lot of these displays.
I was trying to use LiquidCrystal with it. Oh well, if I can't get it to work I can always buy the one that uses that 3 wire arduino serial interface (I2C? i forget what it's called)
I'm not sure if I trashed it, as I didn't set it up randomly. I carefully followed the instructions on arduino's site and triple checked it, so while it's not impossible that I wrecked it, there's a good chance i didn't - or at least it may have been dead when i got it.
Real programmers use butterflies
|
|
|
|
|
Did you or didn't you include a resistor?
Most I2C models basically are the 16-pin version plus an extra board (example[^]) which takes care of and makes it harder to destroy the backlight
The extra board[^] is also available separately!
You would probably also want another library[^] then.
Luc Pattyn [My Articles]
If you can't find it on YouTube try TikTok...
|
|
|
|
|
It did indeed have a resistor. Cool - i figured it worked something like that but i didn't know you could get the board separately. Thanks.
Real programmers use butterflies
|
|
|
|
|
If you had the resistor in place from the start, that strongly reduces the probability you wrecked the display; so either it was broken already, or it is still OK and your observations are flawed.
I did mention the existence of the separate I2C convertor, I did not intend that as a suggestion; when in doubt about the state of the current display, maybe just replacing it is a better idea than adding to it.
Or doing some more tests: If you connect the current display, you could try writing and reading its registers, even when no crystals are seen moving. First step though would be to check the power pins (you have ordered a multimeter by now I hope), a resistor plus a LED could suffice to check anything is present between the GND and 5V pins.
Luc Pattyn [My Articles]
If you can't find it on YouTube try TikTok...
|
|
|
|
|
Yes I have ordered one. And I can by with an LED+resistor for now. Someone else gave me a good breakdown of what the pins did. Seemed maybe I frustrated them for being a noob , but at least I learned something.
Real programmers use butterflies
|
|
|
|
|
I use a 4x20 LCD display from Parallax. It only has 3 pins: power, ground, receive. Sounds completely different from a 16-pin Hitachi.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
Yeah it sounds like you're using that little 3 pin serial bus popular with arduino devices. This is a more general device, but it can and should work with arduinos, and has shipped with arduino kits in the past. the little serial bus one like you're using is an alternative. A good one, but it didn't come with my kit.
Real programmers use butterflies
|
|
|
|
|
Way down the list I seen that someone mentioned HD44780 with some links. This is the link I used to get things going. I found a box of these surplus at $1 or something a bunch of time ago, but all the connectors are reversed like the connector is on the wrong side of the board....but once I got that figured out, I got it going....
And the site that helped me get going with it.[^]
Good luck and enjoy.
|
|
|
|
|
Thanks
Real programmers use butterflies
|
|
|
|
|
Hi
i've only just just been playing with a 16 pin LCD1602 display on my raspberry pi yesterday, and im connecting it via I2C as it only needs 2 wires (+ gnd & 5v) but i do know you need I2C and SPI enabled for it to work. i use an adafruit python library, and it's all is pretty simple. i dont know arduino boards or how to do this on them, but maybe this snippet of info will help - btw i watched a few youtube video's for tutorials. GL
|
|
|
|
|
|
I haven't messed with the hitachi screens. can you give a PN/model to look at the docs?
usually not all pins are used, with the screens I've worked with in the past, based off of memory:
7 pins for the command byte
1 CTS
1 power for lcd cpu
1 power for back light (not usually crossed over as this pin can be PWM for dimming)
1+ grounds
1 reset - can sometimes be ignored, depending on the model. sometimes necessary on boot.
are you using a pre-made driver library? you will ether have to use their pin set up or configure the setup in the header file.
if you are trying to roll your own, it not too difficult, but sometimes finding the documentation in English can be rather difficult. there are usually a sequence of bytes that have to be sent to the LCD at startup to initialize them. then a 10 to 20ms for the LCD to be ready for commands.
some pins may require to switch I/O status to report something back to the driver. not all LCDs are 5v, many of them are the 3.3v on the logic side and would require a level shifter, but the backlight may still be 5v
If I have the choice in the future, I'd rather go with the I2C interface to save a lot of pins
I know of quite a few gotcha's in the back of my head, but it's been a few years since I've messed with LCD's and I haven't had my morning coffee yet.
|
|
|
|
|
Whenever you work with something like this, always look for the "Data Sheet" they are the source of all truth no matter what any user guides you get with the product say.
In your case, this is the one you need:
https://www.sparkfun.com/datasheets/LCD/HD44780.pdf
The HD44780 is the driver chip (Probably under a blob of black rubber) on the back of the display, and 99.9% of all this types of display use that driver chip.
Even the 3 wire I2C ones use that driver chip, they just put a multi port I2C GPOI chip (Such as an MCP23017) in front of the Hitachi one and take care of the pin handling for you.
The wiring you need for the display will look something like this:
(https://hacksterio.s3.amazonaws.com/uploads/attachments/1138784/basic_lcd_control_B4wegmYYMt.png)
That diagram is wired for "4 bit mode", these displays can be wired up to work in either 4 or 8 bit mode (The former is to save some connecting wires) in 4 bit mode you have to make 2 writes to the display to send a full byte, otherwise the programming commands (Values of the bytes sent) are identical between both modes.
Also pay close attention to those pre made boards you get with the kits, they are often wired from right to left, rather than left to right. This means that "Bit 0" of your 4 or 8 data pins is actually right most (Like in the diagram above) and bit 7 is left most.
Once you have your power hooked up, and your data lines, you need to pay close attention tot he 3 lines marked 'RS', 'R/W' and 'E'
The RS line is called register select and is toggled to a 1 or a 0 depending on what your sending to the display. If your sending a command byte (as described in the data sheet) EG: enable display, turn cursor on/off, set 4/8 bit mode etc then you need to be sending 0v on this line BEFORE you write the command byte.
If your sending a byte of data EG: a letter to display on the LCD, then 'RS' MUST be set to +5V
Your R/W line is the "Read NOT write line", pay close attention tot he fact that there is a vertical bar drawn over the top of the letter.
This vertical bar means that the signal is what's called "Active Low", or in laymans terms "it does something when it's held at 0v", in our case when the signal is "High" (+5v logic) then the signal tells the device to be in "Read Mode" for all of the 8 data bus lines, and when it's "NOT write" it's in write mode.
Why does this display have a read mode? Well LCD displays using this chip can read the letters entered from CG ram on the device, so you can actually use them as a single line input text console. The Cobalt RaQ3 Web server for example used this to great effect to allow the user to input things like the IP address of the server when setting it up, using no more than a simple 4 way up-down/left-right d-pad switch.
If your NOT planning on using this display for input and ONLY display (Which is pretty much the most common) then connect this line to your 0v supply ground line, and that will place the device permanently into "Write Mode" and you won't have to worry about syncing that signal.
Lastly we have the 'E' signal, this line is more of a strobe signal than anything else, this signal should be held at 0v for most of the time, the only time it goes to logic 1 (+5v) is once you have the data pins, and R/W + RS lines set up and ready to go.
Once all the other lines are ready, you toggle this to +5V, wait a mill second or two then toggle it back (The delay depends on the speed of your device and a lot of other conditions), some experimentation here will be needed. You will need to toggle this line once for every byte (date or instruction) you send to the LCD, if you do not the driver chip WILL NOT look at your signals and act on them.
The DX (0 to 7) lines are your 8 bit data interface, you send the bit patterns for the bytes you wish to send on these lines.
The power on these devices is quite easy, but you do need to be careful, as others have pointed out it's easy to get them reversed and "pop" a device, although if I'm honest, I've yet to kill one by getting the power wrong, they are quite surprisingly tough little displays most of them.
That said, there are often 2 different power supplies to hook up.
On ALL the ones I have, I have 2 separate +5/0v pins for the back light AND the device operation.
You can power the device just from the two power pins on the right, but without the backlight powered it can often be difficult to see what's on the display, this is where "OLED" versions of these displays are better, because they don't require a separate backlight given that they are self illuminating.
The remaining one that people are saying "needs a variable resistor" doesn't actually NEED one per say, but it does help.
This final pin is your contrast control, and needs a voltage any where between 0v and +5V, the closer to 0v the voltage is, the lighter the display is. What I often do is just hook this line directly to my +5V line, thus giving out maximum contrast/darkness, and ensuring I'm able to see something, then once I have it working and my code works, then I either put a fixed value in, something like 4.7k to get it roughly half way, or I'll put a small 10k trimming pot of some kind in.
Needless to say ALL of this is much easier on a bread board, if your going to do a lot of experimenting like this I highly encourage you to get some decent bread boards and some good quality du-pont hook up wires.
Hope that lot helps
Shawty
PS: I do Arduino, rPI, and Bare back AVR & MCP/PIC Microcontrollers, and the .NET book I'm on writing (when I get it finished) will have a section on .NET IoT using the .NET Core IoT libs (Well if I can get the code stable it will anyway) feel free to hit me up on twitter if you want to ask anything "@shawty_ds"
|
|
|
|
|
Assuming it's protocol compatible with HD44780, hardwiring the command 0b00001111 and then toggling the clock/enable bit should turn the display on, show the cursor, and make the cursor blink. Also, make sure RS & R/W are set to 0/GND, obviously VCC and GND are connected, and the backlight power is connected, if applicable (pins 15/16).
Of course, the assumes it powers on in 8-bit mode. If it powers up in 4-bit mode, it becomes messier. This wikipedia page gives a command sequence that will ensure the mode is consistent: Hitachi HD44780 LCD controller.
Note: I haven't actually tried this, but based on the wiki and datasheet, it should be the minimum needed to wire up (if manually toggling the clock with a button or wire touch, no arduino needed).
|
|
|
|
|
Hi honey the LCDwitch
any progress?
I just happen to be working on a PIC+LCD project; my LCD is working, after some struggle, and here are my recent observations:
1. pin 3 is most relevant; a lot of documentation is misleading, this pin is not "LCD power" or some similar, suggesting 5V would be reasonable. It is a contrast control input, the official approach is using a little potmeter, say 10K, between GND and 5V, and turning it very close to ground, NOT close to 5V. A good alternative seems to be just a diode from pin 3 to GND; that is what I'm using now.
2. The LCD needs a few commands to become alive; one of them is the "function set" command, holding a "display ON" bit; so you need some correct toggling of E, RS, and 4 or 8 data lines.
3. The pulses required on E are a bit special: the leading edge must fall after RS and RW have settled, and the falling edge after the data is presented. This is unlike most other micro-electronic peripherals I have ever seen (normally one edge is used to sample everything, and the other edge doesn't care much).
4. The data bus is either 8 or 4 bits wide; in order to get it in 4-bit mode RELIABLY you need a specific sequence of commands. Without proper initialization the display remains blank, as if no power were applied. And the display may remain confused as long as it is getting power (or a really correct command sequence).What Hitachi HD44780 LCD controller - Wikipedia[^] says is correct and effective, it is better then what a lot of data sheets provide! Some manufacturers that used to provide bad info are now refraining from providing initialization info at all. The mistakes can be blatant or subtle, I also found a github code sample that was wrong... This is what I'm using right now (using a 4-bit interface):
CALL WAIT40msec ; important!
BCF LCD_RS_PP ; set RS low
MOVLW 0x03 ; 8-bit interface
CALL display_write_nibble
CALL WAIT1msec
MOVLW 0x03 ; 8-bit interface
CALL display_write_nibble
CALL WAIT1msec
MOVLW 0x03 ; 8-bit interface
CALL display_write_nibble
CALL WAIT1msec
MOVLW 0x02 ; 4-bit interface
CALL display_write_nibble
CALL WAIT60usec
MOVLW 0x28 ; 4-bit interface, single line, 5*8 font
CALL display_send_fast_command
MOVLW 0x08 ; display off
CALL display_send_fast_command
MOVLW 0x01 ; clear
CALL display_send_fast_command
CALL WAIT2msec
MOVLW 0x0C ; display on, no cursor, no blink
CALL display_send_fast_command
MOVLW 0x06 ; mode: increment, no shift
CALL display_send_fast_command
The display_write_nibble subroutine sets E high, outputs a nibble, and clears E, all without extra delays.
The display_send_fast_command subroutine calls display_write_nibble twice and then waits 60µsec.
I did not compare that to whatever is present in other libraries such as Arduino's. With all I saw on internet, I'm inclined to only trust my own code...
5. LCD commands take some time to execute; a TYPICAL time is listed in the datasheet.
I decided against reading the busy flag (which isn't working anyway during the fist half of the initialization), instead I simply provide ample time for each command to be executed. So my R/W line is at GND permanently; this also eliminates the chance that the driving code is stuck in a wait-for-display-ready loop, keeping the display in an uninitialized state.
So I used fixed timing. It is wise to provide at least double the datasheet values, because (1) the internal microcontroller might run at a different frequency, and (2) HD44780 clones may hold different firmware and hence different timing.
6. Final remark: backlight pins 15 and 16 may or may not be swapped, and may or may not have some resistance in them (some 12 ohm). It all depends on the specifics of the PCB. Anyhow, the backlight is not essential, the display can be seen to be functional without it.
Luc Pattyn [My Articles]
If you can't find it on YouTube try TikTok...
|
|
|
|
|
I've decided to move to displays that are SPI or I2C based. It's just too many wires and i don't like putting pots in my circuits, and all that. it's just a mess and I'd rather go with something cleaner. Thanks though. I do have that display still but it's collecting dust. =)
Real programmers use butterflies
|
|
|
|
|
Hi All,
I suppose Task Manager is not really one those things you see everyday, but in fiddling today I noticed that the icon bar version has changed from a dark grey to a white with a green/red dotty back ground just plain strange don't remember that change...
|
|
|
|
|
No "green or red" for me; just a gray monitor icon with a blue and white performance chart.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
Unchanged for me - still a grey monitor.
Win10 Version 2004 (OS Build 19041.508)
Have you got an odd bit of desktop behind it or something?
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|