This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

LPC23xx Initialize timer for GPIO toggling timing

Hi all,

Can someone explain the following code,kindly explain line by line.Since i'm new to hardware programming.

/* Initialize timer for GPIO toggling timing */ enable_timer( 0 );

counter = 0; FIO2SET = 1 << counter; // #define FIO2SET (*(volatile unsigned long *)(FIO_BASE_ADDR + 0x58)) while ( 1 ) { if ( timer0_counter >= (0x20 * counter) ) { FIO2SET = 1 << counter; counter++; if ( counter > 8 ) { counter = 0; timer0_counter = 0; FIO2CLR = 0x000000FF; } } } return 0;
}

Chethan

Parents
  • Well it really doesn't show much in the way of timer initialization code, now does it?

    The function of the code, from a cursory analysis, would appear to enable 8 GPIO bits in sequence, with a delay multiple of 32 ticks between each, and when all bits are enabled, it then clears them and starts over.

Reply
  • Well it really doesn't show much in the way of timer initialization code, now does it?

    The function of the code, from a cursory analysis, would appear to enable 8 GPIO bits in sequence, with a delay multiple of 32 ticks between each, and when all bits are enabled, it then clears them and starts over.

Children
No data