Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <reg51.h>
- #define SW (~P3 & 0x1f )
- #define DBPORT P0
- sbit RS=P2^7 ;
- sbit RW=P2^6 ;
- sbit E=P2^5 ;
- 0x99 , 0x92 , 0x82 , 0xf8 ,
- 0x80 , 0x90 };
- unsigned char code scan[4] = {0xf7 , 0xfb , 0xfd , 0xfe};
- void LCD_CMD(char cmd)
- {
- char i ;
- DBPORT = cmd ;
- RS = 0;
- RW = 0;
- E = 1;
- for(i=0; i<40; i++)
- RS = 0;
- RW = 0;
- E = 0;
- }
- void LCD_DATA(char data1)
- {
- char i;
- DBPORT = data1;
- RS = 1;
- RW = 0;
- E = 1;
- for(i=0; i<40; i++)
- RS = 1;
- RW = 0;
- E = 0;
- }
- void delay1ms(char i)
- {
- char m,n;
- for(m=0; m<i; m++)
- for(n=0; n<120; n++)
- ;
- }
- void debouncer()
- {
- delay1ms(20);
- }
- char mess[]="HELLO KITTY!!";
- main()
- {
- int i=0 ;
- delay1ms(5);
- LCD_CMD(0x3f);
- LCD_CMD(0x0e);
- LCD_CMD(0x01);
- delay1ms(2);
- LCD_CMD(0x80);
- for(i=0;i<15;i++)
- LCD_DATA(mess[i]);
- while(1);
- }
Advertisement
Add Comment
Please, Sign In to add comment