Is 250+ I/O's too much to ask for from an SX?
SeanL
Posts: 10
A couple nights ago·I was inspired to start a new project based on an SX-52. Very quickly I realized that the SX-52 was going to come up·short for the number·I/O's I'm going to need. A ballpark figure is about·is 250+. I'm looking at about·128 potentiometers,·about 50 each pushbuttons and·LED's, and·an LCD panel (or 2, or 3).·To rounds thing out I'll also need·a few I/O's for a data bus to·transfer data since a single-chip design obviously ain't going to happen. If an SX can do a lot, two working together should be able to do a lot more.
Using·multiple SX's·connected together via a fast data bus should give me more·I/O's. I know the pushbuttons and the LED's can easily be matrixed, so the·100 or so I/O's for those will get a serious reduction.·I can build two 8x8 matrixes, 1 for the buttons and 1 for the LED's. This will allow me to add more buttons and/or LED's.·I am fairly certain that I will be able to find an LCD pannel with a large enough display so that I'll only need one. But this still leaves me with·one problem. I·have·to connect 128 potentiometers and ideally do it with as few components as possible.
To handle the pots,·the first option I came up with is to use external IC's to take care of the ADC. The only real drawback I can see is the number that I'll need. I have found some that would be able to·handle·8 potentiometers at once and output the data via·an I2C bus.·This looked promising, but then I realized that I would end up needing·16 of them. I found a couple links on google that looked like they might have pointed twords a web site listing ADC IC's that would handle 16 potentiometers, but·either the site was down or the links were broke. So I don't know if they actually exist or not.·But even if they can handle 16 potentiometers, I·assume that somewhere out there, there just has to be·somebody that makes an IC that can handle more. And thats where option number two for the pot's came into play.
Looking at the examples in Guenther Daubach's book: Programing the SX Microcontroller·A Comletely Awesome Guide (ok,·I know thats not the actual·title of the book, but thats what it should be),·a single SX-48 should be able to·handle 32 pots and·have more than enough I/O's for data transfers.·Four SX-48's would be able to handle all of the potentiometers and I would be able to·use the·unused I/O's to build a fairly fast data bus. At a cost of $20.00 this seems like it might end up being cheaper than the first option. And this is where option number three comes in.
If·4 is better than 16, wouldn't 1 be better than 4? That almost sounds like a question off an IQ test. Can potentiometer's·be matrixed like LED's and pushbuttons? If·it is possible, it seems like I should be able to handle all 128 potentiometer with a signle SX-52. Is there a way to build an 8x8 potentiometer matrix?·If it worked, I could build two matrixes handling 64 pots each and badda-boom-badda-bing...I got me a $7.00 solution.·I tried googling for an answer but·I didn't find anything useful. Although, I did manage to find lots of stuff that had absolutly nothing to do with what I was looking for . Too bad there were no links that showed how I could get those few hours of my life back.
If·I·over-thought the 3rd option,·blame the fact that it's the weekend and blame the kind folks at Anheuser-Busch and all the great work they do for that .
If option number three ends up not being an option, no biggie. I'll probably end up going with option number two since I'm getting wicked good with a soldering iron and don't mind using 4 SX-48's. For the·pushbuttons, LED's, and LCD display(s) I'll probably end up using maybe another SX-48 and maybe an SX-28. And that leads me to my next question.
If I'm going to be wiring up 6 SX's on the same circuit board, can I use a single resonator for all of them, or does each SX absolutely have to have it own. That question just came to me as I was typing·this out so I haven't even tried to look it up, yet.
·
Using·multiple SX's·connected together via a fast data bus should give me more·I/O's. I know the pushbuttons and the LED's can easily be matrixed, so the·100 or so I/O's for those will get a serious reduction.·I can build two 8x8 matrixes, 1 for the buttons and 1 for the LED's. This will allow me to add more buttons and/or LED's.·I am fairly certain that I will be able to find an LCD pannel with a large enough display so that I'll only need one. But this still leaves me with·one problem. I·have·to connect 128 potentiometers and ideally do it with as few components as possible.
To handle the pots,·the first option I came up with is to use external IC's to take care of the ADC. The only real drawback I can see is the number that I'll need. I have found some that would be able to·handle·8 potentiometers at once and output the data via·an I2C bus.·This looked promising, but then I realized that I would end up needing·16 of them. I found a couple links on google that looked like they might have pointed twords a web site listing ADC IC's that would handle 16 potentiometers, but·either the site was down or the links were broke. So I don't know if they actually exist or not.·But even if they can handle 16 potentiometers, I·assume that somewhere out there, there just has to be·somebody that makes an IC that can handle more. And thats where option number two for the pot's came into play.
Looking at the examples in Guenther Daubach's book: Programing the SX Microcontroller·A Comletely Awesome Guide (ok,·I know thats not the actual·title of the book, but thats what it should be),·a single SX-48 should be able to·handle 32 pots and·have more than enough I/O's for data transfers.·Four SX-48's would be able to handle all of the potentiometers and I would be able to·use the·unused I/O's to build a fairly fast data bus. At a cost of $20.00 this seems like it might end up being cheaper than the first option. And this is where option number three comes in.
If·4 is better than 16, wouldn't 1 be better than 4? That almost sounds like a question off an IQ test. Can potentiometer's·be matrixed like LED's and pushbuttons? If·it is possible, it seems like I should be able to handle all 128 potentiometer with a signle SX-52. Is there a way to build an 8x8 potentiometer matrix?·If it worked, I could build two matrixes handling 64 pots each and badda-boom-badda-bing...I got me a $7.00 solution.·I tried googling for an answer but·I didn't find anything useful. Although, I did manage to find lots of stuff that had absolutly nothing to do with what I was looking for . Too bad there were no links that showed how I could get those few hours of my life back.
If·I·over-thought the 3rd option,·blame the fact that it's the weekend and blame the kind folks at Anheuser-Busch and all the great work they do for that .
If option number three ends up not being an option, no biggie. I'll probably end up going with option number two since I'm getting wicked good with a soldering iron and don't mind using 4 SX-48's. For the·pushbuttons, LED's, and LCD display(s) I'll probably end up using maybe another SX-48 and maybe an SX-28. And that leads me to my next question.
If I'm going to be wiring up 6 SX's on the same circuit board, can I use a single resonator for all of them, or does each SX absolutely have to have it own. That question just came to me as I was typing·this out so I haven't even tried to look it up, yet.
·
Comments
·and it seems to be covered there.
ww1.microchip.com/downloads/en/AppNotes/00245a.pdf
While this does talk about using this chip with a PIC processor, the basic hookup can probably be ported over to the SX without too much trouble. However, I2C is designed for limited distances, say 3 to 5 meters. However, you could probably feed these signals to an RS485 converter and pump them over a thousand feet, where you would use another converter to restore them to TTL levels. The LTC485 and LTC1481 chips come to mind. These are available at Digikey for a couple of bucks each.
Hope this helps.
kenjj
PS What in tarnation are you building here?
What are the pots for?
Since you speak about ADC, I am assuming you are going to convert the pot settings to a digital value. If that is the case, could you instead have 128 "virtual software pots" made by running 128 counters up/down with a "select" and "up/down" buttons. All that could be easily done with one 8 bit SX port, a dozen leds and 4 push buttons.........a very skinny hardware count and a cost of $1.00
I'm assuming here that you dont need to "see" the settings of all of the "pots" all of the time.
Cheers,
Peter (pjv)
With the MIDI software I am currently using, the only way I have right now to·adjust instrument and effect·settings "on the fly" while recording music is to use my PC's keyboard and mouse. Granted, it is effective and does work, but it is·a rather limited and time consuming·way of doing it. This is where having a dedicated·input device with a bunch of potentiometers would come in handy.·It would be·much more intuitive and quicker to simply turn a knob than to have to scroll through a menu until I to correct setting and then adjust it.
·
http://www.ucapps.de/
It's PIC based, but they work well, and can be really amazing if you have the fab skills.
-dave
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
This is not a sig. This is a duck. Quack.
Am I right here? Doesn't MIDI address elements in the "chain" like this?
'Luck!
kenjj
in case you have my SX book on hand, you can find some stuff in the applications examples section concerning I²C communications that might be of interest. I have derived this example from a project that I did for a manufacturer of electronic organs (actually, this was my very first SX-based project).
The "real" project covered several panels, one with 64 LEDs and 64 pushbuttons, another one with 60 LEDs and 60 pushbuttons and an incremental encoder ("Data Wheel"), and some boards with 16 pots ("drawbars") each. All of these boards have their own SX28, and all boards communicate via I²C with one additional "master" board (with another SX). This "master" converts the incoming and outgoing information from/to MIDI messages exchanged between the "master", and a PC.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Greetings from Germany,
Günther
I know. If you check the 4th post in this thread you'll see I actually mention that web site. The reason I desided to "reinvent the wheel" on this project is becuase I really like working with the SX's. In order to use any of the designs on that web site I would either have to buy/build a programmer for the PIC's or port the code to work with an SX. Neither of those options would be very difficult or expensive. But, I just simply don't want to do it.
kenjj,
As far as getting the values from each of the pot's, what you described is kinda close to what I am planning on doing.·But if I'm·reading what you said correctly, there is one slight err with what you described.
I have to admit that I'm still learning the MIDI specification. But from what I have learned,·the software I'm using would be the MIDI device and·what I am planning on building would be·the controller used to tell the device what to do. The device·does·not·query the controller·for the·data.·But instead, the controller·sends·data to the device on an event changes. The processor(s), as you described, would constantly be checking the value of the pots. But,·if none of the values have changed then no data will be sent.
Guenther,
That chapter of your book is actually what first inspired me to use multiple SX's. I don't think I've built anything an SX yet without first reaching for your book to see if there is already an example. I'm not big on using the "L" word, but I can honestly say I LOVE your book.
I appriciate the replies to my original post, but I'll still wondering·one thing.·Is there a way to matrix·potentiometers·in a·way simular to how LED's and pushbutton's can be matrixed?
thanks for your kind words. I'm always glad to hear from people who use my book for something else but killing flies .
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Greetings from Germany,
G
how would you know if any of the pots change without constantly checking for individual changes? an addressed adc does not change the fact that the pots must be sampled continuously.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
engineer, fireman, bowler, father, WoW addict [noparse];)[/noparse]
I haven't wired this up to test it, but you might be able to "matrix" the pots.
Consider 8 pots with one end of the resister tied to ground, and the other end tied to 1 of 8 port pins.· The wipers are all tied together and connected to a single ADC input.· Turn the pots on one-at-a-time with a "high" output the desired port pin and read the voltage on the ADC.
Of course this won't work because the other pots are in parallel an mess things up.· So, maybe a forward biased diode between each wiper connnection and the common ADC input would isolate each one, just like when using switch matrices.
There are a few things to consider with this experiment.· The exact voltage you read will be influenced the the voltage of the "high" port pin, and the characteristics of the diode.· There are some workarounds for this, but given your application these limitations might not matter.
For your matrix effect create 8 of these things, each set with its common wiper connection going to a different input on and 8 input ADC, and each pot of a "set" connected to the same "selecting" port pin.
I'm not sure how well this would work, but it sounds like you are really just having fun building it, so try it out...
My $0.02
Jim
in my application, I designed the 16 pot units as well as the 64 pushbutton/LED units and others as I²C masters, tied together in a multi-master I²C bus system, i.e. each unit can handle bus arbitration situations, and will try to re-send pending change information in case it lost bus arbitration. With this configuration, there is no need for the "super master" to constantly check for individual changes. Instead, when a pot unit detects a pot change, it sends a message to the "super master". Similarly, the pushbutton units send a message when a button-down, or button-up event has been detected. Besides this, the "super master" can also request states from all units in order to initialize the whole system after a power-on.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Greetings from Germany,
Günther
oic, i did not realize he was using a scheme as such. but there is a mcu continuously reading pots (not triggering interrupts or something like so in the main mcu). the time-costly task is removed from the main mcu. encapsulation: its a good thing. and now you've got me buzzin on multi master i2c nets.
bzzz
nick
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
engineer, fireman, bowler, father, WoW addict [noparse];)[/noparse]
that's right - on the pot board, the mcu is constantly reading the current setting of all pots. In an array of 16 bytes, I hold the last value read for each pot. After a new A/D conversion I compare the new result against the last one. When it differs, I send a change message to the "super master". When this was successful, I save the new value in the array. If not, I don't save it. Thus, when the same pot is read the next time, the unit automatically tries to send a new change message in case the pot val still differs from the saved one.
The maximum value I allow for a pot reading is 254, and not 255 - why?
Well, on the other hand, the "super master" can secifically have the unit send the setting of one or all pots. In this case, when it receives such a request, it writes 255 to the last value register, or 255s to all last value registers. This causes the pot unit to automatically send one or 16 change messages when it reads the pot(s) next time, as the last value and the current value are definitely different in this case. With this "trick", it was not necessary to specify a special answer format for "super master" requests.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Greetings from Germany,
G