Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Different Response from 'Run' and 'Single stepping'?

Solved!
Go to solution

Thanks Wayne! I nearly finish the program! 

Here is my program.

screen-capture-2.png

 

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

screen-capture-3.png

screen-capture-4.png

 

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.

0 Kudos
Message 11 of 22
(1,781 Views)

use a timeout value of 100ms and in there check the stop button also.

keep your while working.

in your situation there is no event anymore so no stop

greetings from the Netherlands
0 Kudos
Message 12 of 22
(1,773 Views)

TriStones,

 

Could you please explain why 'get rid of the property node'???  Because it didn't work?  Smiley Very Happy  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.

0 Kudos
Message 13 of 22
(1,772 Views)

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!

0 Kudos
Message 14 of 22
(1,756 Views)

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?

0 Kudos
Message 15 of 22
(1,750 Views)

Sure, here's what i am doing.

screen-capture.png

 

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

 

0 Kudos
Message 16 of 22
(1,745 Views)

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.

greetings from the Netherlands
0 Kudos
Message 17 of 22
(1,733 Views)

Hi,Albert~

 

Do you mean like this:

 

screen-capture-1.png

 

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

 

0 Kudos
Message 18 of 22
(1,683 Views)

except that the while still is in the event case, YES

greetings from the Netherlands
0 Kudos
Message 19 of 22
(1,672 Views)

Any body can share opt. dedec.vi in this subject? I wanna read current and voltage this dedector. I can control monochoromator without dedector 😞

0 Kudos
Message 20 of 22
(1,535 Views)