05-12-2018 02:26 PM
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
05-14-2018 10:43 AM
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!
05-14-2018 11:03 AM
@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.
05-14-2018 11:07 AM
Hi Timothy D.
Thank you every much for your kind answer much appreciates ,
Regards
QMESAR
05-14-2018 12:05 PM
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 .
.
Regards
QMESAR
05-15-2018 09:14 AM
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
05-15-2018 10:23 AM
@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. 😄
05-16-2018 01:06 AM
Hi All
Thank you for the help /comments . I appreciate each and very one
Regards
QMESAR
05-18-2018 11:57 AM - edited 05-18-2018 11:58 AM
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