/* LPC21xx / ARM7: timer-based LED toggle on P0.7 */
#include <lpc21xx.h>

void timer0_delay_ms(unsigned int ms) {
    T0TCR = 0x02;
    T0PR = 14999;
    T0MR0 = ms;
    T0MCR = 0x04;
    T0TC = 0;
    T0TCR = 0x01;
    while (T0TC < ms);
    T0TCR = 0x00;
}

int main(void) {
    IO0DIR |= 0x00000080;
    while (1) {
        IO0SET = 0x00000080;
        timer0_delay_ms(500);
        IO0CLR = 0x00000080;
        timer0_delay_ms(500);
    }
}
