Connect a LCD display to the parallel port of PC

Started by colormyworld, December 27, 2011, 12:27:25 PM

Previous topic - Next topic

colormyworld

Hello!

I've just started to learn a few things about assembling and microprocessors, and now I'm working at a bigger project(for me, because I'm sure that for experienced members it's really easy), and I want to connect a LCD display to the parallel port of PC in order to display a value of 1 digit(0....9).

Any kind of information will be very useful, that can help me to understand how an LCD receives data, and how actually I can write my assembling progr.

Merry Christmas! :)

qWord

FPU in a trice: SmplMath
It's that simple!

colormyworld

I need to write a program in assembly language in order to Connect a LCD display to the parallel port of PC in order to display a value of 1 digit.
This is my goal. But in order to do this, I need to document myself, to see how it works an LCD.


BogdanOntanu

Quote from: colormyworld on December 27, 2011, 01:30:03 PM
I need to write a program in assembly language in order to Connect a LCD display to the parallel port of PC in order to display a value of 1 digit.
This is my goal. But in order to do this, I need to document myself, to see how it works an LCD.


This is not exclusively a question of programming. It is also (half or even more of it) a question of hardware interfaces. You can not really write an program for this until you do not show/have some schematics and do not make your homework about the requirements (speed, signal levels, timings, real time constraints).

Please show us that you understand the hardware requirements in details and the schematics.
What work and understanding of the problem at hand have you done until now?

A few hints:

1) Do you understand the hardware requirements  and protocol differences in between VGA, DVI and HDMI interfaces to an monitor?
2) Do you understand the limitations of the speed of an parallel port that is normally located on an simulated ISA bus inside an today PC?
3) Do you understand the electrical signals that you need to generate (syncro H/V, blanking, and pixel clock) for your case?
4) We might help you with the ASM program (when you reach this point... if ever) BUT normally we do not make you homework here...
it is YOU that must write and understand and test 99% of it... we help the ones that show good will.
5) Do you understand that modern Win7 might not allow you to directly write to the parallel port and even if it does it might no reach the real time constraints?
Again, show us what research you did until now ;)

Oh, and please DO NOT post the same question in multiple sub forums :D
Ambition is a lame excuse for the ones not brave enough to be lazy.
http://www.oby.ro

colormyworld

Hello!

First of all thank you for the questions, is a good starting point for me. This is why I sad that ANY kind of information is useful. Yes, I need and also I want to learn more in detali about the hardware, but is a little bit hard to get information focused.

Like I sad, I'm a very new, and till now I've only wrote short programs summing, moving the contents of memory and so on, and this is a complex program.

Have a great day!

BogdanOntanu

From my experience your best chance of doing this kind of project is to use an fast micro controller (AVR or something)

Using an PC and x86 ASM will be relatively hard (but not impossible).

There is a reason why today PC's use an video board: the CPU can not generate the required signals fast enough and efficiently ;)

Also HDMI monitors will NOT allow you to do this :D

Your best chance is to find an old VGA monitor somewhere.
Ambition is a lame excuse for the ones not brave enough to be lazy.
http://www.oby.ro

qWord

You may better go to a forum for electronics, microcontrollers and FPGAs.
FPU in a trice: SmplMath
It's that simple!

FORTRANS

Hi,

   I hooked up an LCD display to a parallel port.  Got a 16
character by two row panel from Radio Shack (a long time
ago, last I checked they said they did not have them anymore).
But, I think I cooked it before getting it to work.  What
type of LCD do you have?

Regards,

Steve N.

dedndave

does your LCD display have a driver chip ?
or are you driving the display directly ?
it would be helpful if we had the documentation for the specific display you are using
we can probably find it online, but we need a manufacturer and model number
any info on the driver chip may also be useful

colormyworld

A 16 Character x 2 Line LCD Module

dedndave

well - that will greatly simplify things, in some ways

still - if you are writing 32-bit code, you have to get the OS to let you have permission to talk to the parallel port
i think the you can do that with DeviceIoCtl...
http://msdn.microsoft.com/en-us/library/aa363216.aspx

if you are writing 16-bit code, you can do this a little easier, although, it won't run under 64-bit operating systems

the parallel port does not provide power output pins
so, you'll have to provide your own power
i doubt you can run a display with a backlight from a signal pin   :P
also - you won't have an analogue signal to drive the contrast input
you will have to provide a pot on the display board for that

otherwise - the parallel port data pins can be connected to the data lines DB0-DB7
the register select, read/write, and enable pins can be driven using some of the parallel port hand-shaking lines
this link has some useful info...
http://www.beyondlogic.org/parlcd/parlcd.htm

FORTRANS

Hi Dave,

   Here are a couple pictures.  DB-25 connector, soldered wires,
a potentiometer, and power connecter.  I can look for the
datasheet, but it's been a few years since I last saw it.

Regards,

Steve N.

colormyworld

Hey Fortrans,

Do you still have also the code in assembly? This would be very useful.


FORTRANS

Quote from: colormyworld on January 08, 2012, 03:38:02 PM
Hey Fortrans,

Do you still have also the code in assembly? This would be very useful.

Hi,

   No, not really.  I cooked the panel before I got it working.
Here is a part of the code I have left.  Was "working" in DOS.
Windows does not support the Int 15H BIOS functions.  I
will post the non-working LCD panel code I have.  Not sure
how it can help, but good luck.

Regards,

Steve N.


        PAGE ,132
        TITLE LCD panel driver.
        NAME LCD
COMMENT *
    Display stuff on a small LCD screen.
LCD, December 2000, SRN
*
; Note:  Most of the non-panel code deleted!  Jan 2012.
; Note:  Not working code follows...

; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; Set up the code definitions the operating system wants.  Data segment:
DATASG  SEGMENT PUBLIC
        ASSUME  DS:DATASG, SS:STCKSG

