8/27/2008 3:00 PM | |
Posts: 49 Rating: (5) |
Hi, Multiplexing is a perfectly acceptable strategy, look down at your PC keyboard, do you think that each key has its own input? I've just tried this out on a 222 that I have (only has 6 outputs, but you'll get the idea) I used the outputs q0.0 to q0.5 to supply six rows of a matrix, and connected the input byte (I0.0 to I0.7) to eight columns down the matrix. I then connected switches across some of the intersections. Each switch or button element will need a 1N4001 diode (0.1p each!) in series with it, to ensure that the LOW rows are not taken high by other switches in the column. Attached are screenshots from the program. The top screenshot shows the network which initialises the output byte, the multiplex timing and the interrupt setup. The next screenshot shows the interrupt routine where I ROL the output byte (it's not changed until the end of the scan), read the inputs, and transfer them to the outputs The last screenshot shows the status of the virtual inputs, and as you can see, two switches are closed With the values shown for SMB34 (Time_0_Intrvl) scanned all 48 inputs in less than a second reliably (64 would take the same time). Marc Sinclair http://s7-200.germainesystems.eu |
Last edited by: marcsinclair at: 8/27/2008 10:40 PMClarified my explanation a bit (I hope!) I'm really bad with run-on sentences. |
|
9/22/2008 1:50 AM | |
Posts: 49 Rating: (5) |
A few questions :
|
Follow us on