trying to create a "priority switch"?

Discussion in 'General Electronics Chat' started by pgo1, Jun 11, 2019.

  1. pgo1

    Thread Starter Active Member

    Nov 7, 2012
    48
    0
    I'm trying to create a quantising circuit to quantise a signal at 1 volt steps. The input is a +/-4V analog signal - the signal is quantised in steps of 1 volt, giving 9 possible output conditions. Normally the output condition for -4V is set, and is "overridden" by anything higher. You can select to disable certain some of the steps if you want to, for example i can disable the steps at 1 and 2 volts, and the output will change at 0v but not again until the input reaches 3V. I decided to implement this with analog, given that im more comfortable with components than microprocessors

    Im trying to think of the neatest, cheapest and smallest way of selecting which output state is in operation. Logic to drive the all the inputs low seems to get a bit messy when I consider the chip packages available. I thought of using an encoder and multiplexer, but since some of the states are not always on i can't count sequentially which makes the implementation a bit more messy. I was thinking maybe there is a more clever way to do it - something like a multiplexer but with 9 inputs, the higher of which has priority over the others - 2 has priority over 1, 3 over 2 and 1 etc all the way up to 9 which has priority over all of them - only the highest input is ever "active"

    does this type of circuit have a name? How can i achieve this?
     
  2. AlbertHall

    AAC Fanatic!

    Jun 4, 2014
    7,786
    1,916
    ;) It's dead easy with a very small microcontroller. ;)
     
  3. djsfantasi

    AAC Fanatic!

    Apr 11, 2010
    5,091
    1,938
    But the TS doesn’t want to use a micro-controller. But then states the solution should be the “neatest, cheapest and smallest” solution. That is indeed a microprocessor.

    There are simple solutions that do not require a heavy duty micro-controller. Just a simple one, especially if the determination of the steps to be skipped are constant. Then an 8 pin micro-controller is all the TS needs.

    I suspect unless the TS is an expert in analog circuit design, coming up with an analog circuit will be much, much harder than a digital solution.

    If the steps to be skipped can be defined in code, all he needs is a micro-controller with more than two input/output pins. And simple code.

    With supporting circuitry (of which the TS claims familiarity) to shift -4v to 4v to 0V to 4v, the TS could map the input range to values from 0-9. That requires two lines of code. Then with two lines of code, it’s entirely possible to output the desired signal. Thus, excluding setup, his function is realized in four lines of code (Disclaimer: I haven’t actually written this code).

    Too bad the TS has eliminated a micro-controller solution.
     
  4. crutschow

    Expert

    Mar 14, 2008
    22,237
    6,487
    I agree, the this gets rather messy using a non-microcontroller approach, especially if you want to arbitrarily skip steps.
    It would appear that, if you really want the simplest design, it's time to bite-the-bullet and learn how to do some simple programming.
    There are several on this website that would be happy to help you with that.
     
    cmartinez likes this.
  5. BobaMosfet

    AAC Fanatic!

    Jul 1, 2009
    637
    149
    Use a resistance ladder and control it with logic gates.
     
  6. ebeowulf17

    Distinguished Member

    Aug 12, 2014
    2,884
    623
    Just for a moment, I'm going to cheat and ignore the arbitrarily skipping steps part. With that out of the way, couldn't you connect each voltage source in question to the anode of a diode, then tie all of their cathodes together as the output? That would give you the highest voltage, minus the Vf of the diode. Then you can use a simple voltage follower op amp configuration with a diode in the feedback loop to (approximately) add back the diode Vf. Should get pretty close, I think.
     
  7. MisterBill2

    Distinguished Member

    Jan 23, 2018
    3,349
    660
    In my RCA CMOS digital data book there are 2 "priority encoder" IC.s CD4532B and CD40147B. Really, you can also do it with a simple A/D converter and some magnitude comparator ICs. (CD4063B) OR you can use just the binary output and "AND" gates. That digital logic does get a bit tedious but not nearly as bad as with a micro controller. But just using AND gates to decode the binary number and then OR gates to do the grouping will provide the functionality that you are asking for. Fairly simple in that it can be done with no counters or state machines and each condition can be done by itself.
     
  8. crutschow

    Expert

    Mar 14, 2008
    22,237
    6,487
    I believe he has only one voltage source that varies in voltage.
     
  9. ebeowulf17

    Distinguished Member

    Aug 12, 2014
    2,884
    623
    Fair enough... although in that case I don't understand what it means to make higher outputs take priority over lower ones.

    It's safe to say I don't fully understand the intended circuit here. Maybe if there was a schematic, I could catch up and be more helpful. Failing that, I'll just sit this one out.
     
  10. MisterBill2

    Distinguished Member

    Jan 23, 2018
    3,349
    660
    I think that the priority encoder IC may be able to deliver what is wanted, but the whole package concept is a bit unclear. Probably a graph or chart will help to clarify the intended functionality, a circuit would not help very much.
    Just like many requests, explaining the whole thing allows answers that are better than guesses.
     
  11. pgo1

    Thread Starter Active Member

    Nov 7, 2012
    48
    0
    aha! yes that is exactly what i needed. Thanks

    for those still wondering i can actually program microcontrollers but I just don't particularly like them, plus, it's fun to see what you can achieve with only analogue. and yes, in future ill provide a schematic :)
     
  12. ebeowulf17

    Distinguished Member

    Aug 12, 2014
    2,884
    623
    I'm glad you've found your solution!

    I must admit that I obviously really don't understand the situation, because I'm not following how the priority encoder does what you need.

    Anyway, best of luck with what sounds like an interesting project. If/when you end up with a schematic of this project (whether complete or just work in progress,) I'd be very interested in seeing it.

    Cheers!
     
  13. djsfantasi

    AAC Fanatic!

    Apr 11, 2010
    5,091
    1,938
    I think that if he has several comparators (one for each step) feeding into the priority encoder, then the priority encoder will output (in binary) the highest level.
     
    cmartinez and eetech00 like this.
  14. eetech00

    Senior Member

    Jun 8, 2013
    1,540
    305
    Maybe re-scale the bi-polar signal to a 0-(to some convenient +level) signal using an opamp, then use the comparators...

    eT
     
    djsfantasi likes this.
  15. djsfantasi

    AAC Fanatic!

    Apr 11, 2010
    5,091
    1,938
    I had suggested that as part of a microprocessor circuit. I guess it stuck in my head, because I assumed your suggestion was being used.
     
  16. eetech00

    Senior Member

    Jun 8, 2013
    1,540
    305
    Then your suggestion was a very good one;)

    I was thinking bipolar in-> Opamp (scaler)->Cmp(s)->PE(input to binary out)->something other than uC (depending on the goal).

    Edit:
    Might be able to replace "Cmp(s)" with LM3917.

    Anyway...good call...
     
    Last edited: Jun 14, 2019
Loading...