Author Topic: Priority encoder  (Read 1823 times)

0 Members and 1 Guest are viewing this topic.

Offline gaminnTopic starter

  • Frequent Contributor
  • **
  • Posts: 343
  • Country: 00
Priority encoder
« on: August 23, 2019, 11:08:17 am »
Hi,
I'm looking for a device similar to priority encoder. I have 3 inputs a 3 outputs.

If input 3 is high (no matter what level is on input 2 and 1) then output 3 is high and all other outputs are low
If input 2 is high (no matter what level is on input 1) then output 2 is high and all other outputs are low
If input 1 is high then output 1 is high and all other outputs are low

Is there any IC available that do this logic?
 

Offline JuanGg

  • Regular Contributor
  • *
  • Posts: 193
  • Country: es
    • My personal blog
Re: Priority encoder
« Reply #1 on: August 23, 2019, 12:31:26 pm »
It should not be too hard to make a truth table and design a circuit with some nand gates to perform the task.
Attached is a schematic that will do with a couple quad nand gates. Something like that, I'm sure there are plenty of ways of doing it.
    Juan

EDIT: Thanks to Renate for pointing out a major simplification.
« Last Edit: August 24, 2019, 07:23:00 pm by JuanGg »
 

Offline gaminnTopic starter

  • Frequent Contributor
  • **
  • Posts: 343
  • Country: 00
Re: Priority encoder
« Reply #2 on: August 23, 2019, 12:59:01 pm »
I know but I hope there is a suitable part that can do this in one package.

This can do what I want: http://www.mouser.com/datasheet/2/308/MC14532B-D-96716.pdf but if there is something with less inputs....
 

Offline ledtester

  • Super Contributor
  • ***
  • Posts: 3279
  • Country: us
Re: Priority encoder
« Reply #3 on: August 23, 2019, 01:01:55 pm »
Use a priority encoder ic like a 74LS148 followed by a demultiplexer like a 74LS138.

Note that the '148 uses active low logic.
 

Offline jhpadjustable

  • Frequent Contributor
  • **
  • Posts: 295
  • Country: us
  • Salt 'n' pepper beard
Re: Priority encoder
« Reply #4 on: August 23, 2019, 01:35:09 pm »
That would be a priority arbiter.

Some details would be nice. What's the application? What are you optimizing for in this project? How fast does it have to be? What's wrong with the 4532 and what do you need instead?

I doubt you'll find that function in an orderable package, but you should review the compiled lists of 7400, 4000, and 74xG00 series logic, as on Wikipedia or elsewhere, just in case I missed one. You might be able to assemble the function out of only a couple of small packages using the 74xG series. If it doesn't have to work at several MHz (and honestly if you're using CD4000 series logic it probably doesn't) I doubt it takes all of 20 instructions in 8-bit machine code.
« Last Edit: August 23, 2019, 01:41:29 pm by jhpadjustable »
"There are more things in heaven and earth, Arduino, than are dreamt of in your philosophy."
 

Offline Renate

  • Super Contributor
  • ***
  • Posts: 1460
  • Country: us
Re: Priority encoder
« Reply #5 on: August 23, 2019, 01:37:40 pm »
@JuanGg The second output reduces to 2 = B ยท /C

I'm not quite joking because this is the way I'd do it with parts on hand.
Use an Atmel ATtiny85 uP. It's an 8 pin DIP, 3 in, 3 out, 2 power.
If your use case involved "break-before-make" or timing considerations it would be easy to add.
 

Offline gaminnTopic starter

  • Frequent Contributor
  • **
  • Posts: 343
  • Country: 00
Re: Priority encoder
« Reply #6 on: August 23, 2019, 02:42:25 pm »
It seems I will use MC14532B, as this is the only part that can do what I need in one package.

The application is power path switching.
 

Offline Renate

  • Super Contributor
  • ***
  • Posts: 1460
  • Country: us
Re: Priority encoder
« Reply #7 on: August 23, 2019, 04:16:03 pm »
Well, I'll just add a couple of thoughts to the whole thing.

As you can see by searching, priority encoders aren't a real popular thing nowadays.
Ok, they are fine if you are really condensing symmetrical things, like interrupts in old-age discrete processors.
But today we might need something more advanced like "which asserted input have we addressed the longest time ago?"
Moreover, a priority encoder may not be the best design to shoe-horn in some logic that doesn't really scream "priority encoder".

If this is all USB related, you may find that switching things around does not work reliably unless there is a properly sequenced virtual "unplug, pause, plug".
 

Offline ledtester

  • Super Contributor
  • ***
  • Posts: 3279
  • Country: us
Re: Priority encoder
« Reply #8 on: August 23, 2019, 04:55:40 pm »
Oh I get it -- you use inputs 1, 2 and 4 and then you don't need the demultiplexer.
 

Online David Hess

  • Super Contributor
  • ***
  • Posts: 17427
  • Country: us
  • DavidH
Re: Priority encoder
« Reply #9 on: August 23, 2019, 05:36:03 pm »
Any asynchronous parallel non-volatile memory could also be programed to do this function.  This includes PROMs, EPROMs, PALs, GALs, and CPLDs.

A priority encoder followed by a 2-to-4 or 3-to-8 decoder was my first thought but requires two packages.

A microcontroller is probably the least expensive solution now but much slower.  The cheapest PLD I could find was about $1.50.

Update: There are some EEPLDs available for about 75 cents.
« Last Edit: August 23, 2019, 05:49:26 pm by David Hess »
 

Offline ledtester

  • Super Contributor
  • ***
  • Posts: 3279
  • Country: us
Re: Priority encoder
« Reply #10 on: August 23, 2019, 05:44:41 pm »
A priority encoder followed by a 2-to-4 or 3-to-8 decoder was my first thought but requires two packages.

In this situation you don't need the decoder if you use inputs 1, 2 and 4 of the priority encoder.
 

Offline MarkF

  • Super Contributor
  • ***
  • Posts: 2762
  • Country: us
Re: Priority encoder
« Reply #11 on: August 23, 2019, 05:58:35 pm »
You could use a small 8-pin microcontroller like a PIC12(L)F1822.
However, you would need to be aware of the input sample rate and propagation delay achievable.
 

Online David Hess

  • Super Contributor
  • ***
  • Posts: 17427
  • Country: us
  • DavidH
Re: Priority encoder
« Reply #12 on: August 23, 2019, 09:36:57 pm »
A priority encoder followed by a 2-to-4 or 3-to-8 decoder was my first thought but requires two packages.

In this situation you don't need the decoder if you use inputs 1, 2 and 4 of the priority encoder.

Oh, well, there it is.  Problem solved.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf