11-06-2014 08:09 AM
Hello!
I have a boolean button HVenable which will be used to enable/disable the high voltage output of a voltage source.
The problem:
I only need one True value to send the Open HV command
and one False value to send the Close HV command; the boolean button sends a continuous train of True values when it is on and a continuous train of F values when off.
How can I convert a transition from off to on / F to T into a single 1 impulse or T impulse
and the transition from on to off/ T to F into a single 0 impulse or T impulse.
What instrument converts a transition from F to T into a 1 or T impulse
and a transition from T to F into a 0 impulse (different from the first kind of transition)?
In the attached test vi, such an instrument would be inserted between HVenable button and Select;
when True it will send an open command to visa O 01 CR
when False it will send a close command O 00 CR.
Solved! Go to Solution.
11-06-2014 08:36 AM
First, Do Not Use Continuous Run to make code run more than once! Place the repeating code inside a loop. Continuous Run is a troubleshooting tool to be used (sparingly) during development.
The key to your issue is to use the Event structure. A Value Change event on the HVenable boolean will do exactly what you want.
You do not need Type Cast and all the conversions. Set string constants to '\' Codes display mode and enter the data you want.
Lynn
11-06-2014 09:44 AM
Thank you, Johnsold !
I was hoping there existed a simple instrument for this task because I think change transitions are oftenly used to trigger events .
I set the constants entering Select funct. to U8 and got rid of the U8 converter but I did need the Type cast function to convert the U8 exiting the Select function to ascii 0 or 1 because VIsa write converts it to Hexa before sendind it to the Instrument I am commanding;
that instrument needs to receive ""4F 01 0D"" which is ascii ""O SOH(start of heading) CR(carriage return)"".
It works this way, with the Type cast (other ideas are welcomed).
11-06-2014 10:00 AM
The code I posted earlier sends hex 4F 01 0D or 4F 00 0D. Change the display mode on the hv string indicator to Hex mode.
The display mode does not affect what is actually in the string. The data is determined by what you put on the wire, not how you display it.
The VI attached shows the same data displayed three different ways. It also shows a way to generate it from numerics as well as strings. No Type Cast required.
Lynn
11-17-2014 02:57 AM
Hello!
I apologize for the delay: I used your recommendation and it worked.
I am glad for having got rid of Type cast (I like the things I do to be as simple as possible, to require minimum energy from the machine).
Thank you, johnsold !
PS:Thanks to your VI I got to see how an array can be used.