# Problem with chip as switch design

Status
Not open for further replies.

#### Zhasha

##### Junior Member level 3
chip as switch

Hi, i have a little problem on my hands:

i made this nifty little switch:
Code:
            V+
___        ^
|   |-------+---/\/\/\/----
|   |-
|   |-
|   |-
|   |-
|___|-

so when the chip grounds the current on the port, the switch is off, and when not the switch is on
my problem is now that i would like every port to be able to do that with current coming from only one lead.
so how do i with only one V+ make switches (8 of them to be more specific), to have 8 outputs (only 1 active at a time)

chip as switch

#### Zhasha

##### Junior Member level 3
Re: chip as switch

okay, so - i want to add the same functionality to all of the PBX ports.
when PB0 is set to 0, it grounds the current. when its not grounding the current the current flows through the resistor and out to where ever its going to be used.
not the problem here is that i can only use this on one port, because if i connect it to all, if one port grounds, no current flows, and i need 8 seperate ports in that sence, i have 8 different destinations for the current and i want the chip to send the current to one at a time.

say i want to send current out to destination 0, only that one destination gets the power, and the rest get nothing.

hope this explains it better

#### Tohu

##### Full Member level 1
Re: chip as switch

Hi,
this can damage your processor, you can not connect your port directly to the Vcc if the port is configure as output.
I dont know what range of current you will use, if this is a several mA, then you must put the resistor betwen port and Vcc and get the signal from the port, if you whant to use more that 10 mA, the better is to use axternal transistor ot IC, some like UL2003 for example. If this will be only the signal, then you just must enable the internall pull-up resistors, and this is all.
I tay to make a sch here:

several ma
......Vcc
__....|
...|...R
...|...|
..B0-*--- output
...|
...|

up to several A - transistor is a PNP
..........Vcc....Vcc
._ ........|......|
...|.......R......|
...|.......|...... |....(emiter)
..B0--R-*---|<___ output
...|....................(colector)
...|

#### Zhasha

##### Junior Member level 3
Re: chip as switch

Thanks a lot for pointing that out, but what i need is still to get 8 outputs, where only one is active at a time.
i dont suppose making 8 of these PNP "switches" and connecting them to each their own port will work?

#### Tohu

##### Full Member level 1
Re: chip as switch

Hi,
You not said what be the load, if this is low current device you can just connect rezistor to Vcc, the PIC can give up to 20 mA, if this is the normal output. You can increase this current to 25 mA with external resitor, but must calculate it because 25 mA is a maximum load to the ground.
In my previous post i write about port pull up, do not look this, puul up is for input, not for output, this is mistake
If you need high current, yes, you must have a 8 PNP transistors, one's for every output.

#### Davood Amerion

chip as switch

As Tohu said, you can not connect IOpin to VCC.
Anyway for produce 8 outputs, which one of them active at any time, you can use one 74(HC)138
for active low and 74(HC)237 for active high.
And connect PA1, PA2, PA3 of your microcontroller as address to this decoder.

Regards Davood

#### Tohu

##### Full Member level 1
Re: chip as switch

Oo, yes this is a good idea to minimize the CPU pin usage, but if you need a high current output this not be reduce the needing transistor after the decode, decder just minimize CPU pin, but have similar to CPU port load capacity.

##### Full Member level 3
chip as switch

Just duplicate the switch on each port.. Not sure what the problem is here. You're just going to have to bullet proof your software to make sure that more than one of these isn't sinking current at the same time or you're liable to fry the entire I/O port driver for that port, or who knows what else depending on how your circuit is setup. How much current do you have to sink before the switch triggers?

#### Zhasha

##### Junior Member level 3
Re: chip as switch

i need to make switches that should be able to support enough to sustain another chip (so only a few mA) so sourcing from pins is an option, but i could never get it working. i do not have a PIC programmer, only an AVR programmer (STK500) and as for chips, i can always buy a specific one if needed - in fact i have quite a few coming in the mail.

Status
Not open for further replies.