Guest User

Untitled

a guest
May 20th, 2018
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. // Autor: dr inz. Krzysztof Murawski
  2. #include <REGX52.H>
  3.  
  4. extern void LcdInit();
  5. extern void LcdWelcome() reentrant;
  6. extern void Lcd_Cursor (char row, char column);
  7. extern void Lcd_DisplayCharacter (char a_char);
  8. extern void Lcd_DisplayString (char row, char column, char *string) reentrant;
  9. extern void Lcd_WriteControl (unsigned char LcdCommand);
  10.  
  11. unsigned char data Var1, Var2, Var3;
  12. unsigned char data i = 1;
  13. unsigned char data j = 1;
  14. unsigned char data traj,r,k;
  15. unsigned char data czysta = ' ';
  16.  
  17. volatile unsigned char data Bufor[] = {"Wozniakowski"};
  18.  
  19. void button1() interrupt 0
  20. {
  21. Lcd_WriteControl(0x01);
  22. i++;
  23. if(i == 17)
  24. {
  25. i = 1;
  26. j++;
  27. if(j == 5) j=1;
  28. }
  29. i = r;
  30. j = k;
  31. for(traj = 0; traj < (sizeof(Bufor)/sizeof(char)-1); traj++)
  32. {
  33. Lcd_Cursor(r,k);
  34. Lcd_DisplayCharacter(Bufor[traj]);
  35. r++;
  36. if(r == 17)
  37. {
  38. r = 1;
  39. k++;
  40. if(k == 5) k=1;
  41. }
  42. }
  43. }
  44.  
  45.  
  46.  
  47.  
  48. void button2() interrupt 2
  49. {
  50. Lcd_Cursor(i,j);
  51. Lcd_DisplayCharacter(czysta);
  52. j--;
  53. if(j == 0)
  54. {
  55. j = 16;
  56. i--;
  57. if( i == 0) i=4;
  58. }
  59. Lcd_Cursor(i,j);
  60. Lcd_DisplayCharacter(traj);
  61. }
  62.  
  63. void Init(void)
  64. {
  65. EX0 = 1;
  66. IT0 = 1;
  67. EX1 = 1;
  68. IT1 = 1;
  69. EA = 1;
  70. }
  71.  
  72. void main(void)
  73. {
  74. LcdInit(); // Zainicjowanie rejestrów wyœwietlacza LCD
  75. Init();
  76. LcdWelcome(); //uzyte by pozbyc sie bledow L57
  77. Lcd_WriteControl(0x01); //uzyte by pozbyc sie bledow L57
  78. Lcd_DisplayString(1,1,Bufor);
  79. while(1) {;}
  80. }
Advertisement
Add Comment
Please, Sign In to add comment