View previous topic :: View next topic |
Author |
Message |
Mick Kent Guest
|
12f675 will not run |
Posted: Tue Aug 05, 2003 8:23 am |
|
|
I have been trying for a week to get this 8 pin bugger to flash a led with no luck. I search the list back 500 days and tried many suggestions. I am running 3.169 so I tried the wizard; no luck. Code below:
#include <12F675.h>
#use delay(clock=4000000)
#fuses INTRC,BROWNOUT,NOWDT,PUT,NOMCLR
#define GREEN_LED PIN_A2
#byte ADCON0=0x1f
#byte ANSEL=0x9f
#byte CMCON=0x19
main() {
ADCON0=0;
ANSEL=0;
CMCON=7;
while(true) {
output_low(GREEN_LED);
delay_ms(1000);
output_high(GREEN_LED);
delay_ms(1000);
}
}
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516674 |
|
|
Felix Althaus
Joined: 09 Sep 2003 Posts: 67 Location: Winterthur, Switzerland
|
Re: 12f675 will not run |
Posted: Tue Aug 05, 2003 8:35 am |
|
|
Hello
Perhaps you should place a "retlw [OSCCAL-VALUE]" at the last program memory place. I had the same problem with a 12C674, and I think here it's the same thing:
The compiler knows that this chip should have an osscal value on the last prog memory adress and so he puts a "call [last address]" (look at your lst file) and if there isn't a retlw xx the pc goes back to address 0 = pic resets, and does the call again, ... and so on.
I wrote a #rom 0x7FF = {0x34xx} in the code (xx is the calibration value)
may this helps
Felix
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516675 |
|
|
Mick Kent Guest
|
Re: 12f675 will not run |
Posted: Tue Aug 05, 2003 8:43 am |
|
|
:=Hello
:=
:=Perhaps you should place a "retlw [OSCCAL-VALUE]" at the last program memory place. I had the same problem with a 12C674, and I think here it's the same thing:
:=The compiler knows that this chip should have an osscal value on the last prog memory adress and so he puts a "call [last address]" (look at your lst file) and if there isn't a retlw xx the pc goes back to address 0 = pic resets, and does the call again, ... and so on.
:=
:=I wrote a #rom 0x7FF = {0x34xx} in the code (xx is the calibration value)
:=
:=may this helps
:=Felix
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516676 |
|
|
Mick Kent Guest
|
Re: 12f675 will not run |
Posted: Tue Aug 05, 2003 8:49 am |
|
|
Thanks very much, Felix; I had tried that but got the address wrong. It finally flashes
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516679 |
|
|
Kobra Guest
|
Re: 12f675 will not run |
Posted: Fri Aug 15, 2003 9:15 am |
|
|
I also have the same problem as yours. Could you tell me how to make it work? I use the same code as yours to test. Thanks.
_Kobra_
:=I have been trying for a week to get this 8 pin bugger to flash a led with no luck. I search the list back 500 days and tried many suggestions. I am running 3.169 so I tried the wizard; no luck. Code below:
:=
:=#include <12F675.h>
:=#use delay(clock=4000000)
:=#fuses INTRC,BROWNOUT,NOWDT,PUT,NOMCLR
:=
:=#define GREEN_LED PIN_A2
:=
:=#byte ADCON0=0x1f
:=#byte ANSEL=0x9f
:=#byte CMCON=0x19
:=
:=main() {
:=ADCON0=0;
:=ANSEL=0;
:=CMCON=7;
:= while(true) {
:= output_low(GREEN_LED);
:= delay_ms(1000);
:= output_high(GREEN_LED);
:= delay_ms(1000);
:= }
:=}
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516997 |
|
|
|