Source detection

Thread Starter

gdallas

Joined Apr 25, 2012
74
Probably very simple solution, and I bet I cant see the trees for the forest. However, in my attached schem, the user can select bu use of a micro PCB (Sw1) switch if the device is to use battery power or loop power from an external source. The software in the PIc will go into one of two modes dependant on how its powered. Id lke to use pin6 6 on the switch I think! To set a PIc DI H/L, but I’m not sure this is the best idea, since under battery mode the pull upi resistor will draw 3.6uA. I know this isn’t a lot, and if I have to live with it I will, but id prefer to lose this draw under loop power mode.

Any better ideas? thanks
 

Attachments

AnalogKid

Joined Aug 1, 2013
10,986
Are you asking about a way to change between the two power sources automatically, or a way to detect which source has been selected?

Also, what is the downward pointing triangle on the lower right switch contact. If this is another ground, then your PIC input is switching between low and low.

ak
 

THE_RB

Joined Feb 11, 2008
5,438
You don't need a pullup resistor.

On the second side (pole) of the DPDT switch that you are using for switch position detection, put the common to the PIC input pin, then put the two other pins to PIC Vdd and PIC Vss (gnd). No pullup is needed.

And your diagram shows the pins connected wrong on the switch symbol. If I understand that symbol right, pins 1 and 6 are the commons and 2,3 and 5,4 are the changeover pins.
 

Thread Starter

gdallas

Joined Apr 25, 2012
74
You don't need a pullup resistor.

On the second side (pole) of the DPDT switch that you are using for switch position detection, put the common to the PIC input pin, then put the two other pins to PIC Vdd and PIC Vss (gnd). No pullup is needed.

And your diagram shows the pins connected wrong on the switch symbol. If I understand that symbol right, pins 1 and 6 are the commons and 2,3 and 5,4 are the changeover pins.

Hi THE_RB, you may be right re that symbol im not sure. i used a generic one from Orcad library which had six pins. I took the arrows as the direction of flow though. Ive attached the datasheet for the switch and my understadning is that the middle pins are common as its a slider. of course the direction of flow would now be wrong when its the down position!
 

Attachments

Thread Starter

gdallas

Joined Apr 25, 2012
74
ok ive decided to remove that pull up on The_RB suggestion, I will use the weak pull up inside PIC B4 and basically disable that input once its pin status has been read since i only need to read the status on power up
 

THE_RB

Joined Feb 11, 2008
5,438
Hi THE_RB, you may be right re that symbol im not sure. i used a generic one from Orcad library which had six pins. I took the arrows as the direction of flow though. Ive attached the datasheet for the switch and my understadning is that the middle pins are common as its a slider.
...
Agreed, the datasheet seems to indicate the middle pins are the commons for the DPDT slider.

However your symbol on the schematic is still wrong. The arrows are motile, so the arrows on that symbol should be on pins 1 and 6, showing they CAN be 1 and 6 or CAN be on 3 and 4.

It's worth checking the switch pin numbers with an ohmeter to make sure.

ok ive decided to remove that pull up on The_RB suggestion, I will use the weak pull up inside PIC B4 and basically disable that input once its pin status has been read since i only need to read the status on power up
Actually my suggestion was to use no pullup at all. If the DPDT switch is only ever in two positions, you wire it so one position puts 5v at the PIC pin, the other puts 0v there. No current will be used (because you said you wanted to reduce current consumption).
:)
 
Top