The GPIO3 pin of the pic12f675 is not working as GPIO. The code is compiled with sdcc.
- Code:
#include <pic14/pic12f675.h>
typedef unsigned int word;
word __at 0x2007 __CONFIG = (
_BODEN_OFF &
_CPD_ON &
_CP_ON &
_MCLRE_OFF &
_PWRTE_ON &
_WDT_OFF);
void main(void){
TRISIO = 0x08; //Poner todos los pines como salidas y activar entrada
ANSEL=0x00;//desactivar convertidor A/D
CMCON=0x07;//Desabilitar comparadores
GPIO = 0x00; //Poner pines en bajo
while (1) {
if(GP3){
GPIO=0x02;
delay(100);
}
else{
GPIO=0x01;
delay(150);
}
}
}
void delay(unsigned int tiempo){
unsigned int i,j;
for(i=0;i<tiempo;i++)
for(j=0;j<1275;j++);
}
Last edited by mvillaltaf on Fri Sep 03, 2021 8:31 am; edited 5 times in total (Reason for editing : Include test program)