My First ARM Program
HI,
This code was finished few weeks ago, but because I need to read a lot materials about ARM and IAR and I need wait my wiggler work, so that I release it now.
// Include Standard files
#include “Board.h”
void wait (unsigned int time )
{
//* Begin
unsigned int waiting_time;
for(waiting_time = 0; waiting_time < time; waiting_time++) ;
}//* End
const int led_mask[8]= {LED1, LED2, LED3};
int main() {
AT91F_PMC_EnablePeriphClock ( AT91C_BASE_PMC, 1 << AT91C_ID_PIOA ) ;
// then, we configure the PIO Lines corresponding to LED1 to LED4
// to be outputs. No need to set these pins to be driven by the PIO because it is GPIO pins only.
AT91F_PIO_CfgOutput( AT91C_BASE_PIOA, LED_MASK ) ;
// Clear the LED’s. On the EB55 we must apply a “1″ to turn off LEDs
AT91F_PIO_SetOutput( AT91C_BASE_PIOA, LED_MASK ) ;
for (;;)
{ AT91F_PIO_SetOutput( AT91C_BASE_PIOA, LED_MASK );
wait(5000000);
AT91F_PIO_ClearOutput( AT91C_BASE_PIOA, LED_MASK) ;
wait(5000000);
}
// End for
}