Osvath Markus Posted April 24, 2014 Report Share Posted April 24, 2014 Hi everyone, I have to control a LED matrix from an ARM µP. There are 64 LEDs controlled from an interface in LV. I have to check every 100ms if any LED has change his state and call another VI, that sends data to the ARM and changes also the state of that LED. I am trying to create an array of booleans and check with a shift register if anything has changed but i have trouble with indexing and creating the array of booleans. I don't know if its better to let the LEDs as booleans of convert them to 0,1. Sincerely, Markus Osvath. Quote Link to comment
Mellroth Posted April 24, 2014 Report Share Posted April 24, 2014 Could you share your code? Comparing the LED arrays should be quite straight forward, and goes something like; 1. compare the LED arrays using NotEqual 2. Find index of first element in the NotEqual output that is TRUE, e.g. using ArraySearch 3. Continue to search for changes starting at the last detected index+1 4. stop search when no more changes are found /J Quote Link to comment
Rolf Kalbermatter Posted April 28, 2014 Report Share Posted April 28, 2014 Hi everyone, I have to control a LED matrix from an ARM µP. There are 64 LEDs controlled from an interface in LV. I have to check every 100ms if any LED has change his state and call another VI, that sends data to the ARM and changes also the state of that LED. I am trying to create an array of booleans and check with a shift register if anything has changed but i have trouble with indexing and creating the array of booleans. I don't know if its better to let the LEDs as booleans of convert them to 0,1. Sincerely, Markus Osvath. Performance is likely not that much of a concern in this application but I would definitely implement this as a single 64 bit integer (or maybe two 32 bit integers) and use boolean logic on it to compare and work with it. "old integer" EXOR "new integer" != 0 will tell you if something has changed and then you can eventually detect which bits changed too. It's a little bit more mathematics than trying to do it with a boolean array but works much faster and with less code. 1 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.