Would you like to react to this message? Create an account in a few clicks or log in to continue.

You are not connected. Please login or register

pic12f675 GPIO3 pin

2 posters

Go down  Message [Page 1 of 1]

1pic12f675 GPIO3 pin Empty pic12f675 GPIO3 pin Fri Sep 03, 2021 8:20 am


The GPIO3 pin of the pic12f675 is not working as GPIO. The code is compiled with sdcc.

#include  <pic14/pic12f675.h>

typedef unsigned int word;
word __at 0x2007 __CONFIG = (
_CP_ON &

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)   {
void delay(unsigned int tiempo){
unsigned int i,j;


Last edited by mvillaltaf on Fri Sep 03, 2021 8:31 am; edited 5 times in total (Reason for editing : Include test program)

2pic12f675 GPIO3 pin Empty Re: pic12f675 GPIO3 pin Fri Sep 03, 2021 7:10 pm



Hi mvillaltaf.

pic12f675 is working ok for me.

Maybe there is some issue in your code.
Many years I don't play with SDCC, but this doesn't look quite good for me:


Something like this makes more sense to me:
if( GPIO.GP3 ){
if( GPIO.3 ){

I don't remember the correct sintax, but I hope you get the idea.

3pic12f675 GPIO3 pin Empty Re: pic12f675 GPIO3 pin Fri Sep 10, 2021 7:17 am



Hi again.

I'm implementing SDCC Compiler and Debugger for simulide, so I had to recall everything about SDCC.

I was wrong about GP3, I didn't remember it was so easy in SDCC.

And I didn't realize one thing:
The problem in your code is that void delay() is used before defined.
I compiled your code with void delay() defined before void main(void) and it works ok.

Just to show how SDCC compiler/debugger will be in next release:

Sponsored content

Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum