Символьный LCD дисплей 1602 (Blue)

Артикул: 003257
Наличие:
Есть на складе
Добавить в Wish List
Цена:
169.00 169.00

Технические характеристики

- Формат 16x2 символов
Питание: 5V
Цвет подсветки: голубая

Описание

Назначение пинов

Pin 1: VSS to power

Pin 2: VDD connected to 5V positive power supply

Pin 3: V0 LCD display contrast adjustment terminal, connected to the positive power supply weakest contrast, grounded power contrast, the contrast is too high will produce "ghosting", when used by a 10K potentiometer to adjust the contrast

Pin 4: RS for register selection, the selection of high data registers, instruction register is low.

Pin 5: R / W for read and write signal line, high read, low write operation. When the RS and RW is low can be written instructions or display the address can be read, when RS is low RW is high busy signal, data can be written when RS is high RW is low.

Pin 6: E end to enable end, When E Duanyou high jump becomes low, the LCD module execute the command.

Pin's 7 to 14: D0 to D7 for 8-bit bidirectional data line.

Pin 15: Backlight positive power supply

Pin 16: backlight negative power supply

1602 character LCD module internal memory (CGROM) has stored 160 dot matrix character graphics, such as shown in Table 1, these characters are: Arabic numerals, the case of the letters of the alphabet, commonly used symbols, and Japanese kana , we can see the letters "A, each character has a fixed code, for example, the uppercase letters of the alphabet" A "code is 01000001B (41H), dot matrix character pattern in the address 41H in the display module to display . "

ORG 0000H following procedures to display the letter "A" in the first character position of the second row of the LCD module:

RS EQU P3.7; determine the specific hardware connection
RW EQU P3.6; determine the specific hardware connection
E EQU P3.5; determine the specific hardware connection

MOV P1, # 00000001B; clear the screen and reset the cursor
ACALL ENABLE; write command subroutine call

MOV P1, # 00111000B; Set Display Mode: 8 2 lines 5x7 dot matrix
ACALL ENABLE; write command subroutine call

MOV P1, # 00001111B; display on, cursor on, allows the cursor to blink
ACALL ENABLE; write command subroutine call

MOV P1, # 00000110B; text does not move the cursor automatically to the right
ACALL ENABLE; write command subroutine call

MOV P1, # 0C0H; written to the display start address (the first position of the second row)
ACALL ENABLE; write command subroutine call

MOV P1, # 01000001B; letters A code

SETB RS; RS = 1
CLR RW; RW = 0; ready to write data
CLR E; E = 0; command is executed
ACALL DELAY; determine whether LCD module is busy?
SETB E; E = 1; showing completion procedures Parking

AJMP $

ENABLE:
CLR RS; write control command subroutine
CLR RW
CLR E
ACALL DELAY
SETB E
RET

DELAY:
MOV P1, # FFH; determine whether the liquid crystal display busy subroutine
CLR RS
SETB RW
CLR E
NOP
SETB E
JB P1.7 DELAY; P1.7 is high to indicate a busy loop waiting for
RET

END

Program at the beginning of the function of the LCD module initialization settings, have agreed on the display format. Note that the character the cursor is automatically shifted to the right, without human intervention, each time you enter the command first call to determine whether the LCD module busy subroutine DELAY, and then enter the displayed location address 0C0H last input of characters to display A code 41H .


SMC1602A (16 * 2) analog line port wiring
Connect the chart:
-------------------------------------------------- -
| The LCM ----- 51 | LCM ----- 51 | LCM ------ 51 |
------------------------------------------------ |
| DB0 ----- P1.0 | DB4 ----- P1.4 | RW ------- P2.0 |
DB1 ----- P1.1 DB5 ----- P1.5 | RS ------- P2.1 |
| DB2 ----- P1.2 DB6 ----- P1.6 | E -------- P2.2 |
DB3 ----- P1.3 DB7 ----- P1.7 | VLCD 1K resistor connect to GND |
-------------------------------------------------- -

 

[Note: the AT89S52 to use 12M crystal]
================================================== =========== * /

# Define LCM_RW P2_0 / / define the pin
# Define LCM_RS P2_1
# Define LCM_E P2_2
# Of define LCM_Data P1
# Define Busy 0x80 / / status word used to detect LCM Busy logo

# I nclude

void WriteDataLCM (unsigned char WDLCM);
void WriteCommandLCM (unsigned char WCLCM, BuysC);
unsigned char ReadDataLCM (void);
unsigned char ReadStatusLCM (void);
void LCMInit (void);
void DisplayOneChar (unsigned char X, unsigned char Y, unsigned char DData);
void DisplayListChar (unsigned char X, unsigned char Y, unsigned char code * DData);
void Delay5Ms (void);
void Delay400Ms (void);

unsigned char code uctech [] = {"uctech"};
unsigned char code net [] = {"uctech.icpcn.com"};

void main (void)
{
Delay400Ms (); / / start wait, the LCM speak into working condition
LCMInit (); / / LCM initialization
Delay5Ms (); / / delay a moment (but do not)

DisplayListChar (0, 5, uctech);
DisplayListChar (0, 0, net);
The ReadDataLCM () ;/ / test is meaningless sentence
while (1);
}

/ / Write data
void WriteDataLCM (unsigned char WDLCM)
{
ReadStatusLCM (); / / detect busy
LCM_Data = WDLCM;
LCM_RS = 1;
LCM_RW = 0;
LCM_E = 0; / / crystal speed too high after add a small delay
LCM_E = 0; / / delay
LCM_E = 1;
}

/ / Write instructions
the void WriteCommandLCM (unsigned char WCLCM, BuysC) / / BuysC 0:00 busy detection is ignored
{
if (BuysC) ReadStatusLCM (); / / needed to detect busy
LCM_Data = WCLCM;
LCM_RS = 0;
LCM_RW = 0;
LCM_E = 0;
LCM_E = 0;
LCM_E = 1;
}

/ / Read data
unsigned char ReadDataLCM (void)
{
LCM_RS = 1;
LCM_RW = 1;
LCM_E = 0;
LCM_E = 0;
LCM_E = 1;
return (LCM_Data);
}

/ / Read status
unsigned char ReadStatusLCM (void)
{
LCM_Data = 0xFF;
LCM_RS = 0;
LCM_RW = 1;
LCM_E = 0;
LCM_E = 0;
LCM_E = 1;
while (LCM_Data & Busy); / / detect busy signal
return (LCM_Data);
}

the void LCMInit (void) / / LCM initialization
{
LCM_Data = 0;
WriteCommandLCM (0x38, 0); / / cubic display mode is set, the busy signal is not detected
Delay5Ms ();
WriteCommandLCM (0x38, 0);
Delay5Ms ();
WriteCommandLCM (0x38, 0);
Delay5Ms ();

WriteCommandLCM (0x38, 1); / / display mode is set, began requiring each time it detects a busy signal
WriteCommandLCM (0x08, 1); / / turn off the display
WriteCommandLCM (0x01, 1); / / clear the screen
WriteCommandLCM (0x06, 1); / / move the cursor settings
WriteCommandLCM the (0x0C 1); / / display on and set the cursor
}

/ / At the specified location display a character
void DisplayOneChar (unsigned char X, unsigned char Y, unsigned char DData)
{
Y & = 0x1;
X & = 0xF; / / limit can not be greater than 15 X, Y can not be greater than 1
if (Y) X | = 0x40; / / if you want to display the second row address code +0 x40;
X | = 0x80; / / calculate the script
WriteCommandLCM (X, 0); / / here does not detect busy signal, send the address code
WriteDataLCM (Ddata);
}

/ / String of characters according to the specified location
void DisplayListChar (unsigned char X, unsigned char Y, unsigned char code * DData)
{
unsigned char ListLength;

ListLength = 0;
Y & = 0x1;
X & = 0xF; / / limit can not be greater than 15 X, Y can not be greater than 1
the while (Ddata listlength]> 0x20) / / If you reach the end of the string to exit
{
if (X <= 0xF) / / the X coordinates should be less than 0xF
{
DisplayOneChar (X, Y, DData [ListLength]); / / display a single character
ListLength + +;
X + +;
}
}
}

/ / 5ms delay
void Delay5Ms (void)
{
unsigned int TempCyc = 5552;
the while (TempCyc -);
}

/ / 400ms delay
void Delay400Ms (void)
{
unsigned char TempCycA = 5;
unsigned int TempCycB;
the while (TempCycA -)
{
TempCycB = 7269;
the while (TempCycB -);
};

 

С этим товаром часто покупают