The objective of the program is to generate a 10MHz square wave at P0.3 on an LPC2119 board. Our lecturer Bryan helped me to check the code but everything seems to be correct except for the result.
Here’s the c code:
[c]
#include
int main (void)
{
IODIR0=0x0200008; //Make P0.3 and P0.21 to be output port
IOCLR0=0x1<<21; //Lit the LED on P0.21
PINSEL0=0x80; //Choosing P0.3 to be Timer0 Match0
T0TCR=2; //Reset the timer0
T0PR=0; //Set pre-scaler to 1
T0MR0=1; //Set match0 to 1
T0EMR=0x30; //Toggle pin when match
T0MCR=0x3; //Reset timer0 when match
T0TCR=1; //Start timer0
while(1) //Endless loop
{}
}
[/c]
As a result, the LED was on but there's no wave coming from P0.3. Bryan told me that in terms of getting full mark in the test, this program will just work because nothing's wrong. However, another group of student managed to generate the wave using timer1. So it must be that we've missed something very silly