; - - - - DELAYER - - - -
DelayT  DW      0       ; ~ Hundredths of seconds

; - - - - Display Routine Global Data - - - -
DispWidth       DW      16
DispHeight      DW      2

; - - - - LPT Port Definitions - - - -
LPTBase         EQU     0378H   ; LPT1
LPTData         EQU     LPTBase + 0
LPTStatus       EQU     LPTBase + 1
LPTControl      EQU     LPTBase + 2

DATASG  ENDS
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; Set up the code definitions the operating system wants.  Code segment:
CODE    SEGMENT PUBLIC
START   PROC

; Code deleted.

START2: ; Initialize panel
        CALL PInit
        jmp startx2

START3: ; loop point
        MOV     AH,'H'
        CALL OutChLCD
        MOV     AH,'e'
        CALL OutChLCD
        MOV     AH,'l'
        CALL OutChLCD
        MOV     AH,'l'
        CALL OutChLCD
        MOV     AH,'o'
        CALL OutChLCD
        MOV     AH,' '
        CALL OutChLCD
        MOV     AH,'w'
        CALL OutChLCD
        MOV     AH,'o'
        CALL OutChLCD
        MOV     AH,'r'
        CALL OutChLCD
        MOV     AH,'l'
        CALL OutChLCD
        MOV     AH,'d'
        CALL OutChLCD
        MOV     AH,'!'
        CALL OutChLCD

STARTX: ; exit processing
        jmp startx2
STARTX2:
        MOV     AL,0
        SCALL   EXIT    ; .EXE exit  (Macro to exit via 4CH.)
START   ENDP
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
LDelay  MACRO   ; Long delay for panel

        XOR     CX,CX
        MOV     DX,1600 ; 1.64 ms - 40 µs
        MOV     AH,086H ; AT Services Delay Function 86H
        INT     15H

        ENDM
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SDelay  MACRO   ; Short delay for panel

        XOR     CX,CX
        MOV     DX,20   ; 1/2 of 40 µs
        MOV     AH,086H ; AT Services Delay Function 86H
        INT     15H

        ENDM
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; Output command byte and toggle strobe for panel
; December 2000 Input AH = command byte
OutLCD:
        MOV     DX,LPTControl
        IN      AL,DX
        AND     AL,0DFH ; ensure data forward
        OR      AL,080H ; select printer for command
        OUT     DX,AL

        MOV     AL,AH
        MOV     DX,LPTData
        OUT     DX,AL   ; output command

        MOV     DX,LPTControl
        IN      AL,DX
        OR      AL,01H  ; Set Strobe
        OUT     DX,AL

        SDelay  ; uses AX, CX, DX

        MOV     DX,LPTControl
        IN      AL,DX
        AND     AL,0FEH ; Reset Strobe
        OUT     DX,AL

        SDelay

        RET
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; Output text character to panel
; 5 December 2000 Input AH = text byte
OutChLCD:
        MOV     DX,LPTControl
        IN      AL,DX
        AND     AL,0D7H ; ensure data forward, reset select printer for text
        OUT     DX,AL

        MOV     AL,AH
        MOV     DX,LPTData
        OUT     DX,AL   ; output byte

        MOV     DX,LPTControl
        IN      AL,DX
        OR      AL,01H  ; Set Strobe
        OUT     DX,AL

        SDelay

        MOV     DX,LPTControl
        IN      AL,DX
        AND     AL,0FEH ; Reset Strobe
        OUT     DX,AL

        SDelay

        RET
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PInit:  ; Initialize LPT port and LCD panel
        ; First the LPT port (moved to output routines)

; then the panel
        MOV     AH,01H  ; Clear Display
        CALL OutLCD
        LDelay

        MOV     AH,38H  ; Noted: first 3 commands to ensure proper power on
        CALL OutLCD     ; H'38' = function set, 8 bit, 2 lines
        MOV     AH,38H  ; AH is destroyed
        CALL OutLCD
        MOV     AH,38H
        CALL OutLCD

        MOV     AH,0FH  ; Init? Display on/off control
        CALL OutLCD     ; H'0F' = display on, cursor on, Blink on

        RET

; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CODE    ENDS
        END     START

colormyworld

@BogdanOntanu: The time was passing an also I was studying a little bit a about this subject.
So I will try to answer to your questions by what I was finding so far:
DVI and HDMI were introduced to carry information in digital formats. HDMI (High-Definition Multimedia Interface) is a compact audio/video interface for transmitting encrypted uncompressed digital data. It is a digital alternative to consumer analog standards such as VGA.
The CEC allows HDMI devices to control each other when necessary and allows the user to operate multiple devices with one remote control handset.Because HDMI is electrically compatible with the CEA-861 signals used by digital visual interface (DVI), no signal conversion is necessary, nor is there a loss of video quality when a DVI-to-HDMI adapter is used. As an uncompressed CEA-861 connection, HDMI is independent of the various digital television standards used by individual device.
VGA is an older standard that transforms the digital video output from the computer into an analog signal (in a CRT) and back to a digital signal (in an LCD).
DVI is newer and more intuitive for newer LCD monitors. It is capable of sending the digital signal straight from the computer to an LCD display without having to waste time transforming the signal to analog and back. All CRT monitors are analog displays.

When we use the parallel ports in bidirectional
mode, by setting the direction bit of the control register (C5 = 1), the outputs of the data register can be set
to the high-impedance state, these outputs being electrically disconnected from the connector pins. This
allows to read into the data register any external TTL signals applied to the corresponding pins. The values
written into the data register are stored, but they are not sent to the pins. Parallel ports that operate in
this manner are referred to as bidirectional or PS/2 ports.



Thank you FORTRANS