LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
Stalin@NSTL

Is it possile to Incorporate Boolean Toggle Function

Status: Declined

Any idea that has received less than 2 kudos within 2 years after posting will be automatically declined.

Dear All,

 

The toggle bit function is very essential to toggle the flags set in the progam.

Right now we have to doit in inderect manner shown in attachement.

 

It will be very useful when we have a bit toggle boolean function. Not just inverting bit it has to toggle specified flag.

 

If it is already availble in any other form please let me know.

 

 

Regards,

Y.Stalin

14 Comments
altenbach
Knight of NI

The suggestions here provides a significantly better way to do all this. Trust us!

 

In order to invert a boolean local variable, you need to read the existing state one way or another, so you need to do the "read..modify..write" as in your original code. What else do you expect?

 

To be fair, you did asked "If it is already availble in any other form please let me know", and, sure enough, we let you know! 😄

 

The suggested alternatives keeps the state in an USR, a much more reasonable choice because it does not need to involve a front panel object. It seems you are using front panel objects as "variables", which is not in the spirit of LabVIEW. Keep the data on the diagram (e.g. in an action engine, shift register, etc.). Front panel objects are for communicating with the user and not to blindly hold data. Even though the term "Local variable" might falsely suggest it, they have nothing to do with "variables" in classic programming languages. Don't abuse them as such.

 

I would be interested in more details of you application and where you think you need all that. Please start a new thread in the plain LabVIEW forum, and we can possible show you better ways in a more applied context.

 

Good luck! 

Stalin@NSTL
Member

Dear All,

 

Thanks for your valuble suggestions. First of All It is not about criticizing each other or hurting some one.

 

My basic idea is to know, weather my code is acceptable or not (as per spirit of LabVIEW ). And if i am right it will be useful to many

other programmers.  

 

Initially i thought that my idea was good, but after your clear explanation about LABVIEW variables,

 

I understood everything.

 

Thanks for your co-operation

 

-Stalin

 

 

 

 

 

AristosQueue (NI)
NI Employee (retired)

> None of your codes are simlifieng the function than what i have posted in my query.

 

Ah, but the code we posted is parallel thread safe. The raw variable approach is not.

 

Darren
Proven Zealot
Status changed to: Declined

Any idea that has received less than 2 kudos within 2 years after posting will be automatically declined.