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_ms wrong time execution

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



Joined: 17 May 2013
Posts: 8

View user's profile Send private message

delay_ms wrong time execution
PostPosted: Fri May 17, 2013 2:48 pm     Reply with quote

a couple of days I'm trying ccs, but tests have been somewhat unproductive, I'm trying to make a basic code test, something simple like a flashing LED, but delay_ms time base does not work properly ...

Annex the code:

Code:
#include <18F2550.h>
#fuses HS,NOWDT,NOPUT,NOLVP,BROWNOUT,NOCPD,NOWRT
#use delay(clock=20000000)

void main()
{
   while (TRUE)
   {
   output_HIGH(PIN_B0);
   delay_ms(100);
   output_LOW(PIN_B0);
   delay_ms(100);
   }
}


Picture of schematic:
http://uploadpie.com/DsMtv

Video: http://telly.com/NF37WS

CCS Version: 4.140
Mike Walne



Joined: 19 Feb 2004
Posts: 1785
Location: Boston Spa UK

View user's profile Send private message

PostPosted: Fri May 17, 2013 3:19 pm     Reply with quote

Several things.

1) What is the measured LED blink frequency?
2) What is the measured oscillator frequency?
3) You haven't got a power supply decoupling capacitor close to the PIC!

Mike
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri May 17, 2013 3:27 pm     Reply with quote

Add this to your #fuses statement:
Code:
CPUDIV1
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