Hi I'm new to pic programming but not new to C programming,
Can someone help me configure a 12F683 in boostC I just want to be able to use the gpio register to blink leds on the 5 output pins. I have read most of the datasheet and the newcomers sticky and I still cant figure it out.
Here is the code so far.
Code:#include <system.h> #include <PIC12F683.h> #pragma DATA _CONFIG, _WDT_OFF & _INTOSCIO #pragma CLOCK_FREQ 4000000 char count = 00000000b; char GPP0 = 00000001b; char GPP1 = 00000010b; char GPP2 = 00000100b; char GPP4 = 00010000b; char GPP5 = 00100000b; void main() { osccon = 01100001b; cmcon0 = 7; //set digital IO adcon0 = 0 ; ansel = 00000000b; wpu = 0; trisio = 00001000b; //set input , output gpio = 00000000b; while(1) { set_bit(gpio,GPP0); set_bit(gpio,GPP1); set_bit(gpio,GPP2); set_bit(gpio,GPP4); set_bit(gpio,GPP5); delay_ms(1000); clear_bit(gpio,GPP0); clear_bit(gpio,GPP1); clear_bit(gpio,GPP2); clear_bit(gpio,GPP4); clear_bit(gpio,GPP5); delay_ms(1000); } }

Reply With Quote