PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Mar 21, 2008 6:31 pm |
|
|
Use whatever crystal frequency that you desire. Put the frequency
into the #use delay() statement. Then the compiler will automatically
create the code to make the delay_ms(1000) be for one second.
Example for a 4 MHz crystal:
Code: | #include <16F877.H>
#fuses XT, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock = 4000000)
//===================================
void main()
{
while(1)
{
output_high(PIN_B0);
delay_ms(1000);
output_low(PIN_B0);
delay_ms(1000);
}
} |
|
|