I'm a student and would like some help programming an LCD display.
I'm currently working on a project where I'm trying to communicate data to an LCD Displaytech 162B through an PLC Siemens S1200.
I have misunderstood or overlooked something in my software, because nothing is showing on the display.
Hardware:
As mentioned, I'm programming the display with a Siemens S1200 PLC.
Power supply as well as the outputs of the PLC is 24VDC. Each of the outputs from PLC and power supply is voltage divided down to 5VDC (confirmed with voltmeter).
Pin 16: DB7 connected to PLC output as #Data_bit_3
Pin 15: DB6 connected to PLC output as #Data_bit_2
Pin 14: DB5 connected to PLC output as #Data_bit_1
Pin 13: DB4 connected to PLC output as #Data_bit_0
Pin 12: DB3 connected to ground
Pin 11: DB2 connected to ground
Pin 10: DB1 connected to ground
Pin 9: DB0 connected to ground
Pin 8: E connected to PLC output as #EN_1
Pin 7: R/W connected to ground
Pin 6: RS connected to PLC output as #RS
Pin 5: VO connected to potentiometer (potentiometer connected to 5VDC and ground)
Pin 4: VDD connected to 5VDC
Pin 3: VSS connected to ground
Pin 2: LED- connected to ground
Pin 1: LED+ connected to 5VDC
Software:
Is written is Siemens SCL. Initialization:
Sequence is
Pre-initialization x 3
Pause
4-bit mode - 1 line - 5x7 font.
pause
Display Clear
pause
Return Home
pause
Display on - Cursor off - No blink
pause
Increment - No shift
pause
DDRAM
Timing sequence:
Initialization code:
Sorry the code is so long, but an PLC does not work like a computer, so the timing had to be spelled out and following a timeline.
See comment below
Display data:
So just for simplifying the communication of data I wanted to write the number "9" on the display.
Sequence:
Clear display
pause
Return home
pause
Data
I don't know how to evaluate your pin connections or code, but I understand LCD displays (perhaps early types) need continual hi-frequency AC waveform applied in some fashion?
Is yours that type?
Is this a HD44780 compatible ASCII display, 2 rows, 16 columns?
If so you need to read the HD44780 datasheet. Especially the timing charts.
Issues (I guess)
Timing is related to the falling edge of "E". Thus all other signals have to be stable at this edge. But in your case all signals change state.
Please tell what type of PLC outputs you use: relay (bouncing), or non bouncing transistor output.
If transistor output: open emitter, open collector, with or without pullup/pulldown resistor, push-pull .... or any other.
Btw: if you show a timing diagram, then please also show the time scale.
********
Hopefully this is a school project, and no commercial project.
In my eyes it makes no sense to control a display this way with a PLC. Better use a dedicated, intelligent PLC display.
Is this a HD44780 compatible ASCII display, 2 rows, 16 columns?
If so you need to read the HD44780 datasheet. Especially the timing charts.
Issues (I guess)
Timing is related to the falling edge of "E". Thus all other signals have to be stable at this edge. But in your case all signals change state.
Please tell what type of PLC outputs you use: relay (bouncing), or non bouncing transistor output.
If transistor output: open emitter, open collector, with or without pullup/pulldown resistor, push-pull .... or any other.
Btw: if you show a timing diagram, then please also show the time scale.
********
Hopefully this is a school project, and no commercial project.
In my eyes it makes no sense to control a display this way with a PLC. Better use a dedicated, intelligent PLC display.
Hello Klaus. Thank for the reply.
I'm an Automation technician apprentice, so I'm not familiar with the transistor types, but the output are transistors. I have emailed siemens tech support for more information.
I will start with offsetting the timing between E's falling edge and data falling edge.
Edit* By the way I would imagine the transistors are PNP because of the 24VDC common line
and: is it a school project .. or for professional use?
***
I recommend to post a link to the dispaly´s datasheet
Also I recommend to post a schematic or sketch with the voltage dividers for signals and power supply. With part values.
and: is it a school project .. or for professional use?
***
I recommend to post a link to the dispaly´s datasheet
Also I recommend to post a schematic or sketch with the voltage dividers for signals and power supply. With part values.
O.K. datasheet does not tell about HD44780 compatibility ... but indeed this is what I guessed.
****
School project: thanks god. ;-)
****
You need to keep on "Write mode timing" page 4 and page 5.
In the timing diagram you see that first you have to apply RS and RW, then E_rising ...
One - maybe complicated - thing is: The timing of DATA.
It says: it needs to be stable 120ns after E_rising. (latest possible timing)
Since the PLC timing can not work precisely down to 120ns ... you should go the safe way and make DATA stable before e_rising.
thus: (each "*" is one PLC step)
* output RS, and DATA (RW is fix)
* output E rising
* output E falling
* ...