Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
#include <htc.h> // Required to interface with delay routines
#ifndef _XTAL_FREQ
// Unless already defined assume 4MHz system frequency
// This definition is required to calibrate __delay_us() and __delay_ms()
#define _XTAL_FREQ 4000000
#endif
/** demonstration of various built-in delay mechanisms */
void main(void){
while(1){
NOP();
_delay(1000); // delay for 1000 instruction cycles
CLRWDT();
__delay_us(400); // delay for 400 microseconds
CLRWDT();
__delay_ms(2); // delay for 2 milliseconds
CLRWDT();
}
}
my compiler don't understand _delay_ms();