Has anyone used the CCS C compiler with the PIC12CE674?
I'm having difficulty getting out of the starting block with a simple program (attached).
The chip is supposed to be set up to run on the internal oscillator (at
4MHz) with the OSC2 pin set as an IO line, no MCLR pin input (MCLR pin used as an IO line), and with AN0 and AN1 used as analog inputs. I've verified the fuse settings to be 0x3f74 and have verified this value in the hex file and in the device after programming. Basically, GP0 (AN0) and GP1 (AN1) are analog inputs and GP2 (T0CKI), GP3 (MCLR), GP4 (OSC2), and GP5 (OSC1) are all discrete outputs.When I run the program, all I see is a flatline high on MCLR and a flatline low on GP4. I also tried setting the oscillator mode to internal oscillator with clock out on GP4 (OSC2). When I ran that program, I see a nice, clean
1MHz output on GP4.Anyone have any idea what I'm doing wrong?
Thanks.
Dave
--- code follows ---
// test12c2674.c contents : #include "C:\Projects\PicC\projects\test\test12ce674.h"
short toggleState; // on or off state of digital output indicators
#ZERO_RAM void main() { toggleState = FALSE;
set_tris_a(0x03); // a0, a1 are ins (should be analogs); others outs setup_adc_ports(AN0_AN1_ANALOG); setup_adc(ADC_CLOCK_INTERNAL); setup_counters(RTCC_INTERNAL, RTCC_DIV_1);
while(true) { if(toggleState) { output_high(PIN_A4); toggleState = FALSE; } else { output_low(PIN_A4); toggleState = TRUE; }
delay_ms(250); } }
// test12ce674.h contents: #include
#device adc=8 #use delay(clock=4000000) #fuses NOWDT, INTRC_IO, NOPROTECT, NOMCLR