Advertisement
MSlomiany

Grzybu 1

Oct 24th, 2019
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.96 KB | None | 0 0
  1. #include <c8051f330.h>  //biblioteka opisujaca adresy portow procesora
  2.  
  3. //Funkcja opozniajaca
  4. void delay(){
  5.     unsigned int i;
  6.     for(i=0; i<3000; i++)
  7.     {
  8.     }
  9. }
  10. /***Funkcja glowna***/
  11. /*
  12. void maska(int n){
  13.     switch(n)
  14.         case 1:
  15.            
  16.     }
  17. */
  18. void main()
  19. {
  20.     //Blok inicjalizacji procesora
  21.     PCA0MD &= ~0x40;    //Wylaczenie watchdoga - faza 1
  22.     PCA0MD  = 0x00;     //Wylaczenie watchdoga - faza 2
  23.     XBR1        = 0x40;     //Wlaczenie crossbara
  24.     //Datasheet dostepny zawsze
  25.     /*Odwrócenie zasilania Vcc--->[dioda]---->[port]
  26.     powoduje, ze przez procesor nie plynie prad*/
  27.    
  28.     //Petla glowna programu
  29.     while(1)
  30.     {
  31.         P0 = 0x81;
  32.         delay();
  33.         P0 = 0x42;
  34.         delay();
  35.         P0 = 0x24;
  36.         delay();
  37.         P0 = 0x18;
  38.         delay();
  39.         P0 = 0x24;
  40.         delay();
  41.         P0 = 0x42;
  42.         delay();
  43.         P0 = 0x81;
  44.         delay();
  45.     }  
  46. } //koniec main()
  47. /***Koniec funkcji glownej***/
  48.  
  49. /***
  50.         zalozyc projekt na wybrany mikrokomputer
  51.         zeby chodzilo na debbugerze
  52.         biblioteki beda podane
  53.         zapalanie diodek
  54. ***/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement