12F629 outputs to 0V

Thread Starter

Alex GD

Joined Apr 19, 2020
8
Hi everybody,

I need to use 3 outputs of a 12F629 switching to ground, not to the 5V. It's been impossible to find such information, maybe can not be done. I do not see nothing related to that in the GPIO register. Any idea how to do it within the hex file?
By the way, another question. Without touching anything, the output is=5V when enabled, but when it is disabled, what do I have there? Open circuit?

Many thanks
 

AlbertHall

Joined Jun 4, 2014
12,623
If you look at paragraph 3.1 in the datasheet it shows how to set up the port for I/O.
Clear any bits in TRISIO that you want to use as outputs.
To set the output pins high or low set or clear the matching bits in GPIO.
 

Thread Starter

Alex GD

Joined Apr 19, 2020
8
Thanks but I'm gonna need more help, I am totally new in this. I've made a code very simple, flashing 3 outputs:

AllDigital
TRISIO = %100000 'GPIO: 0 = salidas
CMCON = %00000111 'deshabilita comparadores

Symbol rojo = GP0
Symbol amarillo = GP1
Symbol verde = GP2
'Symbol entrada = GP5
'Define SIMULATION_WAITMS_VALUE = 1

inicio:

rojo = 1
amarillo = 1
verde = 1
WaitMs 1500
rojo = 0
amarillo = 0
verde = 0
WaitMs 200


Goto inicio

Thank you
 

LesJones

Joined Jan 8, 2017
4,511
If you use the internal oscillator you have 6 I/O ports. 5 of them are Read/write. One of them (GPIO3) is read only. If you use an external crystal oscillator you lose 2 of the R/W ports. You can set5 individual bits to zero (0 volts.) with a bit clear instruction. (BCF)

Les.
 

Thread Starter

Alex GD

Joined Apr 19, 2020
8
I am using as a source, I want to use them as sink. I need the output set to ground when enabled, not set to 5V.
 

MaxHeadRoom

Joined Jul 18, 2013
30,593
Also, at power up, the ports default to high impedance inputs, in your set up, set the ports to outputs and set to a 1 right away.
Clear the output to zero turn on LED.
Max.
 
Last edited:

jpanhalt

Joined Jan 18, 2008
11,087
AlbertHall said:
You also need to set the pins to digital: 'ANSEL =0'
Yes, but you need to notice that the datasheet covers both '629 and '675!
And how do you set ANSEL in the 12F629? Did you notice that the datasheet covers both?

The first LED I ever flashed was with a 12F508. The 12F509 was a move up. The 12F683 was almost overwhelming, so I have not gone much further, nor have I needed to.
 
Last edited:

jpanhalt

Joined Jan 18, 2008
11,087
At this point, I think the TS needs to tell us how it is wired. When he/she says "sourced," I think that means "B." I wounder whether the design has been changed to "A" to accommodate "sinking."
 
Top