自己编写的LCD源码,欢迎各位大佬指正
单片机源程序如下:
- #include "stc15.h"
- #include "LCD.h"
- sbit CS=P0^0;
- sbit SID=P0^3;
- sbit SCLK=P0^5;
- sbit PSB=P5^4;
- void delay_10us(unsigned int us)
- {
- for(;us>1;us--);
- }
- void delay_ms(unsigned int us)
- {
- int i;
- for(;us>0;us--)
- for(i=0;i<1000;i++);
- }
- void main(void )
- {
- P0M0=0x00;
- P0M1=0x00;
- P1M0=0x00;
- P1M1=0x00;
- P2M0=0x00;
- P2M1=0x00;
- P3M0=0x00;
- P3M1=0x00;
- P4M0=0x00;
- P4M1=0x00;
- P5M0=0x00;
- P5M1=0x00;
-
- Lcd_init();
- delay_10us(1);
- delay_ms(1);
- P2=0xf0;
-
- while(1)
- {
-
- display_string(1,2,"张儿子:");
- display_string(3,1,"大傻逼");
-
- delay_ms(1000);
-
- }
-
- }
复制代码
所有资料51hei提供下载:
lcd.rar
(34.88 KB, 下载次数: 6)
|