PDA

View Full Version : looking to switch between 2 IC chips


nuttcase21
Sep 04, 2004, 04:04 PM
i'm looking for a switch that will allow me to switch between 2 seperate 20 pin IC chips. what should i look for? i've been all over the net looking at suppliers and can't figure out exactly what i need. rotary switches look to be what i want, but i can't figure out the pole/decks/positions info. the switch needs to be able to switch between the chips on a pin-to-pin basis. meaning that when i turn the swich from the first position (chip #1) to the second position (chip #2), that it changes the output from chip 1-pin #1 to chip 2-pin #2. get it? any help would be greatly appreciated. thanx guys.

Comatose
Sep 04, 2004, 04:29 PM
Do you need to switch all the pins, or just selected ones? FOr example, how many of the pins are power, ground or simply unconnected? A 2:1 multiplexer like a 74HC157 (or up to five of them, in this case, depending on how many io you need to switch) and a switch with a pull-up on the select line (tie the select lines together) would be a cleaner way to do it than a big obscure switch. It'd also have the advantage of switching everything at exactly the same time, with no debounce issues

nuttcase21
Sep 04, 2004, 04:41 PM
i would assume that all of the pins need to be switched. the whole project as follows. i've got an astro 109 lithium charger and just bought the IC chip for the 110 charger. switch the two IC's and you've got a charger that'll charge both lipo's and nicad/numh batts. obviously you have to change the chip each time. so i figured that i'd buy a switch and 2 dip sockets and install it directly inside the charger, that way i don't have to disassemble it everytime i want to charge something.

GailInNM
Sep 04, 2004, 04:52 PM
If you really want a manual switch, a manual computer printer A/B switch would work nicely. All that I have seen switch 25 pins. Should be able to find one at your local used computer store if you have one. I looked on EBay searching for printer switch and saw about a dozen in the 1 to 5 dollar range (plus shipping). New ones are from $15 to $30. Might have to settle for a A/B/C/D switch that would switch between any of 4 differnet devices. Probably cheaper than buying just the switch from an electronics supplier.

nuttcase21
Sep 04, 2004, 05:08 PM
i thought about that too, but i'm not sure of any problems i might runto doing the swap. i didn't know if the switch boxes had common pins like comatose had suggested. if they do, it might not work. i dunno, i'll be looking. any more ideas?

Miami Mike
Sep 04, 2004, 05:18 PM
If the only difference between the 109 and the 110 is truly the microcontroller chip, then the designers, Bob Boucher and Doug Ingraham, could easily design a new chip that incorporates both programs and lets the user select between peak charging and lithium battery charging. They could offer the chip for sale as an upgrade to present owners of either charger, and they could also come out with a new model that did all types of batteries. They could charge more for the new model even though their cost would be virtually the same as before.

So why haven't they done this already? Why do they instead make both the 109 and the 110? They aren't competing very well with chargers like the Triton, which can charge NiCd, NiMh, LiPo, Li-Ion, and lead batteries, so what's going on here?

I'd think twice before trying this modification. You might cause some damage to your charger, your batteries, or both. This needs to be explored further.

nuttcase21
Sep 04, 2004, 05:26 PM
it's the same charger except for the programming. i've got my 109 charging my gp1100 nimh pack as i write this. after you swap to the 110 chip, charge and nicad or nimh you want (up to the charger limit that is). i don't see where there's a problem to switch between the two chips. as long as the transfer is done without power and without and pin-jumping, i don't see why it won't work. i'm not the first guy to do this either. there are a bunch of guys who have bought the chip and do the swap all the time. i'm just getting tired of opening the charger every time i want to charge a battery that's of the other program.

GailInNM
Sep 04, 2004, 05:28 PM
A few of the very early ones did not switch everything, but they were marked for serial or parallel operation. Starting at least 10 years ago the manufacturers just made one box for everthing and switched all lines with the only common being the shell on the DB-25 connectors that became more or less universal on them. One thing I noticed was that quite a few of the 2 position (A/B) switchs made all thier connections with a PC board, while the 4 position (A/B/C/D) used a ribbon cables to the DB25 connectors.
This would cut the work in half by cutting off the connectors and attaching your plug and sockets to the ribbon.

Miami Mike is right that you might have some problems, but the microprocessor probably runs at a slow enough clock speed that if the wires are kept fairly short then it will probably not be bothered.

Mr.RC-CAM
Sep 04, 2004, 05:50 PM
It is hard to say if the oscillator will start reliable with the cables (capacitive loading issues). Also, it will be important to ensure that the chip's power pins are enabled before or at the same time as the other signals (switch contact bounce issues).

If you are technically proficient then I have another Idea for you to consider. How about installing both microcontrollers on top of each and then trick the RESET control line on the two chips? In the reset state the unwanted microcontroller will tri-state (float). Some micro's might not like the extra capactive loading on the xtal input, so some experimentation may be necessary.

I used this trick on some simple micro based projects and it was successful. But, your actual mileage may vary.

RC-CAM

Miami Mike
Sep 04, 2004, 06:02 PM
What numbers are printed on the chips? If there's a paper label, peel it and peek underneath.

simingx
Sep 04, 2004, 10:33 PM
If it's an EPROM, you can do this:

Solder all the pins together EXCEPT the /CE pin (search datasheets for this)
Lift the 2 /CE pins off the PCB so you get the 2 /CE pins from the EPROMs and 1 pin from the PCB where it originally went.
The /CE pins from the EPROMs go to the 2 outer terminals of a SPDT switch, and the original from the PCB goes to the middle.
You might want to pull one of the /CE's down with a resistor so the CPU gets something even if the switch fails...
Again, please make sure you know what you're doing before attempting this.... no responsibility for any damage to charger.

zagisrule!
Sep 04, 2004, 11:24 PM
I think that they were PIC's of some sort...saw pictures of one in a review. Too small a picture to make out numbers, but the M logo of Microchip is easy to recognize.



-Matt

Miami Mike
Sep 04, 2004, 11:34 PM
If it's an EPROM, you can do this:If they were EPROMs it would be a piece of cake. Someone could read the data and combine it into a chip with twice the capacity, and then do something like you're proposing. The code could even be disassembled and modified if someone had the talent, inclination, and ethical disposition. However, the PDF files from the AstroFlight website (http://www.astroflight.com/) say that the chargers use "a proprietary 8 bit microprocessor', which undoubtedly means a microcontroller such as the PIC, with the copy protection feature implimented.

nuttcase21
Sep 05, 2004, 12:54 AM
like i said, i'm just looking for a switch that'll allow me to switch between the two chips. if i blow it up, then i blow it up. what's the deal wth the different layers of a rotary switch and the different positions/poles. if i figure this out i'll be much happier. thanx in advance. here's the model number from the chip: PIC16C770/P

Miami Mike
Sep 05, 2004, 10:37 AM
Now we're getting somewhere!

http://www.google.com/search?sourceid=navclient&ie=UTF-8&q=PIC16C770%2FP

http://www.datasheetarchive.com/download.php?pi=173953

Mr.RC-CAM
Sep 05, 2004, 12:41 PM
i'm just looking for a switch that'll allow me to switch between the two chips. I think some of us are reluctant to support the 20P2T switch concept because it is not a good engineering solution for this application. However, if you wish to use one, then the most ready source is from a PC serial port AB switch box.

RC-CAM

nuttcase21
Sep 05, 2004, 01:09 PM
i understand that it's not the best solution. but from my point of view it's the only solution. i don't have the means to program a single chip to do both jobs, nor do i have the resources to even determine what's on each astro chip as far as programming. the switch is a simple mechanical solution to my dilemma. if there's an easier way, then by all means...

Comatose
Sep 05, 2004, 01:40 PM
Nutcase, no one is saying you should reverse engineer the chip. However, we don't like the long cabling runs and switch resistance for the 20p2t switch. Its also probably not necessary if you go about this cleverly.

How about this for a solution. On a piece of perfboard, make a circuit that on the bottom has plugs to go into the current socket. If the socket is the spring contact style, then male single-row header will work. If they're machined, then sadly the best i can think of is short pieces of 24 gauge solid wire. Next, mount 2 20 pin sockets on the top of the board. Wire all the IO pins and ground to the socket header. That is, for say pin 3, wire pin three of the first socket to the header (so it'll plug in where pin three of the current microcontroller) and also wire pin theee of the second socket to pin three of the header. In this manner,tie all IO and ground pins together and to the current socket. Also tie together the MCLR pins to pin 1 of the socket. Okay, so that'll just leave the VDD pins. Here's where you need to get clever. First, install new bypass caps (10v .1uF ceramic is probably a good choice) between VSS and VDD. Next, use a DPDT switch to pull one of the VDD pins high while puling the other one to GND. this will turn one of the chips on while turning the other one off.

The advantage of this scheme is you can keep most of your cabling pretty short, and a DPDT switch is MUCH easier to find and smaller than a 20pdt switch.

Mr.RC-CAM
Sep 05, 2004, 01:59 PM
Turning off just the power pin will not ensure a full "turn off" from the idle PIC chip. The problem lies in the I/O inputs. The input protection diodes on the chip will be forward biased with power off, which will really cause havoc.

Instead, I suggest that the switch be used to manage just the MCLR reset line. A reset PIC will float (tri-state) its I/O, which is what is wanted in this situation. A tri-stated chip is transparent, or nearly so.

FWIW, this PIC-switching project seems like a very simple problem to solve at first. But, there are some gotchas that need to be observed. As such, I would not recommend doing any hacking, regardless of method, unless you are very familiar with PIC's and microcontroller behavior.

RC-CAM

Comatose
Sep 05, 2004, 02:40 PM
RC-CAM, i'd agree with you, except that we're not sure they're using the external MCLR. In fact, I rather suspect that they are not, given that the pic is only 20 pins and MCLR is multiplexed with an input line. If they're using MCLR as a general purpose IO, then pulling the line low will do exactly nothing and you'll have both full on, which is a sure disaster.

I forgot the protection diodes, though, so good catch there.

Mr.RC-CAM
Sep 05, 2004, 03:36 PM
Yup, there are some hidden gotcha's on this one.

MCLR may not be the answer, that is for sure. The best solution could be devised after some reverse engineering is performed. Until then, this is an uncertain project, at least to me.

RC-CAM

nuttcase21
Sep 05, 2004, 03:40 PM
ok then, what do i have to do?

Mr.RC-CAM
Sep 05, 2004, 03:46 PM
If you have an o-scope, you would monitor the MCLR line at power-on. If you see it stay low for a few hundred milliseconds, then go logic high (and stay high during all operating modes), then it is probably used as the MCLR line. Furthermore, pulling it logic low will cause a graceful reboot. If you find this to be true then a hack could be devised.

Otherwise, you will have to try your 20P2T switch idea. I guess if you feel most comfortable with the big switch then that is probably the best solution for you.

RC-CAM

Comatose
Sep 05, 2004, 03:48 PM
Petition astro to buy some pic16f771s (twice the code capacity) and take the few days of development time it would take to merge the code (switching with some sort of keystroke combination)?

MR. RC-cam's solution will work nicely if they use an external MCLR (pin 4) Probably the easiest way to test for that is to power the unit up without the chip in it, and see what the voltage on it is. Then, press all the buttons and move all the jumpers you can find and see if any of those are tied to it. If not, then put one of the chips in, start a battery charging while watching the pin. If it never changes, then start on a perfboard daughterboard with only one socket for the time being. Make sure that runs correctly, then add a switch to pull the MCLR pin low. You'll also need to add about a 100 ohm resistor between the switch and ground, to prevent a latch-up problem. If flipping the switch makes the charger shut down, and unflipping it makes the charger start up again, then proceed to make the other side. If not, well, then it gets hairier

nuttcase21
Sep 05, 2004, 04:48 PM
can i check the MCLR pin without a scope, or do i need one for its time recording feature? i've got access to a scope at school, but not for a few weeks.

Comatose
Sep 05, 2004, 06:55 PM
A multimeter would probably suffice, if you're patient. A oscope would be preferable, but chances are if its not being used for master clear, its probably being used for an input from the user interface, which is a slow speed signal. But now I'm really speculating.

nuttcase21
Sep 05, 2004, 11:49 PM
all i've got access to is my fluke DM at the moment. so what i have to do is monitor the #4 pin without any chip and see if it stays at a constant voltage? the astro charger only has an amp adjustment pot on the front, no other user controls (the charger senses cell count and battery type by itself). now with my meter monitoring pin #4, rotate the amp dial to see if the voltage changes and if it doesn't i'm in the clear to make a board correct?

nuttcase21
Sep 06, 2004, 12:13 AM
okay, i've measured the #4 socket on the board without any chip installed and it reads 4.98 volts. i moved the amp pot on the face and the voltage doesn't change. now with the lipo 1chip installed and a battery charging, i move the amp knob until it reads 2.10 amps (for my lipo batt.) and the voltage goes up to 4.99 volts and stays there. if i turn the amp knob to the maximum, the voltage goes up higher, but only by a vew hundreths of a volt up to 5.07 volts. the same thing happens when i test it with the nicad/nimh chip. so now what?

nuttcase21
Sep 06, 2004, 12:31 AM
here's an update. i want to explaine how this charger works first before i tell you what i found. the charger works the same for both chip types, lipo or nicad/nimh. when you put power to the charger it reads the charger name and software version and then says: waiting for battery. you plug in the battery and the little fan starts spinning and the charging cycle begins. after the battery is plugged in you have to set the charging rate via the amp pot on the front panel. once this rate is set, it charges until peaked and then it emits a tone to tell you that the battery is done. these chargers will also discharge at a constant rate of 1.25 amps. without any other user controls on the front, the only way to get it to discharge mode is to plug the battery in first and then the power supply. so... charging is power first and then battery, discharging is battery first and then power. now that that's said and done, i was following comatoses directions and with the charger charging a battery i took the #4 pin to ground and it stopped the charging sequence. once i removed the ground it went into discharge mode. this was done without any removal of the battery or power connections. so am i screwed or do i need a resistor on my ground there to reduce the voltage instead of taking it directly to the ground? i'll be waiting to hear from you guys. and before i forget, thanx for all your help so far. i've got high res pics of the charger board too if you guys want them to maybe clarify anything.

nuttcase21
Sep 06, 2004, 01:17 AM
another update:

i tied a 100 ohm resistor in with my grounding wire for the MCLR pin, but when i ground the pin out (while charging) it doesn't do anything. so i went with a lower resistor and kept doing so until i got the same results as before (blank backlit screen) which was with a 15 ohm resistor.

I just want to make sure i've got this figured out. so i make a board that has all the pins in parallel except for the #4 positions. i take a DPST switch, and with my resistor in line, ground the center switch pin. then i connect the #4 pins from the IC's to either side of the switch. what happens then is that while the switch is in the first position, the #1 chip is fully functional with power to its respective MCLR pin and the #2 chip has all of its pins connected except for the #4 position. the #2 chip is grounded making it act in the floating state like RC-CAM explained and is thus "transparent". now when i move the switch to the second position, the MCLR pin on the #2 chip is introduced to power again while the #1 chip is grounded making it act floated and thus "transparent". correct? or did i miss something somewhere?

jeffs555
Sep 06, 2004, 02:47 AM
I sure wouldn't be shorting anything to ground without knowing what was driving it. That is an easy way to blow something. You still haven't proved whether pin 4 has been programed as MCLR or as RA5. Since it takes a 15 ohm resistor to pull pin 4 down, that is a sign that it is not programmed as MCLR. One way to test it would be to lift pin 4 on the PIC, so it does not plug into the socket, then connect it thru a 1k resistor to 5 volts. If the charger still functions correctly, then connect pin 4 on the PIC to ground thru the 1k resistor and see if the charger stays reset. You still won't be 100% certain that it is programed as MCLR but it would be a good indication.

Jeff

Mr.RC-CAM
Sep 06, 2004, 03:00 AM
It kind of sounds like the MCLR line is tied to Vcc, which is one way someone would configure the pin for use as MCLR/Reset. But as jeffs555 says, it still is not a certain fate. So, try his idea out to gather more data.

If you do nail down that MCLR is indeed the reset line, then the diagram below will show you how I would approach the switching. Keep in mind that VCC is PIC "Vdd" and gnd is PIC Vss. The MCLR line would not be connected to the existing circuitry -- the new stuff is all that would go to it. Switching would only be done while power is off (do not switch while in use).

There is no telling what is really going to happen if you implement this. It could end up as a fancy paper weight. Proceed with caution.

RC-CAM

nuttcase21
Sep 06, 2004, 03:31 AM
does it matter that while in the test process that jeffs555 detailed, i powered up the charger with the MCLR pin out of the socket and it's acting normally. i plugged in a battery and it's charging normally without fault. in the process i measured 1.148 volts on the MCLR pin from the chip, not the socket.

Mr.RC-CAM
Sep 06, 2004, 03:36 AM
That indicates more data in your favor. With the PIC's MCLR leg hanging out in free air, take a 1K resistor and "gnd" it (MCLR pin to digital gnd, via the resistor). Upon release of the gnd, the charger will reset if MCLR is used as the reset line.

RC-CAM

nuttcase21
Sep 06, 2004, 03:40 AM
digital ground?

Mr.RC-CAM
Sep 06, 2004, 03:46 AM
The Vss pin is digital gnd.

RC-CAM

nuttcase21
Sep 06, 2004, 03:48 AM
well i've got the charger running now and tried to ground the MCLR pin. i grounded it to both incoming ground as well as pin #5 vss grd and got nothing. it's still charging uninterupted. by the way, it just got done peaking a pack with the MCLR pin still out of the socket.

Mr.RC-CAM
Sep 06, 2004, 03:54 AM
While you gnd it via the resistor, what voltage is found on the MCLR pin?

nuttcase21
Sep 06, 2004, 04:01 AM
MCLR has .003 volts when it's grounded to vss.

Mr.RC-CAM
Sep 06, 2004, 04:04 AM
That is too bad. MCLR is not being used as the micro reset line. Sorry, but it's back to square one.

RC-CAM

nuttcase21
Sep 06, 2004, 04:05 AM
give me a few minutes as i'm in the process of slitting my throat. be right back.

nuttcase21
Sep 06, 2004, 04:07 AM
you wanted me to measuer the MCLR leg not the socket correct? just to make sure.

Mr.RC-CAM
Sep 06, 2004, 04:17 AM
Yes, measure the PIC's MCLR pin. Not the socket connection. From your results, you undoubtably correctly measured the PIC end. Sorry it is not the reset line -- could have been a neat hack.

As low tech as it appears, your big switch method may be the most immediate solution. But, perhaps another eZoner will come up with a brillant answer; For now, I got nothing.

RC-CAM

nuttcase21
Sep 06, 2004, 04:48 AM
alrighty then. well atleast we figured some stuff out. for anyone else out there who knows a thing or two about these pic chips, using the master clear is out of the question. so who's got ideas?

Bruce Abbott
Sep 06, 2004, 05:09 AM
Is there a crystal or ceramic resonator wired to pins 17 and 18?

If so, then you can hold the PIC in reset by grounding pin 18. This only works on power up, so to switch between PIC's you would have power down first (proabably a good idea anyway).

To use a cyrstal or ceramic resonator that is common to both chips, you would have to switch both pins 17 and 18, as well as grounding pin 18 of the inactive chip. This could be done with a three pole two position switch.

nuttcase21
Sep 06, 2004, 12:11 PM
the #18 pin leads to the buzzer which emits tones for charging duties and errors. the #17 pins runs to 2 resistors one of which is grounded and the other leads to an IRLZ44 chip.

Comatose
Sep 06, 2004, 12:30 PM
Okay, so they're internally oscillated too... Actually, if you have to go back to "big honkin switch" that's better, as you won't have to worry about degrading your osc signal.

Could you figure out what every pin goes to? I think at this point for any of us to have more ideas we're gonna need to know more about the system.

nuttcase21
Sep 06, 2004, 12:35 PM
sure could. give me a bit though as i've got to dismantle the board from the faceplate so i can view both sides of the board. i'll report back asap.

nuttcase21
Sep 06, 2004, 01:28 PM
here's the breakdown:

pin #1 -- leads to the potentiometer on the front (amps adjust)

pin #2 -- leads to a resistor which then leads to the gate lead of the 2nd IRLZ44, it also leads to a resistor which goes to the center lead of an MPSA06

pin #3 -- leads to nothing

pin #4 -- leads to a 10uf cap which then leads to a 2950 fet i'm assuming, it also leads straight to pin #16, it leads to a resistor which goes to a MEC224KX7 cap? which ultimately leads to pin # 7 (one lead of the cap, the other lead goes to pin # 5 + 6 (which are grounded).

pin #5 -- grounded

pin #6 -- grounded

pin #7 -- look above

pin #8 -- leads to a resistor which then leads to a 2.4 ohm 3watt resistor which goes to the source lead of the first IRLZ44 (2 of them), it also leads to another MEC224KX7 cap which is then grounded

pin #9 -- leads to a MEC224KX7 cap which is grounded, it also leads to 2 resistors (one goes to battery + output and the other to ground)

pin #10 -- leads to a 10 uf cap which is grounded, it also leads to 2 resistors (one is grounded and the other leads to a lead on the above mentioned 2950 fet and then over to the + for the fan)

pin #11 -- leads to pin #11 of the display board (hantronix hdm16216l-b-l30f)

pin #12 -- leads to pin #12 of the display board

pin #13 -- leads to pin #13 of the display board

pin #14 -- leads to pin #14 of the display board

pin #15 -- leads to nothing

pin #16 -- leads to pin #4 (see above)

pin #17 -- leads to 2 resistors (one is grounded the other goes to the gate lead of the first IRLZ44)

pin #18 -- leads to the buzzer which is then grounded

pin #19 -- leads to pin #6 of the display board

pin #20 -- leads to pin #4 of the display board

that's everything to the best of my ability. i've gone over it three times and come up with the same thing so it's pretty much correct.

Mr.RC-CAM
Sep 06, 2004, 01:38 PM
Good info. We should have asked you to create the pin description list early on. Would have saved a lot of guessing that was going on. ;) It definately explains how the PIC is being used.

