Jump to content

Comparing arrays of booleans


Recommended Posts

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.

Link to comment

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

 

 

Link to comment
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.

  • Like 1
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.