Michael_Burgess Posted February 18, 2005 Report Share Posted February 18, 2005 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 Quote Link to comment
todd Posted February 18, 2005 Report Share Posted February 18, 2005 The obvious (therefore probably wrong) answer is "Number to Boolean Array". (At least my post count goes up " Quote Link to comment
dswaine Posted February 18, 2005 Report Share Posted February 18, 2005 Michael, Apologies if I'm missing something, but does your question boil down to: "How can I easily get discrete bit/boolean values from a U8?" If yes, then the answer is: "Numeric>Conversion>Number to Boolean Array" Quote Link to comment
Michael_Burgess Posted February 18, 2005 Author Report Share Posted February 18, 2005 thanks to both of you - seems like that may be what i'm after - if I build some functionality on top of that it should see me right - cheers Quote Link to comment
Mark Balla Posted February 21, 2005 Report Share Posted February 21, 2005 I have to do this sort of thing all the time with field point modules. If you want to make it a little more readable you can convert the array to a strict type cluster and then bundle and unbundle by name. I find it much easier to remember a name instead of a number. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.