Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Data Bus

Status
Not open for further replies.

Dario0

New Member
Hi to all,

I'm new at this forum and I need support with an idea for a data bus.

I'm using a PC and a NI digital card to control 15 boards with a led and a switch, I need to identify in wich board the user has pressed the switch, so instead of using a 15 input lines to the digital card (one per switch) I'm trying to use a "data bus" so on each card I have an address (0000, 0001, 0010,...and so on) and presing a switch will pass the board address information to the bus and to the digital card (please see attachment)

The idea is to connect all the "Data bus" lines for each card, to 4 digital inputs on the NI card.

I's there any inconvenient to do this? It's valid to connect all the and outputs together to build this bus?

I'll really appreciate your help.
 

Attachments

  • DataBus.JPG
    DataBus.JPG
    29.6 KB · Views: 111

Diver300

Well-Known Member
Most Helpful Member
What you are looking for is a 16 to 4 priority encoder.

A quick search only came up with the 74LS148, which is an 8 to 3 priority encoder. However, this page:-

https://myweb.msoe.edu/durant/courses/ce1900/prienc164s.pdf

shows how to make a 16 - 4 priority encoder from five 4 - 2 encoders, so you should be able to work out how to make a 16 - 4 encoder from a couple of 8 - 3 encoders and a few other bits of logic.
 

Dario0

New Member
If I use a priority encoder I need to have 1 cable per switch, my idea is to have the 4 lines bus to all the 15 boards and only when one switch is pressed, read the address on the bus.

My question is if I do the conecction for the 15 boards to the Bus is correct?

Thanks
 

KeepItSimpleStupid

Well-Known Member
Most Helpful Member
Your too's and froms seem mixed up, thus I can't follow.

Suppose there was 3 switches per board.
You could have a 4 bit board address and a 2 bit button code.

All could be configured active low, open collector with one pull up.

Because the problem isn't stated clearly, I'm having a difficult time formulating a solution.
 

Dario0

New Member
Let me try to explain it once again.

I have 15 boards with one switch each one, I need to know the card that the user has pressed the switch.

My first option was send a cable for each switch to a digital input bit, so I will need 15 digital inputs bits.

Then I think in using some kind of bus, so i connect 4 lines to each card and these 4 bits to a 4 inputs at the digital card, and when the button is pressed on a specific card, the 4 bit bus contains the address of the specific card .

My question is if there is some problem in connecting the 4 bits on each card (the 4 bits on each card come from the AND outputs) all to the 4 bits on the digital input card?

Thanks
 

crutschow

Well-Known Member
Most Helpful Member
A simple way is to use diode-or logic. Each switch it connected to logic high voltage with the output going though diodes to generate the respective 4-bit address. For example switch "1" output would have one diode connected to bit 1, switch "2" would have one diode connected to bit 2, switch "3" output would have two diodes connected to bits 1 and 2, etc. The four bus lines would each have a resistor (say 1k for CMOS logic) to common to provide a logic zero with no input.
 

KeepItSimpleStupid

Well-Known Member
Most Helpful Member
How about a HEX open collector inverter for each card. You could tie the inputs to a DIP switch to set the address. 4 gates for the address, 1 for the button and 1 spare.

On the input side, use a pull up to VCC.

The issue that you will have is when two buttons are pressed simultaneously, you get giberish.

If you use a priority encoder, 10 positions could be encoded into BCD AND two buttons that are pressed at once will have definate result. I belive the highest number wins.

Now, you could for instance have reset inputs for the cards, so when simultaneous buttons are pressed, they would set appropriate flip-flops on the card. you then may need a way to reset the individual bits.

If simultaneous presses are not an issue, then your OK.
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Top