H
hbaocr
Guest
kan du vise mig mit problem
når jeg indlæse programmet i min UC til at styre mit LCD 16x2
, at LCD dislay BAO i starten, og hvis jeg nulstille eller belastning, at programmet i UC andet, LCD dislay BAOBAO, og den tredje BAOBAOBAO ........
kan du vise mig som problem jeg har, og hvordan kan jeg løse det for at vise min LCD: BAO om hver gang, når jeg nulstiller eller genindlæse mit program
Jeg bruger AT89S52
tak
Code:
# include "REG52.H"
/ / Definere nogle nødvendige variant
sbit RS = P1 ^ 0;
sbit RW = P1 ^ 1;
sbit DA = P1 ^ 2;
sbit travlt = P3 ^ 7;
/ / Tegn dislay
# define CHU_A 0x41
# define CHU_B 0x42
# define CHU_C 0x43
# define CHU_D 0x44
# define CHU_E 0x45
# define CHU_F 0x46
# define CHU_G 0x47
# define CHU_H 0x48
# define CHU_I 0x49
# define CHU_J 0x4A
# define CHU_K 0x4B
# define CHU_L 0x4C
# define CHU_M 0x4D
# define CHU_N 0x4E
# define CHU_O 0x4F
# define CHU_P 0x50
# define CHU_Q 0x51
# define CHU_R 0x52
# define CHU_S 0x53
# define CHU_T 0x54
# define CHU_U 0x55
# define CHU_V 0x56
# define CHU_W 0x57
# define CHU_X 0x58
# define CHU_Y 0x59
# define CHU_Z 0x5A
# define KT 0x20
/ /
# define DATA P3
/ / erklære min fundtion
void WAIT_LCD (void);
void INT_LCD (void);
void WR_LCD (usignerede CHAR TXT);
void CLR_LCD (void);
void HOME_LCD (void);
/ / main-programvoid Main (void)
(
HOME_LCD ();
INT_LCD ();
CLR_LCD ();
WR_LCD (CHU_B);
WR_LCD (CHU_A);
WR_LCD (CHU_O);
mens (1);
)//================================================ ==
void WAIT_LCD (void)
(
DATA = 0xFF;
DA = 1;
RW = 1;
RS = 0 / / kommando
while (optaget)
;
DA = 0;
RW = 0;
)
//================================================ ==
void INT_LCD (void)
(
/ / funktionen er 8 col 2 rækken, 5x7 dot format
DA = 1;
RS = 0;
DATA = 0x38;
DA = 0;
WAIT_LCD ();
/ / Dislay ON / OFF CURSOR Shift
/ / Dislay ON, Markør Underline om, markøren blinker off
DA = 1;
RS = 0;
DATA = 0x0E;
DA = 0;
WAIT_LCD ();
/ / Set Charracter Mode
/ / Tilvækst (dich FAI), Dislay Shift Off
DA = 1;
RS = 0;
DATA = 0x06;
DA = 0;
WAIT_LCD ();
)
//================================================ =======void WR_LCD (usignerede CHAR TXT)
(
RS = 1;
DA = 1;
DATA = TXT;
DA = 0;
WAIT_LCD ();
)
void CLR_LCD (void)
(
DA = 1;
RS = 0;
DATA = 0x01;
DA = 1;
WAIT_LCD ();
)
void HOME_LCD (void)
(DA = 1;
RS = 0;
DATA = 0X02;
DA = 1;
WAIT_LCD ();
)
når jeg indlæse programmet i min UC til at styre mit LCD 16x2
, at LCD dislay BAO i starten, og hvis jeg nulstille eller belastning, at programmet i UC andet, LCD dislay BAOBAO, og den tredje BAOBAOBAO ........
kan du vise mig som problem jeg har, og hvordan kan jeg løse det for at vise min LCD: BAO om hver gang, når jeg nulstiller eller genindlæse mit program
Jeg bruger AT89S52
tak
Code:
# include "REG52.H"
/ / Definere nogle nødvendige variant
sbit RS = P1 ^ 0;
sbit RW = P1 ^ 1;
sbit DA = P1 ^ 2;
sbit travlt = P3 ^ 7;
/ / Tegn dislay
# define CHU_A 0x41
# define CHU_B 0x42
# define CHU_C 0x43
# define CHU_D 0x44
# define CHU_E 0x45
# define CHU_F 0x46
# define CHU_G 0x47
# define CHU_H 0x48
# define CHU_I 0x49
# define CHU_J 0x4A
# define CHU_K 0x4B
# define CHU_L 0x4C
# define CHU_M 0x4D
# define CHU_N 0x4E
# define CHU_O 0x4F
# define CHU_P 0x50
# define CHU_Q 0x51
# define CHU_R 0x52
# define CHU_S 0x53
# define CHU_T 0x54
# define CHU_U 0x55
# define CHU_V 0x56
# define CHU_W 0x57
# define CHU_X 0x58
# define CHU_Y 0x59
# define CHU_Z 0x5A
# define KT 0x20
/ /
# define DATA P3
/ / erklære min fundtion
void WAIT_LCD (void);
void INT_LCD (void);
void WR_LCD (usignerede CHAR TXT);
void CLR_LCD (void);
void HOME_LCD (void);
/ / main-programvoid Main (void)
(
HOME_LCD ();
INT_LCD ();
CLR_LCD ();
WR_LCD (CHU_B);
WR_LCD (CHU_A);
WR_LCD (CHU_O);
mens (1);
)//================================================ ==
void WAIT_LCD (void)
(
DATA = 0xFF;
DA = 1;
RW = 1;
RS = 0 / / kommando
while (optaget)
;
DA = 0;
RW = 0;
)
//================================================ ==
void INT_LCD (void)
(
/ / funktionen er 8 col 2 rækken, 5x7 dot format
DA = 1;
RS = 0;
DATA = 0x38;
DA = 0;
WAIT_LCD ();
/ / Dislay ON / OFF CURSOR Shift
/ / Dislay ON, Markør Underline om, markøren blinker off
DA = 1;
RS = 0;
DATA = 0x0E;
DA = 0;
WAIT_LCD ();
/ / Set Charracter Mode
/ / Tilvækst (dich FAI), Dislay Shift Off
DA = 1;
RS = 0;
DATA = 0x06;
DA = 0;
WAIT_LCD ();
)
//================================================ =======void WR_LCD (usignerede CHAR TXT)
(
RS = 1;
DA = 1;
DATA = TXT;
DA = 0;
WAIT_LCD ();
)
void CLR_LCD (void)
(
DA = 1;
RS = 0;
DATA = 0x01;
DA = 1;
WAIT_LCD ();
)
void HOME_LCD (void)
(DA = 1;
RS = 0;
DATA = 0X02;
DA = 1;
WAIT_LCD ();
)