Hello everyone!
I just started to learn PIC32 programming with a PIC32 Ethernet Starter kit. I wanted to blink its led, 1 second on - 1 second off.
Here is the code for the delay:
#define USHORT unsigned short
void delayMs(USHORT milisec) {
T1CON = 0x8010;
TMR1 = 0x00;
USHORT i = 0;
PR1 = 0x40;
while(i != milisec) {
while(TMR1) {
}
i++;
TMR1 = 0x00;
}
T1CON = 0x00;
return;
}
It just works (or it looks like to work, I haven't measured it with an oscilloscope, just with a "stopwatch") and I don't know why. Can someone explain me?
The datasheet of the kit:
http://ww1.microchip.com/downloads/en/DeviceDoc/61166A.pdf
The datasheet of its PIC:
http://ww1.microchip.com/downloads/en/devicedoc/60001156j.pdf
