Thanks for the book info. I'll check them out. Can't hurt to have them around.
As for how many mags to control at once, all of them. I would assume that I have 2 PORTS available for their control.
-Sterling
Thanks for the book info. I'll check them out. Can't hurt to have them around.
As for how many mags to control at once, all of them. I would assume that I have 2 PORTS available for their control.
-Sterling
That reminds me of the cemetery joke: How many people are dead in that cemetery? Answer: all of them!
My idea of using the '154 was that 8 of them could be connected with their inputs in parallel. The enable port on the '154 would be connected to 8 pins on the PIC to select the group of 16 magnets. that leaves 4 pins on the PIC for other control.
Russ
Forgive me for asking this stupid question, but wouldn't that mean that each '154 would be the same as the others: if output 3 is HIGH on one then it is HIGH on the others?
Another question, which is a better interface I2C or Serial Data? Microchip make a 16 channel port extender in both formats.
-Sterling
Last edited by SterlingY; - 19th March 2007 at 04:21.
wouldn't that mean that each '154 would be the same as the others: if output 3 is HIGH on one then it is HIGH on the others?
Only the enabled IC has an output.
I2C....because PBP has built in I2C handling capabilities (sure, it's got serial and SPI also, but I find I2C a bit 'cleaner' if that makes any sense).
On the '154...
The '154 has 4 inputs to control the 16 outputs, it's also got an enable line which turns the chip on or off.
You take a 5th bit from the PIC and drive that enable line with it. If you're driving 2 '154's, you have to invert that 5th bit going to one of the '154's, that way when one is on, the other is off.
If you want to drive a whole load of '154's, you can take 17 '154's, connect 16 of them in parallel (with say D0-D3) except for the enable line, take the 17th '154, connect it to another 4 bits from the PIC (say D4-D7), and use each of the 17th '154's outputs to drive the other 16 '154's enable line. And you'll end up with 256 individually controllable outputs. (or you could do the same thing with a '138, but with 8 '154's instead of 16 of them, or just not use all of the outputs of that extra '154 connected to D4-D7).
Another thing, with the '154, all you'll get is ON and OFF, nothing in between. You mentioned that you want to vary the strength over time. The '154 won't do it because you can't run multiple channel pulse-width modulation through it. You could easily set up an 8 channel software driven pulse-width modulation program and drive a bank of MOSFETs with the PIC and control the magnets that way. I've done exactly this with an 18F8722 and bank of 22 RGB LEDs (66 individual LEDs total). Replace those LEDs with n-channel MOSFETs or a bunch of ULN2803A's and you've got instant magnet control (well, as long as your power supply can handle it and doesn't cause the PIC to reset!).
Let us know if I dumbed this down too far for you, or maybe not enough, or whatever. We'll get you straightened out...![]()
OKAY!!!!
This is starting to makes sense. It sounds so cool, I want to build the multiport system just to build it for something, anything.
Of course to make my problem more difficult, I am now in the process of builing my own electromagnets. That's a whole other field to learn. My problem is making them strong enough without starting a fire.
-Sterling
Well, if you're talking about electromagnets that are going to be drawing a fair amount of current (over a total of an amp or so), then you're going to want to skip the '2003 in the first place and just go straight with MOSFETs or whatever else you choose.
In the meanwhile, while you get your magnets built up and working well, I'd suggest setting up a bank of LEDs set up and trying those out while you sort out your software. The light from the LEDs (in relation to the PWM input to them) won't be a linear curve, and neither will your electromagnets response to that same input...but at least with the LEDs you can learn how to change your program easily to change that curve without pumping a bunch of current and potentially burning something out...then you can easily swap out those LEDs for a MOSFET and the magnets...PRESTO! instant done...almost anyways![]()
Thanks for all of the info so far.
Can someone suggest a logic-level MOSFET that they might use for this type of project?
Thanks,
Sterling
Bookmarks