Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ///////////////////////////////////////////////////////////////////////////////////
- #include <REGX51.H>
- unsigned char code Tab[] = {0xEF,0xDF,0xBF,0x7F};
- void czekaj()
- {
- int i;
- for (i=0;i<100;i++){;}
- }
- void main (void)
- {
- volatile unsigned char data ind = 0;
- int bufor[20];
- int a=0;
- int wynik,i;
- for(;;)
- {
- P2 = Tab[ind];
- if(P2_3 == 0 && P2_7 == 0)
- {
- P0_0=0;
- czekaj();
- P0_0=1;
- for(i=0;i<a+1;i++){
- wynik += bufor[i];
- }
- P1=wynik;
- }
- else if(P2_3==0 && P2_4==0)
- {
- bufor[a]=1;
- a++;
- P0_0=0;
- czekaj();
- P0_0=1;
- }
- else if(P2_2==0 && P2_4==0)
- {
- bufor[a]=2;
- a++;
- P0_0=0;
- czekaj();
- P0_0=1;
- }
- else if(P2_1==0 && P2_4==0)
- {
- bufor[a]=3;
- a++;
- P0_0=0;
- czekaj();
- P0_0=1;
- }
- ind++;
- if (ind == 4) {ind = 0;}
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement