We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello! I've a little problem with my program... I'm working on the board EB40A (AT91R40008). This is a code of my simple program:/
#include <stdio.h> #include <91R40008.H>/* AT91R40008 Definitions */ #include <tc.h> #include <pio.h> #ifdef ERAM /* Store in Flash, Run in RAM */ #define _atr __ram #else #define _atr #endif void fala(void) { unsigned int i; //1 for(i=0x00000010;i<<0x00008000;i>>=1) { PIO_SODR = i; while((TC2_SR&0x00000001) == 0x00000000){}; PIO_CODR = i; } //4 for(i=0x00000040;i>0x00000004;i>>=1) { PIO_SODR = i; while((TC2_SR&0x00000001) == 0x00000000){}; PIO_CODR = i; } } int main (void) { /* Main Program */ TC2_CMR = TC_CLKS_MCK32; TC2_CCR = TC_CLKEN; PIO_PER = 0x000F0078; PIO_OER = 0x000F0078; while((PIO_PDSR&0x00000002) == 0x00000000){}; while((PIO_PDSR&0x00000002) == 0x00000002){}; TC2_CCR = TC_SWTRG; PIO_SODR = 0x00000008; while((TC2_SR&0x00000001) == 0x00000000){}; PIO_CODR = 0x00000008; while(1) { TC2_CMR = TC_CLKS_MCK32; while((PIO_PDSR&0x00000004) == 0x00000000){fala();} while((PIO_PDSR&0x00000004) == 0x00000004){fala();} TC2_CMR = TC_CLKS_MCK8; while((PIO_PDSR&0x00000004) == 0x00000000){fala();} while((PIO_PDSR&0x00000004) == 0x00000004){fala();} TC2_CMR = TC_CLKS_MCK2; while((PIO_PDSR&0x00000004) == 0x00000000){fala();} while((PIO_PDSR&0x00000004) == 0x00000004){fala();} } }