From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

RESET Button

Solved!
Go to solution

Hello,

 

I was wondering what would be the best soultion to have a "reset button" for the attached program. I want to ne able to reconnect to the instrument any time the reset button is pressed.

 

Thank you so much in advance for kind help.

0 Kudos
Message 1 of 6
(3,184 Views)
Solution
Accepted by topic author RezaTAMU

Operating under the assumption that by "reset" you mean to reinitialize the connection to the VISA device... Using the current architecture, I would add a new event case that closes the current connection and reinitializes it. See attached.

 

This can be done a bit more cleanly with a state machine that has "initialize" and "close" cases.

 

**EDIT** It's very important that you replace the VISA session tunnels on the while loop with a shift register. I've updated the file to reflect this.

 

**EDIT 2** Looks like the "format string" function which formed the string to close the connection was wired to the "initial string" node instead of the "format string" node. I have fixed this and updated the vi again.

Message 2 of 6
(3,153 Views)

I took a closer look at your string formatting and it occurred to me that there's a bit more in there that needs to be. Assuming the string you want to have at the end is "AMPR -110.000000", all you need to have in the format string is "AMPR %f"

 

See the attached snippet for a comparison.

 

Snippet.png

Message 3 of 6
(3,141 Views)

@B_Strange wrote:

I took a closer look at your string formatting and it occurred to me that there's a bit more in there that needs to be. Assuming the string you want to have at the end is "AMPR -110.000000", all you need to have in the format string is "AMPR %f"


I have started using "%#g" for my SCPI drivers.  Adding that '#' in the middle tells the formatter to drop off any trailing 0s.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 4 of 6
(3,103 Views)

Thank you so much for kind attentiona nd help!

0 Kudos
Message 5 of 6
(3,081 Views)

Thanks!! 

0 Kudos
Message 6 of 6
(3,080 Views)