C # operation IO port 2 - Control LCDFluorescent Display-1

zhaozj2021-02-16  49

C # operation IO port 2 - Control LCD / Fluorescent Display

Author: Levent S. Translation: aweay

Outward

After the above article, many friends said that this is too simple. I thought I used C # to write the code to complete the IO operation. Isn't it called an existing DLL? On the contrary, this article got the love of all readers (scored 4.82 points, this score is still rising), I don't know if this is the low level of foreign programmers? I said that gossip is less, starting this discussion:

Demo download

Source code download

Demonstration after completion:

What is LCD? What is it used?

Don't be afraid, I will not give you a historical class like another article, but tell you why I am still using LCD? At first we used LED (Light Emitting Diodes), In the 70s era, there will be the LCD we use now. The biggest feature of the LCD is that it can not only display numbers, but also display characters and a variety of symbols. Click here to view the LCD-based data table, which gives the LCD specification information. LCD has an HD44780 (Hitachi) compatible KS0066U controller, Samsung production such a controller, if you are interested in electronic raw materials, you can download controller information here. The controller here is not as complex as today's graphics LCD, but it is also widely used in commercial / industrial products.

Let us explain what is VFD, VFD (Vacuum Fluorescent Displays, Vacuum Fluorescence Display) is very similar to LCD. They are often used in microwave and portable calculators. Here has a picture of a VFD. The key is that the HD44780 controller is equally applicable to VFD. Compared with LCD, I prefer VFD because it is brighter than the LCD, of course, VFD is more expensive, in my article as an example of LCD.

What is the LCD looks like? Use the 2X16 LCD in my article, just like the above image display. There are also many other types of LCDs, such as: 1x8, 2x8, 1x16, 2x20, 1x40, etc., different LCDs have different suppliers. If you need a LCD greater than 80 characters, you can use 2 controllers. I no longer discuss any information about the LCD structure. If you want to know about this knowledge, you can check the following address:

l Samsung's LCD structure and type

l Sharp's LCD technology principle

LCD connection

Most of the LCDs have 14 wiring, they are D0-D7 (data cable), E (enable signal), R / W (read / write signal), RS (register selection), VEE or VO (contrast), VDD or VCC ( 5 volts), VSS (ground). Therefore, there are 8 data lines, 3 power cords, and 3 control lines for a standard non-backlit LCD. If the LCD has a backlight, you need to attach 2 lines, which are (VB ) and (VB- or ground), and one table lists the definition of these pins:

Standard LCD Pin Order (CHARACTER NUMBER <80)

Pin

Symbol / alternate symbol

Possibility

FUNCTION

1

VSS

-

Power Supply (GND)

2

VDD / VCC

-

Power Supply ( 5V)

3

VEE / VO

-

Contrast Adjust

4

RS

0/1

0 = instruction INPUT / 1 = DATA INPUT5

R / W

0/1

0 = Write to LCD Module / 1 = Read from LCD Module

6

E

1, 1 -> 0

Enable signal

Seduce

DB0

0/1

Data Pin 0

8

DB1

0/1

Data Pin 1

9

DB2

0/1

Data Pin 2

10

DB3

0/1

Data Pin 3

11

DB4

0/1

Data Pin 4

12

DB5

0/1

Data Pin 5

13

DB6

0/1

Data Pin 6

14

DB7

0/1

Data Pin 7

IF Your LCD HAS More Than 80 Characters (LIKE 4X40)

15

E2

1, 1-> 0

ENABLE SIGNAL ROW 2 & 3

16

NOT USED MOSTLY

This is the back of the LCD:

HY1602B (Hyper 1602B) with KS0065 Controller (Compatible with HD44780) And Backlight.

1602-04 with KS0066U Controller (Compatible with hd44780) and background.

The above is 2 different LCDs (backs), they all have a 15/16 lead.

Pin lead

1, 2, 3 needles

According to the above table, I call the first needle (VSS), the second (VDD / VO), the third (VEE / VO), and the power wiring. The first root is a ground, you must pick him up; the second is a 5V power cord. Use the voltage to provide a voltage in the IDE power interface line in the chassis in my program. The third line is an LCD comparison adjustment, I use a voltage meter to change the contrast of the LCD.

4, 5, 6

PIN4 (RS), 5 (R / W), 6 (e) are used to control LCD. PIN4 is a selection register if the needle is low, then the LCD can sense the data by sending a command; if it is a high level, the LCD can transmit or receive the character data of 8/4 bits. PIN5 reads the write, if the needle is low, you can write characters to the LCD, if it is high level you can read character data or status information. In my program, there is no read operation, so I keep it low. Pin6 is protected and it is used to initialize the actual command or data exchange between the LCD data pin.

7, 8, 9, 10, 11, 12, 13, 14

This 8 line is the data cable, can be transmitted or acquired from LCD, 8 bits or 4 digits each time. Use 8-bit transfer mode in my program because I use parallel ports, so he can use 8-bit data cable.

15,16 pins

These two needles are designed for the backlight of the LCD, and the backlight is very suitable for use in dim, we can often see a variety of backlight colors.

Circuit

What do our circuits need something? The following table is:

NO:

description

1.

LCD with parallel ports compatible with HD44780

2.

General parallel port printer cable

3.

Normal Twin Power Cable

4.

10 Way Housing and the PCB HEADER

5.

6 Way housing and the pcb header6.

IDE interface

7.

16 terminal PCB

8.

Digital multimeter

9.

Take someone to write my procedure :)

*

10K voltage gauge

Circuit diagram (voltage meter)

Circuit diagram (sticker)

If your connection is correct, you will get the following display:

Due to the 9CBS article system, there is no way to put too much content, there is no way I disconnected ...

转载请注明原文地址:https://www.9cbs.com/read-25664.html

New Post(0)