Thursday, June 23, 2011

LCD on serial port


With the continuing evolution of PC performance, you are more likely to use "old" machines for applications such as automation, data acquisition or even measures of all kinds. Such applications seldom need the TV monitor when digital data display only a few or a few lines of text. I propose to do without connecting serial ports on your PC this interface, equipped with a LCD alphanumeric display a classic or two lines of sixteen or twenty characters.
This circuit uses an LCD display built-in logic that can be found easily now on the market. Since it makes no interpretation of the displays control codes, it is compatible to all existing models, one or two lines of sixteen or twenty characters.


It can be connected to the serial port of any standard PC compatible and is equipped with a standard connector to 9 points for the use of any cable traditional law of commerce.
Given the low consumption of the circuit controller used, it takes its power on the PC's serial port. Finally, the PCB that I designed is the same width as the displays to one or two lines of sixteen characters standards, which they back up and connects directly.

The MIC 702 of Mictronics


To transform a standard LCD interface parallel interface model series, use a microcontroller or a dedicated circuit such as the MIC of 702 Mictronics. This is a circuit designed to transform the parallel interface to an LCD display logic integrated asynchronous serial interface standard. Its implementation is very simple as shown in the diagram below.

The diagram

The MIC 702 is connected directly to the display with which it is perfectly compatible. Notice the connection with the only 4-bit data MSB, since the MIC 702 operates the display in 4 bit mode twice.
PC side, the connection to the serial output of the PC does not involve any level converter for RS 232 TTL, this role being played by the only 22-ohm resistor R1 whose presence is indispensable.

The tab allows you to select BAUD speed circuit operation among two speeds: 9600 bps up with S1 or S2 with 2400 baud up. POL leg allows the circuit to interpret the data sets as direct or inverted. As is RS 232 is directly connected to the leg to ground to signal to the PCM 702 that receives data reversed. A link to + 5 volts would allow it to receive data directly as it would if you wanted to use this circuit with a Basic Stamp, for example.

Subject to use a non-backlit display, the total consumption of the circuit is low enough that it can take its power directly from the output control signals to the RS 232. It is the role of diodes D2 and D3 associated with IC1, which is a regulator with low voltage drop and low power consumption.

If you want to use a backlit display, it is possible that consumption of the backlight only exceeds the capabilities of the PC's serial port. You can use an external power supply via the diode D1. A voltage of 9 volts at a rate of one hundred mA appropriate.

Completion of the LCD on serial port

The printed circuit

 

Components:
The supply of components should not be a problem. The MIC 702 is available from Selectronic while the LM 2936 Z5 is at least available from Farnell.

Semiconductors
IC1: Z5 LM 2936 (do not substitute a 78L05)
IC2: MIC of 702 Mictronics (Selectronic)
AFF1: LCD standard 1 or 2 lines of 16 or 20 characters
D1: 1N 4004 (only if backlit display, see text)
D2, D3: 914 1N or 1N 4148

¼ watt resistors 5% unless otherwise
R1: 22 ohms (red, red, orange)

Capacitors
C1: 47 uF 25 V chemical radial
C2: 10 uF 25 V chemical radial
C3: 10 nF ceramic

Various
P1: Potentiometer adjustable horizontal 10 kohms
Qz: Quartz 20 MHz in case HC 18 / U and HC 49 / U
D1: DB 9 female connector for PCB, angled 90 °
Support CI: 1 x 18 feet
S1, S2: 2 x 2 pin male to 2.54 mm and not short-circuit jumper
Contacts tulips band female solder: 14 contacts
Pins male strip - male: 14 contacts


The implementation of the components is to be made as shown in the figure above. For safety, the MIC 702 is mounted on a support. If you use a non-backlit display, mounting the diode D1 is useless since the power from the RS 232 is enough.
If you plan to use this circuit with a microcontroller, a Parallax Basic Stamp or a Basic Pic Comfile, D1, D2, D3, IC1, C2 and R1 are not necessary since the assembly then fed directly from the + 5 volt microcontroller partner. Furthermore, the connection with the entry of the MIC 702 RCV can be performed directly in this case since it is then in the presence of TTL or CMOS.

The display is mounted on the copper side of the PCB so that its connection pads are opposite to those provided on the PCB. You can make a permanent connection, in which case you will use bare son rigid that you solder to connect all the dots facing each other. You can also make a removable assembly. In this case, solder on the printed circuit assembly 14 contacts tulips female band. Then solder the pads of the display 14 pin contact strip-like male - male that will plug into the female contacts of printed circuit tulips. In both cases, set the display to the circuit board, at least in two opposite corners to the connector to ensure good mechanical rigidity to the whole.

Testing

No software is required because the MIC 702 is responsible for forwarding directly to the display the data it receives and that it includes the ASCII code. You can use any standard terminal program running under DOS or Windows. The only precaution is to check that it is at the high level RTS and DTR serial port used since they are the ones used to power the assembly.
To test your installation connect it to a PC serial port using a straight cord (ie a cord with terminal 3 of a 9-pin connector goes to terminal 3 on the other !). Following his power, he made only one boot that clears the display and which positions the cursor at the beginning of the first line.
Turn the contrast control until the display to darken slightly back and come back so just put the points that make up the characters.
You can then typing any character ASCII standard to see that it appears on the display. If meaningless characters are visible, check that you have programmed the serial port at the same speed as selected by S1 and S2 and that operates in 8 bits, no parity and one stop bit. You can then attempt to send the display to one of several command codes he understands.

Control codes from the display

All LCD displays accept control codes standardized: clear display, cursor positioning, definition of custom characters, etc.. The table summarizes the common codes but you will find a more complete list in the documentation that you had to be provided with the display.
Function D7 D6 D5 D4 D3 D2 D1 D0
Erase display and cursor to the beginning of the 1st line 0 0 0 0 0 0 0 1
Cursor at the beginning of the 1st line without erasing 0 0 0 0 0 0 1 X
Cursor at the beginning of the 2nd line 1 1 0 0 0 0 0 0
Display Mode 0 0 0 0 1 D C B
Offset Cursor / display 0 0 0 1 S / C R / L X X
D = 0: Display on - D = 1: Display off
C = 0: Cursor not displayed - C = 1: Cursor display
B = 0: Cursor sets - B = 1: Cursor blink
S / C = 0: Shift cursor - S / C = 1: Shift display
R / L = 0: Left shift - R / L = 1: Shift right
The MIC 702 authorizes the use of these codes because it is completely transparent to their level. By cons, it must be able to distinguish one character to display a command code and for that it uses a very simple method:
  • The characters to be displayed are sent directly to the assembly. Their codes and the corresponding figure are given in the documentation of the display. For the standard alphanumeric characters, ASCII code is used on all displays.
  • Control characters for the display must be preceded, one by one, sending the character hexadecimal FE or 254 in decimal.
For example, to clear the display and position the cursor at the beginning of the first line, just send characters in succession to FE hex code, then 01, since 01 is the code of this function as shown in the table.
To display "Hello" at the beginning of the second line, it would suffice to send the montage sequence: C0 FE and then the string "Hello" and that would be played. As you can see, the use of this interface is very simple.

No comments:

Post a Comment

Thematic Links :