View previous topic :: View next topic |
Author |
Message |
cerr
Joined: 10 Feb 2011 Posts: 241 Location: Vancouver, BC
|
delay |
Posted: Wed Feb 16, 2011 1:36 pm |
|
|
Hi,
I'm very new to using CCS and in fact this is my first day utilizing it.
I loaded the led flash application but it seems like my delay is 10 times to slow e.g. 100ms delay is giving me in fact a 1second pulse...
I do use a 10MHz crystal (the one that comes on the PIC18 explorer board from Microchip).
I don't understand as I'm not using any kind of prescaler or something.
The code:
Code: |
#include <18F8722.h>
#device ICD=TRUE
#device adc=16
#FUSES NOWDT //No Watch Dog Timer
#FUSES WDT128 //Watch Dog Timer uses 1:128 Postscale
#FUSES LP //Low power osc < 200 khz
#FUSES NOBROWNOUT //No brownout reset
#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES BBSIZ1K //1K words Boot Block size
#FUSES NOXINST //Extended set extension and Indexed Addressing mode disabled (Legacy mode)
#use delay(clock=10000000)
#define LED PIN_D0
#define DELAY 100
void main()
{
setup_timer_4(T4_DISABLED,0,1);
//Example blinking LED program
while(true){
output_low(LED);
delay_ms(DELAY);
output_high(LED);
delay_ms(DELAY);
}
}
|
Thanks for hints! |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Feb 16, 2011 1:43 pm |
|
|
Quote: | #FUSES LP //Low power osc < 200 khz
#use delay(clock=10000000)
I do use a 10MHz crystal
|
Look in the PIC data sheet, in the oscillator section, to see the correct
fuse setting for a 10 MHz crystal. |
|
|
cerr
Joined: 10 Feb 2011 Posts: 241 Location: Vancouver, BC
|
|
Posted: Wed Feb 16, 2011 1:59 pm |
|
|
PCM programmer wrote: | Quote: | #FUSES LP //Low power osc < 200 khz
#use delay(clock=10000000)
I do use a 10MHz crystal
|
Look in the PIC data sheet, in the oscillator section, to see the correct
fuse setting for a 10 MHz crystal. |
Exactly, that did the trick,
Thank you bud, for that hint! |
|
|
|