CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

delay problem with pic18f452 and 20 MHZ clock?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
arl
Guest







delay problem with pic18f452 and 20 MHZ clock?
PostPosted: Thu Feb 24, 2005 3:33 pm     Reply with quote

Hi,

I have a PIC 18f452 and 20MHZ (clock reference says M20.000D4D).

With a simple ccs c program like this:

#include <18F452.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay (clock=20000000)

void main() {
output_low(pin_a0);
delay_ms(1000); //pause 1 sec
output_high(pin_a0); //blink red led
delay_ms(5000); //pause 5 sec
output_low(pin_a0); //turn of led
}

Instruction delay never work! and cause a program malfunction (i think an infinite delay), but when I adjust use delay precompiler instruction to #use delay (clock=4000000) 4MHZ program works but delay time has not a good precision (delay_ms(1000) takes approx. 300ms).

What happens? Im sure my hardware is ok. I have 3.203 version,

Thanks!
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Feb 24, 2005 3:55 pm     Reply with quote

PCH vs. 3.203 is reported as very buggy:
http://www.ccsinfo.com/forum/viewtopic.php?t=19807
http://www.ccsinfo.com/forum/viewtopic.php?t=20561
If you email CCS tech support and can demonstrate
to them that your version is not usable, they might
let you download the current version. I don't know
that they will do it, but they might.
arl
Guest







PostPosted: Thu Feb 24, 2005 4:22 pm     Reply with quote

thanks PCM,

I update compiler and program works fine! Last version had a bug.


All around seems to be OK.


Best regards.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group