kkatesuda
Joined: 09 Sep 2006 Posts: 8
|
18F24j10 Delay time Error |
Posted: Fri Sep 07, 2007 5:28 am |
|
|
I use PIC 18F24j10 with CCS 3.249 and MPLAPIDE 7.4
I try to use 18F24j10 with 20MHz Crytal and simple code like this
Code: | #include <18F24j10.h>
#fuses PRIMARY, HS,NOSTVREN,PROTECT,NOFCMEN,NOFCMEN,NOIESO, NOWDT
#use delay(clock=20000000)
#define LED_Load Pin_B4
void main(){
while(True){
Output_low(LED_Load);
delay_us(500);
Output_high(LED_Load);
delay_us(500);
}
} |
The problem is , I try to delay_ms(1000) for delay 1 second but it very long and long time no any change. So I try to change delay and finally set it to delay_us(500). Everything it ok, delay time is 1 second. I don't know why. I try to change this crytal to other pic path no(PIC18F86j15) , everything ok speed correctly. I assambly new broad and new path for 3 units and testing the problem it same.
I'm not sure, can problem on MPLAB configulation bit ? I configulation like this.
Watchdog Timer Enable : Disable
Stack Overflow Reset Enable : Disable
Enhanced CPU Enable : Disable
Code Protect Enable : Enable
Oscillator Select : HS OSC
Default/Reset System Clock Select : Clock Select by FOSC
Fail Safe Monitor Clock Enable : Enable
Internal External Switch Over Enable : Disable
Watchdog Timer Postscale : 1:32,768
CCP2 Mux : CCP2 I/O Muxed with RC1
Please advice me. How to do it with corretly. |
|