A
abbas1707
Guest
Hrála jsem si s ks0108 LCD Proteus pomocí 89c51.jsem schopen zapisovat data, fonty a obrázky na LCD.ale já dotírat přečíst data z displeje RAM.
Zde je kód pro čtení dat z LCD
Kód:Kód:# Include <reg51.h>sbit rs = P3 ^ 3;
sbit rw = P3 ^ 2;
sbit en = P3 ^ 1;
sbit CS1 = P3 ^ 5;
sbit CS2 = P3 ^ 4;neplatné zpoždění ()
(
int k, l;
pro (k = 0; k <3, K )
pro (l = 0; l <50; l );
)
neplatné sendCommand (unsigned char val)
(
P1 = val;
rs = 0;
rw = 0;
en = 1;
en = 0;
)
neplatné sendByte (unsigned char dat)
(P1 = dat;
rs = 1;
rw = 0;
en = 1;
en = 0;
)
neplatné readByte ()
(P1 = 0xFF;
rs = 1;
rw = 1;
zpoždění ();
en = 1;
zpoždění ();
en = 0;
P2 = P1;
)void main ()
(
while (1)
(
CS1 = 0;
sendCommand (0x40);
sendCommand (0xb8);
sendByte (0xf4);
sendCommand (0x40);
sendCommand (0xb8);
readByte ();
readByte ();
)
)
Zde je kód pro čtení dat z LCD
Kód:Kód:# Include <reg51.h>sbit rs = P3 ^ 3;
sbit rw = P3 ^ 2;
sbit en = P3 ^ 1;
sbit CS1 = P3 ^ 5;
sbit CS2 = P3 ^ 4;neplatné zpoždění ()
(
int k, l;
pro (k = 0; k <3, K )
pro (l = 0; l <50; l );
)
neplatné sendCommand (unsigned char val)
(
P1 = val;
rs = 0;
rw = 0;
en = 1;
en = 0;
)
neplatné sendByte (unsigned char dat)
(P1 = dat;
rs = 1;
rw = 0;
en = 1;
en = 0;
)
neplatné readByte ()
(P1 = 0xFF;
rs = 1;
rw = 1;
zpoždění ();
en = 1;
zpoždění ();
en = 0;
P2 = P1;
)void main ()
(
while (1)
(
CS1 = 0;
sendCommand (0x40);
sendCommand (0xb8);
sendByte (0xf4);
sendCommand (0x40);
sendCommand (0xb8);
readByte ();
readByte ();
)
)