Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Autor: dr inz. Krzysztof Murawski
- #include <REGX52.H>
- extern void LcdInit();
- extern void LcdWelcome() reentrant;
- extern void Lcd_Cursor (char row, char column);
- extern void Lcd_DisplayCharacter (char a_char);
- extern void Lcd_DisplayString (char row, char column, char *string) reentrant;
- extern void Lcd_WriteControl (unsigned char LcdCommand);
- unsigned char data Var1, Var2, Var3;
- unsigned char data i = 1;
- unsigned char data j = 1;
- unsigned char data traj,r,k;
- unsigned char data czysta = ' ';
- volatile unsigned char data Bufor[] = {"Wozniakowski"};
- void button1() interrupt 0
- {
- Lcd_WriteControl(0x01);
- i++;
- if(i == 17)
- {
- i = 1;
- j++;
- if(j == 5) j=1;
- }
- i = r;
- j = k;
- for(traj = 0; traj < (sizeof(Bufor)/sizeof(char)-1); traj++)
- {
- Lcd_Cursor(r,k);
- Lcd_DisplayCharacter(Bufor[traj]);
- r++;
- if(r == 17)
- {
- r = 1;
- k++;
- if(k == 5) k=1;
- }
- }
- }
- void button2() interrupt 2
- {
- Lcd_Cursor(i,j);
- Lcd_DisplayCharacter(czysta);
- j--;
- if(j == 0)
- {
- j = 16;
- i--;
- if( i == 0) i=4;
- }
- Lcd_Cursor(i,j);
- Lcd_DisplayCharacter(traj);
- }
- void Init(void)
- {
- EX0 = 1;
- IT0 = 1;
- EX1 = 1;
- IT1 = 1;
- EA = 1;
- }
- void main(void)
- {
- LcdInit(); // Zainicjowanie rejestrów wyœwietlacza LCD
- Init();
- LcdWelcome(); //uzyte by pozbyc sie bledow L57
- Lcd_WriteControl(0x01); //uzyte by pozbyc sie bledow L57
- Lcd_DisplayString(1,1,Bufor);
- while(1) {;}
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement