Seek the guidance of the single-chip microcomputer, LCD12864 is generally not 20 pins?
Author:Yang Yun Time:2021-07-19 15:47 Browse(201)
Leda: backlight power supply positive pole, negative pole connected to VSS (common grounding)
Leda: backlight power supply positive pole, negative pole connected to VSS (common ground).
VSS: ground terminal.
VDD: power supply terminal (usually + 5V.

Seek the guidance of the single-chip microcomputer, LCD12864 is generally not 20 pins?

some are + 8V).
Si: serial data line.
SCL: serial clock line.
A0: Address / data selection terminal (0-write instruction or address; 0-write instruction or address; 0-write instruction or address); 1-write data).
RST: reset terminal (generally low effective).
but there are exceptions).
CS: chip selection terminal (chip enable terminal).
generally low effective).
.
the operation method is the same as that of ordinary full duplex serial port.
but different from that of IIC.
.
the following drivers are for reference only.
(please modify them according to your LCD instructions):
.
// 52 series header file.
? Include // Include_ nop_(); Function header file.
.
sbit CS=P2 ^ 3; // Chip selector.
low level active .
sbit RES=P2^4; // Reset end.
low level is valid.
sbit Si=P2 ^ 5; // Serial data line.
sbit SCL=P2 ^ 6; // Serial clock line.
sbit A0=P2 ^ 7; // Address / data selection terminal.
.
void delaynop () // The delay time is about 10us.
the results show that the delay time is about 10us{.
_ nop_(); // Each empty cycle is about 2.5 us.
the results show that each empty cycle is about 2.5 us _ nop_();.
_ nop_();.
_ nop_();.
}.
.
void Write_ Command(uchar c) // Write command function (with command parameters).
{.
1 uchar i; // Define the loop variable I.
1 SCLK=0; // Pull down the clock line level.
prepare to write.
CS=0; // The film selection is valid.
the film selection is valid A0=0; // Select write instruction or address.
select write instruction or address DelayNOP(); // Delay a little.
0 for(i=0; i<8; i++) // Loop 8 times.
the serial port sends a byte.
the serial port sends a byte {.
c<<=1; // The instruction byte moves one bit to the left each time.
the highest bit enters CY.
the instruction byte moves one bit to the left each time SDA=CY; // The value of CY bit is sent to the serial data line SCLK=1; // Pull up the clock line level.
write on rising edge.
write on rising edge DelayNOP(); // Delay a little.
0 SCLK=0; // Lower the clock line level.
stop writing.
stop writing }.
DelayNOP(); // Delay a little.
0CS=1; // Close the selection.
}.
.
void write_ Data(uchar d) // Write data function (with data parameter).
{.
1 uchar i; // The definition of cyclic variable.
the definition of cyclic variable SCLK=0; // Pull down the clock line level.
prepare to write.
CS=0; // The film selection is valid.
the film selection is valid A0=1; // Select write data.
select write data DelayNOP(); // Delay a little.
0 for(i=0; i<8; i++) // Loop 8 times.
the serial port sends a byte.
the serial port sends a byte {.
d<<=1; // The data byte is shifted to the left by one bit each time.
the highest bit enters CY.
the data byte is shifted to the left by one bit each time SDA=CY; // The value of CY bit is sent to the serial data line SCLK=1; // Pull up the clock line level.
write on rising edge.
write on rising edge DelayNOP(); // Delay a little.
0 SCLK=0; // Lower the clock line level.
stop writing.
stop writing }.
DelayNOP(); // Delay a little.
0 CS=1; // Close the movie selection.
}.
.
void init_ LCD() // LCD module initialization function{.
RES=0; // Reset chip DelayMS(10); // The delay time is 10ms.
the results show that there is no significant difference between the two methods RES=1; // The reset was completed.
conclusion: this method is simple and reliable Write_ Command(0xa2); // Write command:.
1 Write_ Command(0xa0); // Write command:.
1 Write_ Command(0xc8); // Write command:.
1 Write_ Command(0x27); // Write command:.
1 Write_ Command(0x81); // Write command:.
1 Write_ Command(0x1b); // Write command:.
1 Write_ Command(0x2c); // Write command:.
1 Write_ Command(0x2e); // Write command:.
1 Write_ Command(0x2f); // Write command:.
1 Write_ Command(0xa4); // Write command:.
1 Write_ Command(0xaf); // Write command:.
}.
12864 has two input and output modes.
one is parallel db0-db7 data port, and the other is serial. Only clock line and data line are needed, so there are fewer pins.
.
.
there are two input and output modes for 12864
Related topics