LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Running Average from 5 Samples taken at 20mSec appart!

Solved!
Go to solution

Thank you for the reply.

I  read the value from the local variable in the main loop  to make a logical decision if there is an error bit set in the machine .The idea is to have a led indicating the error status and then the main loop will set the Speed request to the machine at zero (0)  besides the read there is no other writes to the variable as the bit gets cleared by the machine when the error is not present thus the logical operation in my code automatically is cleared by the machine , As for the Temperature values the value of 40  = 0 temp from the machine.

 

Kind Regards 

QMESAR 

---------------------------------------------------------------------------------------
Learning is an endless process but needs to start some where
0 Kudos
Message 21 of 29
(1,228 Views)

Hi QMESAR,

 

It sounds like you have a good use case for a local variable here. You can read about it more at Local Variables. As for the temperatures, it sounds like you're following what altenbach said, which is correct!

 

If you cannot guarantee that the -40 subtraction will fit without a wraparound (going 'below' 0), then you could just implement it as an I16 (Integer, 16-bit), to avoid any problems. Unless you're trying to make this code extra efficient, you could just go with the Integer data-type to be safe.

 

Hope that helps!

Timothy D.
Applications Engineering
National Instruments
Message 22 of 29
(1,212 Views)

@QMESAR wrote:

I  read the value from the local variable in the main loop  to make a logical decision if there is an error bit set in the machine 


I assume you wanted to say that you read the value from the terminal in the main loop while writing to a local variable of that terminal in the above code. There is a problem with that.

 

Overuse of local variables can blur the distinction between controls and indicators. This particular boolean is not a user input but the result of a computation. The value is determined by the code, not by the users! In this case, the boolean needs to be an indicator and the terminal placed where you currently have the local variable. In the main loop you could read from a local variable iof that indicator if needed.

0 Kudos
Message 23 of 29
(1,203 Views)

Hi Timothy D.

Thank you every  much for  your kind answer much appreciates ,Smiley Happy

 

 

Regards 

QMESAR 

 

---------------------------------------------------------------------------------------
Learning is an endless process but needs to start some where
0 Kudos
Message 24 of 29
(1,202 Views)

Dear altenbach,

Thank you very much for all your help and valuable teaching .

I realize that In know just about zero about labVIEW and every piece of code I do, is a struggle within me is this correct or incorrect or totally bad things I am doing,(I am out of the mcu C world and this is all very new to me)

I think I  got what you are saying about the terminal and to many local variables ,I have only this one local variable

in my code.I change the code to this .The read is done in the main over a local Variable of this GEN ERROR .

 

.1.jpg

 

Regards 

QMESAR

---------------------------------------------------------------------------------------
Learning is an endless process but needs to start some where
0 Kudos
Message 25 of 29
(1,196 Views)

It's mostly the same logic, just a very different representation between C and LV.

There's no use declaring 2 identical Constants in C, is there? The same logic applies here, just use 1 0x80 and wire to both functions. 🙂

 

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 26 of 29
(1,180 Views)

@Yamaeda wrote:

The same logic applies here, just use 1 0x80 and wire to both functions. 🙂

 


Even simpler, do the AND with x80 followed by "not equal zero" for the same result. 😄

Message 27 of 29
(1,173 Views)

Hi All

 

Thank  you for the help /comments . I appreciate each and very one Smiley Happy

 

Regards

QMESAR

 

---------------------------------------------------------------------------------------
Learning is an endless process but needs to start some where
Message 28 of 29
(1,154 Views)

Hi All.

I am just back here to say a big thank you to each and every one that helped me out here,as this was my very first 

application after doing a basic course it was an uphill for me .

i did all the changes as suggested and tried to read up on  all the comments /topics touched  to find additional info to it and I can only say that this has shown me that from the basics learning loops and variables etc to applying it to a real world application is miles apart.any case I did mange also to get to build my first executable and the vehicle was out on the test track for 4 Hours with the application Code Executable running and doing what it should.

i have a few question regarding setting up a front panel correctly but that is for next week .

Thank you again all is/was very much appreciated and have a great weekend

Regards 

QMESAR 

---------------------------------------------------------------------------------------
Learning is an endless process but needs to start some where
Message 29 of 29
(1,134 Views)