View previous topic :: View next topic |
Author |
Message |
jecottrell
Joined: 16 Jan 2005 Posts: 559 Location: Tucson, AZ
|
12F683 Pin Fried? |
Posted: Tue Sep 05, 2006 3:57 pm |
|
|
Hello All,
I've just started using a 12F683 part for a small project and can't get one pin working as an output. I currently have A0, A1, A2, and A5 toggling correctly. But I can't seem to get A4 to toggle. As I was assembling the board I connected A4 to the base of a PNP BJT (the base was also pulled up through a 47K, the collector was connected to Vdd, and the emitter was floating). When I didn't get the results expected from the BJT when checked with a scope while toggling I pulled the BJT off the board and started troubleshooting. Right now A4 won't budge from 1/2 of Vdd.
I've looked at the datasheet and can't find anything odd about A4.
Any ideas?
Thanks,
John
Here is the current code:
Code: | #include <12F683.h>
#FUSES NOWDT //No Watch Dog Timer
#FUSES INTRC //Internal RC Osc
#FUSES NOPUT //No Power Up Timer
#FUSES NOBROWNOUT //No brownout reset
#use delay(clock=31000)
#define H20_IN PIN_A0
#define SW_IN PIN_A1
#define LOW_BAT_IN PIN_A2
//#define PIN_A3
#define BUZZ_OUT PIN_A4
#define LED_OUT PIN_A5
#int_RTCC
RTCC_isr() {
}
#int_TIMER2
TIMER2_isr() {
}
#int_RA
RA_isr() {
}
void main() {
setup_adc_ports(NO_ANALOGS|VSS_VDD);
setup_adc(ADC_OFF);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_256);
setup_timer_1(T1_INTERNAL|T1_DIV_BY_8);
setup_timer_2(T2_DISABLED,0,1);
setup_comparator(NC_NC);
setup_vref(FALSE);
//enable_interrupts(INT_RTCC);
//enable_interrupts(INT_TIMER2);
//enable_interrupts(INT_RA);
//enable_interrupts(GLOBAL);
setup_oscillator(OSC_31KHZ);
SET_TRIS_A(0b00001111);
while(TRUE) {
output_high(LED_OUT);
output_high(BUZZ_OUT);
output_high(LOW_BAT_IN);
output_high(SW_IN);
output_high(H20_IN);
delay_ms(1500);
output_low(LED_OUT);
output_low(LOW_BAT_IN);
output_low(SW_IN);
output_low(H20_IN);
output_low(BUZZ_OUT);
delay_ms(1500);
}//while(TRUE)
}//main
|
|
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Sep 05, 2006 4:16 pm |
|
|
Look closely at the line in bold:
Quote: | #include <12F683.h>
#FUSES NOWDT //No Watch Dog Timer
#FUSES INTRC //Internal RC Osc
#FUSES NOPUT //No Power Up Timer
#FUSES NOBROWNOUT //No brownout reset |
Look at the list of fuse settings in the 12F683.H file. |
|
![](templates/subSilver/images/spacer.gif) |
jecottrell
Joined: 16 Jan 2005 Posts: 559 Location: Tucson, AZ
|
|
Posted: Tue Sep 05, 2006 5:08 pm |
|
|
PCM,
Thanks. I followed your tip and looked at the fuse options. I found the INTRC_IO option and tried it assuming that was what you were suggesting... it worked. I then went to the datasheet and read the oscillator notes and saw the explanation for that fuse setting. I've never used the internal oscillator before, so I've never run into that.
Thanks again,
John |
|
![](templates/subSilver/images/spacer.gif) |
|