2004A LCD Display For Text
seekerofthetree
Posts: 12
Hey guys,
Need some help I am coming along designing my US transducer guided car. I wanted to add a display using the propellor board of education and a LCD display. I went for the cheaper option and bought a generic 2004A board. My question is do I have to reinvent ASCII in order to display on this thing? I wanted to display distance measured for example. So if I want to display 3.4 inches do I have to send 051 046 052 032 105 110 099 104 101 115 to each port? Seems like a pain in the rear. Anybody used one of these cheap displays before?
Thanks
Seeker
Need some help I am coming along designing my US transducer guided car. I wanted to add a display using the propellor board of education and a LCD display. I went for the cheaper option and bought a generic 2004A board. My question is do I have to reinvent ASCII in order to display on this thing? I wanted to display distance measured for example. So if I want to display 3.4 inches do I have to send 051 046 052 032 105 110 099 104 101 115 to each port? Seems like a pain in the rear. Anybody used one of these cheap displays before?
Thanks
Seeker
Comments
For a single digit "value", you could use:
There's a method "DecPoint" floating around a couple of places on the forum which makes it easier to display scaled integers using a decimal point. It would need to be slightly modified to send the characters to your display rather than a serial driver.
The same thing can be done with the method "fdec" in the object "strfmt". The object "Numbers" in the Propeller Tool's library also has this sort of method (IIRC).
Most of this is part of the hardware and software standards. On an alphanumeric keyboard when you press the "h" key the keyboard hardware sends out the ascii code for the letter "h". If you hold the shift key and press the "h" key it sends out the ascii code for the capital letter "H".
If a display terminal or printer receives the ascii code for "H" the hardware of the display or printer will display or print "H", no conversions needed.
In almost all cases now the hardware for keyboards, displays, and printers are microcontrollers and software that perform these functions. For numbers it is different. Virtually all calculations are done with binary numbers internally in the micro, so the decimal digits we are familiar with need to be converted to binary numbers when they are entered, and the binary numbers need to be converted back to decimal digits when we want to display or print them. That conversion is usually done by the library functions of the C compiler.
I think so.
In Spin you could do this:
You do something similar with any 8 sequential pins. There's got to be an easy way to do the same in C.
The sequence for each character or command would be something like:
output function bits to RS and R/W pins
output 8 data bits to data pins
output high to E pin
output low to E pin
This is for the lowest level.
There are a lot of other functions that are performed by writing commands to the display control register. They are explained in the data sheet.
PS - Take a look at the Multi Propeller - 8bit Parallel IO object to see how a parallel port is done in spin.
I use this device to connect my propeller projects to an LCD display. It takes all the tedium out of getting the display operational, which can be very frustrating, particularly initializing the display. Added benefit is that it uses 1 propeller I/O pin instead of 9 or ten. Setting it up in C with Simpletools is as easy as 1-2-3. The dprint statement...
?y3 = line 4 of a 4x20 display
?x04 = 5th position from left
The rest is standard C format for printing to the device. There are quite a few ?commands available to let you do just about anything with your display. The onboard PIC takes care of nearly all timing except for when you write config info to the Pic eeprom, which is clearly spelled out in the documentation. If your propeller board has an unused servo port, you can use that to drive the display using the provided cable in the kit.
Nice module Hal, unfortunately his LCD is not HD44780-based so it will not work with his display. It uses a parallel 8 bit or 4 bit data bus and 3 control lines and the commands are different.
Just looked up the 2004A LCD module and the datasheet shows it uses the SPLC780D controller chip. According to postings on AVR Freaks they state that the two controllers are compatible. They both have the same instruction set, and module pinouts are similar to those that use the Hitachi controller. As I understand it, the LCD117 is a serial to parallel interface specifically for driving LCD modules with just one I/O pin. The 117 offers two ways of connecting to the LCD module, with 1x16 or a 2x8 connectors, and actually communicates with the LCD module using the 4-bit data bus plus control lines.
Hal
I hope the OP at least takes a look at the module, I know it has made my life a lot easier. When I tried bit banging LCD modules it seemed like it took forever to get the blasted thing properly initialized.
Thank you, Kwinn;
Hal
It's a reminder I need as well. I have a bad habit of taking a quick look and and getting involved in projects that are a lot more work and of greater complexity than that first look indicated. Bad from a time and income perspective at times but a very good learning experience. I have learned a lot and attracted some new customers from those mistakes, so in the grand scheme of things they have been a benefit.
Hal