- 13
- 0
- 约8.04千字
- 约 20页
- 2017-06-10 发布于河南
- 举报
单片机C语言_1602液晶显示器上显示24c02储存数据(国外英文资料)
单片机C语言_1602液晶显示器上显示24c02储存数据(国外英文资料)
/ * * * * * * * * * * * * * * * * * * * * * include the header file * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
# include reg52. H
# include intrins. H
# define uchar unsigned char
# define uint unsigned int
/ * * * * * * * * * * * * * * * * * * * * * definition LCD port * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/ * LCD RS, RW, EN are P2.6, P2.5, P2.7 port * /
/ * P0.0 - port D0 - D7 * /
The sda and SCL terminals of / * 24c02 are followed by P2.0 and P2.1 * /
/ * 24c02 VCC terminal + 5V, GND, A0, A1, A2, and WP are all GND * /
/ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
Sbit LCD_RS = P2 ^ 6;
Sbit LCD_RW = P2 ^ 5;
Sbit LCD_EN = P2 ^ 7;
Sbit sda = P2 ^ 0;
Sbit SCL = P2 ^ 1;
/ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/ * * /
/ * delay subroutine * /
/ * * /
/ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
# define delayNOP (); {_nop_ (); _nop_ (); _nop_ (); _nop_ (); };
Void delay2 ()
{; }
Void delay (uchar x)
{uchar j;
While (x -)! = 0)
{for (j = 0; j 125; j + +)
{; }
}
}
Void delay1 (uchar x)
{
Uchar a, b;
For (a = x; a ; a --)
B is equal to 100.
}
/ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/ * * /
24 our fleet set * / / * memory chips
/ * * /
/ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
Void start () / / start signal
{
Sda = 1;
Delay2 ();
SCL = 1;
Delay2 ();
Sda = 0;
Delay2 ();
}
Void stop () / / stop signal
{
Sda = 0;
Delay2 ();
SCL = 1;
Delay2 ();
Sda = 1;
Delay2 ();
}
Void respons () / / reply signal
{
Uchar I;
SCL = 1;
Delay2 ();
While (sda = = 1) (I 250)) / / sda is the default reply aft
原创力文档

文档评论(0)