06-27-2012 03:48 PM
Hi guys,
I need to reinitialize or like reset my counter to zero. I am using a counter that counts the revolution, looking at some examples I can send a command and preset a number of revolution I wanted. I want to have a Reset button that can reset it to and then I can send a new command. Any ideas? here is what the block diagram looks like.
thanks all
06-27-2012 03:55 PM
I'm a little confused... is this a sub-VI or a main application?
It looks like you:
1) Open a serial connection.
2) Optionally send "string to write" over the VISA.
3) Wait, no matter what, some number of ms.
4) Optionally perform a read.
5) Close out and check for errors.
What is your end-goal? Do you want to read repeated values? Do you want to be able to send commands over and over again?
06-27-2012 04:32 PM
Your post doesn't make any sense. What does the bd have to do with your question. You simply need to reset a counter, is this correct? Are you sending the command to reset serially? I would have to assume so. Choose whatever command you want to send at the press of a button. Does it really matter? Please provide more specifics about what you are trying to accomplish.
06-28-2012 07:55 AM
The counter has two things preset and counter. From the program that I have I can send a command set the values of the preset and counter. Instead of writing this command; is there anyway I can just set this two values? My goal is to have two displays and two buttons for both preset and counter. After each iteration I want to reset the values just by pressing a button instead of writing command after each iteration. I hope this is clear.
Thank you
06-28-2012 08:03 AM
You haven't stated exactly what you are doing. Are you communicating between two PCs? One sends a command to reset a counter on the other? It sounds like you may need a shared variable if your controls are running from another PC. Can you post your code for the controls so we can get a clearer picture of what it is you are trying to do?
06-28-2012 08:19 AM
I am communicating between counter and PC. Look at the code in the attachment thats how I set the value of preset if I want to read I just write N0ta*
06-28-2012 11:04 AM
You need to post your VI. Just posting pictures of the code / front panel is not sufficient. The actual ".vi" file you are using needs to be posted.
06-28-2012 11:19 AM
He's using the Basic Serial Write and Read example. What he needs to do is actually write a new VI with the buttons and VISA Writes with the necessary constants.
06-28-2012 11:51 AM
Is it a good idea to use a state machine for this. Creating two cases instead of using a button??????
06-28-2012 12:31 PM - edited 06-28-2012 12:32 PM
You can use a state machine for read/write or two separate VIs. Either would be fine, but I would not try to control visa using a boolean.