I'm using a PIC12F675 for a project, and everything works fine except one thing. GP4 does not work as digital IO. I've looked at the configs and the code a lot, but couldn't find anything.
Config:
#pragma config FOSC = INTRCCLK #pragma config WDTE = OFF #pragma config PWRTE = OFF #pragma config MCLRE = OFF #pragma config BOREN = ON #pragma config CP = OFF #pragma config CPD = OFF Code:
#include <xc.h> #include <math.h> #include "config.h" #define _XTAL_FREQ 4000000 void delay(unsigned int freq){ for(int i = 0; i < (int)freq; i++){ __delay_ms(1); } } void dClock(unsigned int freq){ GPIO1 = 1; delay(freq); GPIO1 = 0; delay(freq); } void InitADC(){ ANSEL = 0x11; ADCON0 = 0b10000001; CMCON = 0x7; VRCON = 0; } unsigned int GetADCValue(){ ADCON0 = 0b10000011; while(GO_nDONE); return (ADRESH << 8) + ADRESL; } void main(void) { TRISIO0 = 1; //analog input TRISIO1 = 0; //output TRISIO2 = 0; //indication TRISIO3 = 1; //mode TRISIO4 = 0; //halt TRISIO5 = 1; //pulse_button char pressed = 0; GPIO1 = 0; InitADC(); while(1){ if(GPIO4 == 0){ if(GPIO3 == 0){ GPIO2 = 1; unsigned int freq = GetADCValue(); dClock(freq); } else{ GPIO2 = 0; if(GPIO5 == 1 && pressed == 0){ GPIO1 = 1; __delay_ms(50); GPIO1 = 0; pressed = 1; } else if(GPIO5 == 0 && pressed == 1){ pressed = 0; } } } } return; } 

#pragma config FOSC = INTRCCLKtell the PIC to output it's clock on GP4? Isn't there a differentFOSCoption you should be using? \$\endgroup\$