12F629 GP5 and Potentiometer

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

Post Reply
Frank607
Posts: 192
Joined: Mon Mar 04, 2013 8:07 pm
Has thanked: 29 times
Been thanked: 15 times
Contact:

12F629 GP5 and Potentiometer

Post by Frank607 »

I think that I have a small problem and I hope that someone can help me.


Situation:

I have made a PCB for controlling some LED’s wit 5 flash patterns (macro) I have used for this PCB a 12F629. I also have a potentiometer for controlling the speed of the LEDs.

This potentiometer is connected on GP5 from the 12F629. I know now that this is wrong because the 12F629 has no ADC channels.

The 12F675 and the 12F683 have ADC channels, so I can replace the 12F629 with this chips.

The problem stay’s that my potentiometer is connected to GP5 and none of these three chips have an ADC channel on GP5

My question is; if there is some solution in FlowCode so that I can use this potentiometer on GP5 to control the speed of LED flash patterns.

Thanks for your answers and input.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: 12F629 GP5 and Potentiometer

Post by Benj »

Hello,

You can do analogue type input using only digital I/O but you need 2 I/O pins. Note that GP3 is the MCLR reset pin and cannot be used as an output pin.

You basically have an output pin connected to a potentiometer, the other side of the potentiometer is connected to an input pin and also to ground via a capacitor. When the output pin goes high it will take time for the input to read a logic 1 depending on the resistance of the potentiometer and the capacity of the capacitor. Again when the output pin goes low it will take time which will be dependent on the resistance and capacitance.

By controlling the output pin and then timing how long it takes the input pin to react you can create your own type of analogue input.

The output pin could be replaced by a 555 timer or something else to save a pin on your device and allow you to generate a fixed frequency digital square wave. You could also maybe use the output to one of the LEDs as the driver.

Frank607
Posts: 192
Joined: Mon Mar 04, 2013 8:07 pm
Has thanked: 29 times
Been thanked: 15 times
Contact:

Re: 12F629 GP5 and Potentiometer

Post by Frank607 »

Hi Ben,

Thanks for your answer. When reading your good answer I came to the conclusion to make some new PCB’s and make use of the 12F675 or 12F683 so that I can use one ADC channel and connect the potentiometer to a ADC port.

Your solution will work, but this are production PCB’s so I can’t do this. (I made a Label mistake in Eagle to connecting the Net’s)

Everything is working fine accept this stupid mistake :-)

Thanks again Ben.

Post Reply