View previous topic :: View next topic |
Author |
Message |
Geps
Joined: 05 Jul 2010 Posts: 129
|
Timing Differences |
Posted: Mon Jul 05, 2010 3:57 pm |
|
|
Hi,
I'm trying create the standard blinking led circuit. I've written my program and it works however my logic analyser is telling the pin is changing value every 5 seconds not 500ms.
The clock value is set according to the PIC's (12f590) datasheet and when divided by 10 to compensate my programmer (PICKIT 2) detects an invalid OSCCAL value and the Pic refuses to accept the new program.
Any ideas?
Cheers,
Code: |
#include <12f509.h>
#use delay (clock=40000000)
#fuses NOMCLR, NOWDT, NOPROTECT, INTRC
#define OUTPUT_PIN PIN_B0
void main()
{
while(1) {
output_high(OUTPUT_PIN);
delay_ms(500);
output_low(OUTPUT_PIN);
delay_ms(500);
}
} |
|
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
Geps
Joined: 05 Jul 2010 Posts: 129
|
|
Posted: Mon Jul 05, 2010 4:30 pm |
|
|
Thanks for replying,
I note that initially I had the wrong value and it gave me the 500ms = 5second performance. However I've changed my program and it gave me the OSCCAL errors, I've reset it to 0x00 (centre frequency according to the datasheet) and now it seems I can't send any programs to it.
Is this still applicable to this forum or shall I go to a PIC specific one?
Cheers, |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Jul 05, 2010 5:02 pm |
|
|
What's your compiler version ?
Also, you may have the "MCLR disabled with Internal Oscillator" problem:
This thread has a link to a Microchip forum thread on the problem:
http://www.ccsinfo.com/forum/viewtopic.php?t=41261 |
|
|
|