LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to use boolean transition as trigger 0to1=> 1impulse, 1to0=> 0 impulse

Solved!
Go to solution

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.

0 Kudos
Message 1 of 5
(3,719 Views)
Solution
Accepted by topic author TibiG

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

Message 2 of 5
(3,711 Views)

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).

 

0 Kudos
Message 3 of 5
(3,693 Views)

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

0 Kudos
Message 4 of 5
(3,685 Views)

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, 

 

 

0 Kudos
Message 5 of 5
(3,554 Views)