View previous topic :: View next topic |
Author |
Message |
aasanchez
Joined: 17 May 2013 Posts: 8
|
delay_ms wrong time execution |
Posted: Fri May 17, 2013 2:48 pm |
|
|
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
|
|
Posted: Fri May 17, 2013 3:19 pm |
|
|
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
|
|
Posted: Fri May 17, 2013 3:27 pm |
|
|
Add this to your #fuses statement:
|
|
|
|