View previous topic :: View next topic |
Author |
Message |
albe9990
Joined: 15 Sep 2009 Posts: 4
|
10f206 |
Posted: Tue Sep 15, 2009 7:00 am |
|
|
hallo I am begin program my new pic 10f206 and I have test same code blink led in this forum, but never is good. There is same code correct so I begin ?
Code: |
#include <10F206.h>
#FUSES NOWDT //No Watch Dog Timer
#FUSES NOMCLR //Master Clear pin: disable
#FUSES NOPROTECT //Code protected from reads
#use delay(clock=4000000)
#define LED PIN_B0
main()
{
int32 timer;
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
setup_comparator(NC_NC);
output_low(PIN_B0);
output_low(PIN_B1);
output_low(PIN_B2);
output_low(PIN_B3);
// delay_ms(500); // <--- uncomment this and we will *never* get below this code
while(true)
{
output_high(LED); // LED DOES turn on
delay_ms(500); // locked up?
output_low(LED); // never makes it here...
delay_ms(500);
}
}
|
I have tried this but don't work.
Thanks everyone. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Sep 15, 2009 12:47 pm |
|
|
Post your compiler version. It's a number in this format: x.xxx
It's given at the top of the .LST file, which is in your project directory. |
|
|
Guest
|
|
Posted: Wed Sep 16, 2009 1:37 am |
|
|
CCS PCB C Compiler, Version 4.084 |
|
|
albe9990
Joined: 15 Sep 2009 Posts: 4
|
|
Posted: Wed Sep 16, 2009 1:45 am |
|
|
sorry CCS PCB C Compiler, Version 4.084
and in the Pickit2 when i open file write :
no configurations world in hex file ... |
|
|
albe9990
Joined: 15 Sep 2009 Posts: 4
|
|
Posted: Wed Sep 16, 2009 4:38 am |
|
|
Now I have test this code:
Code: |
#include <10F206.h>
#FUSES NOWDT //No Watch Dog Timer
#FUSES NOMCLR //Master Clear pin: disable
#FUSES NOPROTECT //Code protected from reads
#use delay(clock=4000000)
main()
{
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
setup_wdt(WDT_2304MS);
while(1)
{
output_high(PIN_B2); // turn on LED
restart_wdt();
delay_ms(100); // lets delay.
output_low(PIN_B2); // turn off LED
restart_wdt();
delay_ms(100); // lets delay.
}
}
|
and the led came to blink and all is good
but without wdt nothing to.
stop in the first delay.
Thanks. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Sep 16, 2009 4:17 pm |
|
|
I don't understand your post. Is there a problem with the Watchdog
Timer ?
I only have the version of PCB that comes with MPLAB. It's vs. 4.073.
I compiled the following program and looked at the .LST file. It looks OK.
I think this program should work.
Code: |
#include <10F206.H>
#fuses NOWDT,NOMCLR
#use delay(clock=4000000)
//=========================
void main()
{
setup_comparator(NC_NC);
// Blink an LED on pin B2.
while(1)
{
output_high(PIN_B2);
delay_ms(500);
output_low(PIN_B2);
delay_ms(500);
}
} |
|
|
|
albe9990
Joined: 15 Sep 2009 Posts: 4
|
|
Posted: Wed Sep 16, 2009 5:05 pm |
|
|
now is good with mplab.
and led blink.
Thanks |
|
|
|