Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "AT91SAM9263.h"
- void dbgu_print_ascii(){}
- int main(void){
- //AT91C_BASE_PIOB
- volatile int i = 0;
- volatile int j = 0;
- AT91C_BASE_PMC->PMC_PCER = (1 << AT91C_ID_PIOCDE ); // clock
- AT91C_BASE_PIOB->PIO_OER = AT91C_PIO_PB8;
- AT91C_BASE_PIOB->PIO_PER = AT91C_PIO_PB8;
- AT91C_BASE_PIOC->PIO_OER = AT91C_PIO_PC29;
- AT91C_BASE_PIOC->PIO_ODR = (AT91C_PIO_PC4 | AT91C_PIO_PC5);
- AT91C_BASE_PIOC->PIO_PER = (AT91C_PIO_PC4 | AT91C_PIO_PC5 | AT91C_PIO_PC29);
- AT91C_BASE_PIOC->PIO_PPUER = (AT91C_PIO_PC4 | AT91C_PIO_PC5);
- AT91C_BASE_PIOC->PIO_IFER = (AT91C_PIO_PC4 | AT91C_PIO_PC5);
- while(1){
- if (! ( (AT91C_BASE_PIOC->PIO_PDSR) & (AT91C_PIO_PC5)) ){
- AT91C_BASE_PIOC->PIO_CODR = AT91C_PIO_PC29; }
- if (! ( (AT91C_BASE_PIOC->PIO_PDSR) & (AT91C_PIO_PC4)) ){
- AT91C_BASE_PIOC->PIO_SODR = AT91C_PIO_PC29; }
- while (j <= 655000) {j++;}
- AT91C_BASE_PIOB->PIO_SODR = AT91C_PIO_PB8; // gasi
- while (i <= 655000){ i++;}
- AT91C_BASE_PIOB->PIO_CODR = AT91C_PIO_PB8; // zapala
- j = 0;
- i = 0;
- }
- }
Add Comment
Please, Sign In to add comment