From what I can see, the big switch solution is about as good as it will probably get. With reasonably short leads, it should work.

RC-CAM

nuttcase21
Sep 06, 2004, 01:42 PM
okay so what kind of switch am i looking for? and could you clarify the poles/positions/layers thing? thanx

Mr.RC-CAM
Sep 06, 2004, 02:41 PM
You essentially need a 20 pole, double throw, switch. At the commerical level, you would buy a switch frame and several switch layers (enough layers to suit your 20 pole needs). Then you would set the rotary position lock tab to limit it to two positions. However, this is going to be very expensive -- perhaps would cost as much as the charger itself.

That is why I mentioned the DB25 type PC serial port A-B switch box. They cost under $35. You can use the switch from one of those. The cheaper versions do not switch all the pins (they cheat to save costs), so before you start cutting wires you should use your ohmmeter to verify that at least 20 pins are in the switch path.

RC-CAM

nuttcase21
Sep 14, 2004, 11:21 PM
well i did it. went and bought a used belkin parallel cable switching box and did the job. i ordered some 20 pin IC sockets from digikey and soldered the switch wiring to them. i shrink wrapped all my connections for a clean install and it looks and works great. as for the switch, i just drilled a hole in the side of the plastic charger case and mounted it there. with a little label above the knob, i can tell which mode i'm in. thanx again guys for all your help. i'm sure i'd still be scratching my head without it. thanx again. WOO HOO!!! now i've got a single charger to handle all of my batteries!!

Mr.RC-CAM
Sep 14, 2004, 11:39 PM
Excellent news!

RC-CAM

Comatose
Sep 14, 2004, 11:45 PM
Sounds great! Pictures?

nuttcase21
Sep 14, 2004, 11:57 PM
i'll snap some pics of it tomorrow and shoot them up on here. i'm kind of swamped tonite with heat-transfer homework. thanx again guys.