Jump to content

Binary Issue


Michael_Burgess

Recommended Posts

Hiya,

Got an little issue i've spent a few days thinking about RE a programming solution - sort of getting there but got myself stuck on something.

Basically, i've got an I/O card on a PC - which has 3 8-bit I/O ports.

I have set Port A to output, Port B to input and Port C to output (Port C isn't really an issue right now).

Basically, I want Port A's output to react to differing inputs on Port B.

So, there's proximity sensors and other input devices on Port B. If need be they pass through an ADC, so all the Port B inputs are discrete binary values.

The most significant bit on the port carries a value of 128, due to it being an 8-bit port, down to 1 for the most insignificant bit, and if all sensors were getting input the value would be 255, down to a value of zero when there's no input.

I need to find a way of breaking down the input value (I am just presented with a single input value, say, 156 for example) and working out what sensors have been activated, enabling me to arrive at an output value for both ports A and C. That second part I have sorted in my head no sweat - just this issue with working out Port B's input is flummoxing me!

The inputs I have grouped logically round the system - there's effectively 6 subsystems I have identified, although this shouldn't really make a difference to the method used to establish which sensors have been activated.

Can anyone guide me at all please? I'm not very well up on how Labview can control binary as i'm still new(ish!) to it!

I know I could probably do a binary look up table with a 256x8 array and then take the binary equivalent from the table, say, 11101011 for instance and from that work out which sensors have been activated and act accordingly?

I know that a big array may be a lot of code, but it will be very quick to responde surely? This is going to be a real-time system, so reaction speed is key!

Any help guys and it'd be much appreciated - cheers :)

Michael

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.