the order in which some switches are turned on

Hi all,

I have an array of N switches . Initially all are OFF.

Somebody turns them ON in some order. It is possible that more switches are turned ON in the same moment.

I need a device which shows me the order in which the switches were turned ON. For instance the device should give me: 4,3,1,5,2 (this is the order in which the switches were turned ON).

The way in which the output is shown in not important. It must be simple to read (by a human, computer, etc).

It is important that the device is able to handle the turned ON (in the same moment) of the multiple switches.

thanks, Laura

Reply to
laura
Loading thread data ...

Hi Laura, FPGAs can do what you want, though it might be simpler do solve with a microcontroller.

The tricky thing is to define "in the same moment" more technically. If the switches are operated manually it is virtually impossible to have two switches changing their state "in the same moment", even if they are mechanically coupled. The mechanical parts have their tolerances and that leads to some micro-nano-whatsoever seconds of difference. The question is: How precise do you want to detect the states of the switches and determine changes. Furthermore, even if you choose a low time resolution the asynchronous incoming events of 2 switches may happen around the moment of sampling the states of the switches. So you get two events instead of the expected/desired single one.

The rest is a simple act of storing, and transmitting/displaying the information. That's just depends on your hardware.

In general: Your requirements are too loose. Be more specific. What means "must be simple to read" A bunch of lamps would do it, but then: "by a human, computer, etc" Humans and computers barely read the same things easily (e.g printout vs. RS232). And who is etc? ET's-Companion? :-)

Anyway, wether you choose FPGAs or microcontroller to solve the problem you have to make a decision about the way the device shall interact with the rest of the world, and then just do it. (Which means write some code to describe the hardware or program a processor or both )

Have a nice synthesis Eilert

laura schrieb:

Reply to
backhus

You can create a process that will be triggered by a clock. The faster this clock is, more accurate your timing will be - ie not more then one switch will be turned on for one clock cycle. At every clock event all the switches are read, and if one of them is turned on, its value is written by this process to some array that will give you the order of the switches. Hope this help. Dan

Reply to
jkljljklk

Depending on your definition of 'the same moment', and realizing that real switches often bounce.

Latch the switch inputs, latch the latch output, and compare them. (Use XOR gates.) A priority encoder will tell you which one changed. More logic will detect any multiple switch transitions, but if you have a fast enough clock, those should be rare.

Are you only detecting ON transitions, and ignoring any that go OFF, then on again? In that case, have the second latch only detect ON transitions. You will need a reset signal to start over again.

My favorite switch/logic puzzle from many years ago:

You have a long hallway with N lights. There is a switch at each end, and one between each light (N+1 switches total), such that you can walk down the hall flipping switches. Each one will turn on the light in front of you, and turn off the light behind.

Assuming only switches, light bulbs, and a power source (no computers or logic gates), what is the simplest switch configuration needed to make this work. (For example, SPST, SPDT, DPST, DPDT, etc.) How should the switches and lights be wired up?

-- glen

Reply to
glen herrmannsfeldt

The original problem description seems to imply that the reset would happen when all switches are turned OFF.

Good puzzle. Everyone knows the one where each switch turns on or off all of the lights (sometimes known as the stairway landing switch problem).

Cheers, Gabor

Reply to
Gabor

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.