01-19-2011 11:46 AM
Thanks Wayne! I nearly finish the program!
Here is my program.
I set the constant bytes to read to a larger value~ and a 'CLR' is needed, or the data seems still show up at the next run.
Could you please explain why 'get rid of the property node'???
One more small question, it's about how to stop...
In my program, the structure is 'while-event-while-sequence', I simplify it as
No matter I place the stop botton in the first event or the second event, I fail to stop the program once event 1 starts...
Could you tell me why?
Thanks a lot.
01-19-2011 12:33 PM
01-19-2011 12:35 PM
TriStones,
Could you please explain why 'get rid of the property node'??? Because it didn't work?
Biggest reason to get rid of property node is because you don't need it. Reply from instrument is going to have a termination character and when everything is set up properly, the VISA Read will stop when the termination character is read from Rx Buffer. Two keys to setup are to make the port timeout big enough to allow for response time of instrument and try to read more bytes than you expect.
You really need to wire up the error cluster and add some error handling to your vi.
Looks like Albert has already answered the last part.
01-19-2011 07:48 PM
Hi, Albert~
I don't quite understand 'use a timeout value of 100ms and in there check the stop button'. Where to set time out? how to check?
Also, what's 'no event anymore'???
Thanks!
01-19-2011 08:56 PM
Putting a while loop inside an event structure is a really bad design. Could you attach the actual VI to see what you are doing?
01-19-2011 10:39 PM
Sure, here's what i am doing.
A simple system to detect the source power at different wavelength.
The outside while loop: keep the program waiting;
The event structure: other events are needed, for example, ask the monochromater to set a certain wavelength (550nm) to align the equipment;
The inner while loop: move the monochromater (GOTO.vi) to move from the start wavelength to the end wavelength in different step and then detect the power(Opt. Power Det.vi) (move to next wavelenght-> detect the power->move to next...)
01-20-2011 07:26 AM
Hi
On the top left of the event structure you see an hour glass, you can connect a constant of 100 to it.
Then you find a timeout event frame.
Dennis is as always right.
Don't put the while in the event case, put it next to the event case so when an event happened it leaves the event and in a case statement after the event case but still in the surrounding while put the code that you have now written in the event case.
Handle te event case as you formerly had to handle interrupt routines, ONLY DO WHAT IS ESSENTIAL and do the rest later.
01-25-2011 02:48 AM
Hi,Albert~
Do you mean like this:
Seems doesn't work?
"Don't put the while in the event case, put it next to the event case so when an event happened it leaves the event and in a case statement after the event case but still in the surrounding while put the code that you have now written in the event case.
Handle te event case as you formerly had to handle interrupt routines, ONLY DO WHAT IS ESSENTIAL and do the rest later."
If I move the while loop out of the event case, where should I put the stop button if I want to break the while loop when it's running?
Thanks
01-25-2011 12:30 PM
10-17-2011 12:08 PM
Any body can share opt. dedec.vi in this subject? I wanna read current and voltage this dedector. I can control monochoromator without dedector 😞