08-13-2019 07:32 AM
Dear All,
I am trying to send some commands to my external device via RS232.
The commands can be set by the user in the GUI and I would like to handle this with an event structure.
However, I do not want to place my control cluster into each case for the event structure, what would be the best way to achieve that?
I was thinking of putting the Stimulation parameters (control cluster) into the timeout case (however, it doesnt work well), so it will be updated once in a while or even add few other cases to force the programm to update the parameters. However, I am pretty sure I am missing something, there must be a proper way?
So the main question would be: How can I update the controls with the user input and direct them towards my event cases, without placing multpile controls into each case? (One option would be to place the controls before the event case, however in this case you would have to press any "OK" button twice, since the old value will be passed all the time...)
I have attached my VI.
Thanks a lot
08-13-2019 08:03 AM - edited 08-13-2019 08:04 AM
You do not need the Timeout case. But from what I see, you really should not have so much in your cluster. I would take the Laser Power and Laser Pulse out of the cluster as well as all of the "Update" buttons. Then you can just use the Value Change of the buttons to update those few parameters that get updated. And those controls can be in the correct event case.
And since it looks like your commands are using ASCII protocols that end in the Line Feed...
DO NOT USE THE BYTES AT PORT!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! (still now enough emphasis).
Enable the termination character and tell the VISA Read to read more bytes than you ever expect back. The read will complete when the termination character is read (defaults to a Line Feed).
I ran out of time, so I couldn't finish the clean up, but you need to do something.