Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // LCD module connections
- sbit LCD_RS at P2_4_bit; //+
- sbit LCD_EN at P2_6_bit; //+
- sbit LCD_RW at P2_5_bit; //+
- sbit LCD_CS1B at P2_2_bit; //+
- sbit LCD_CS2B at P2_3_bit; //+
- sbit LCD_RST at P2_7_bit; //0
- sbit LCD_D0 at P0_0_bit;
- sbit LCD_D1 at P0_1_bit;
- sbit LCD_D2 at P0_2_bit;
- sbit LCD_D3 at P0_3_bit;
- sbit LCD_D4 at P0_4_bit;
- sbit LCD_D5 at P0_5_bit;
- sbit LCD_D6 at P0_6_bit;
- sbit LCD_D7 at P0_7_bit;
- // End LCD module connections
- char txt4[] = "example"; // Loop variable
- int wrProc(char my_data) {
- LCD_EN = 0;
- LCD_RW = 0;
- P0 = my_data;
- LCD_EN = 1;
- return 1;
- }
- int wrCommand(char my_data){
- LCD_RS = 0;
- return wrProc(my_data);
- }
- int wrData(char my_data){
- LCD_RS = 1;
- return wrProc(my_data);
- }
- int isBusy () {
- if(LCD_D7 == 1)
- return 1;
- return 0;
- }
- int init() {
- LCD_EN = 1;
- LCD_RW = 1;
- LCD_CS1B = 1;
- LCD_CS2B = 1;
- P0 = 255;
- return 1;
- }
- int index;
- char my_data = 0x1;
- void main(){
- P0 = 255;
- LCD_CS2B = 1;
- // init();
- while(1) {
- // wrCommand(255);
- // wrData(0);
- LCD_CS1B=0;
- wrCommand(0x3f); //display on
- Delay_ms(50);
- wrCommand(0x40); // set addr 0
- Delay_ms(50);
- wrCommand(0xb9); //set page 0
- Delay_ms(50);
- wrCommand(0xc0); //display start line 0
- Delay_ms(50);
- for(index = 0; index < 64; index++){
- wrData(my_data);
- my_data= my_data << 1;
- Delay_ms(100);
- }
- LCD_CS1B=1;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement