LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Desperate user need help. My GPIB instrument get stuck with my labview program frequently

Hello to all labview users,

i am a beginner in using labview. I am currently writting a labview program to automatically control a digital control rotator HD201e and a network analyzer 8720a to work with the anechoic chamber. The program receives an initial position, amount of increment and # of steps. My program will then ask the controller to rotate to the initial position and at the meantime, the program will monitor the position of the rotator to ensure the requested position is reached. After that, at the position, the program will ask the NA to perform a reading of the measurement. Once the reading is done, the program will ask the controller to rotate to the next position and does a reading of the measurement and so on.

My program seems to be able to perform the tasks; however, the dig.controller part seems to get stuck around 50% of the time when running the program. Sometimes, even the controller receives the requested position (can be seen from the lcd screen of the controller), the rotator just simply would not rotate; also, sometimes, the controller just simply does not respond when sending the command of moving a position, as in the debug mode (the one with a lightbulb), i see that i got "ok" on all the blocks in the writing portion ofthe program, but the controller just doesnt seem to receive the position (as seen no new position received from the lcd screen) and the cursor on the lcd screen blinks weirdly, due to that problem, my program will then get stuck in an infinite loop.....

Usually, that problem occurs after few positions have been reached.....

so, when that happens, i have to stop my program and re-run it. that means the program will have to re-do the measurement that were read previously....

sometimes i have to stop and re-run my program several times to get all the measurement of all the positions done.....so...that bug renders that program to be an unefficient program.

I have been trying to resolve that bug for weeks...but no success....i have tried to put some wait time between each block....result is not much different...
I have also tried putting "clear" block before and after the "write" block.....same problem.....

I have heard that the serial GPIB "flush" block may help...but i tried..but it seems the controller doesnt recognize/accept flush....

i have also tried using the "Visa open" and "Visa close" block to see if ithat reduces the stucking thing....but seems that the controller can still get stuck....

i have also even tried using "lock asyn" and "unlock asyn" block...but didnt seem to work....

Has anyone experienced such problem.? Is it a known problem with some gpib instrument?

Is there any discrepancy or bugs in my program that i am unaware of that causes this problem?

Any advice and or opinion would be greatly appreciated....

PS: i attached the controller part of my program and the overall program

desperate happyguy......
*********************************************************************
Happy guy
~ currently final year undergraduate in Electrical Engr. Graduating soon! Yes!
~ currently looking for jobs : any position related to engineering, labview, programming, tech support would be great.
~ humber learner of LabVIEW lvl: beginner-intermediate
0 Kudos
Message 1 of 14
(3,589 Views)
sorry about my very clumsy labview programming technique.....

and the messy wiring and stuff

there still many other things in that program that i still want to improve on...

but for now, i hope that i can solve that "stucking" bug of the controller
*********************************************************************
Happy guy
~ currently final year undergraduate in Electrical Engr. Graduating soon! Yes!
~ currently looking for jobs : any position related to engineering, labview, programming, tech support would be great.
~ humber learner of LabVIEW lvl: beginner-intermediate
0 Kudos
Message 2 of 14
(3,584 Views)
Hi Happyguy

H201-Controld.jpg: 
From the diagram, I can determine that the GPIB address is 10? Have you initialised the instrument?
have you recieved a response from the instrument.
In frame 4 where you have your loop, you do not have any wait time- so you hogg all the cpu process power  not a good thing!

Suggest you check out the GPIB examples from NI examples to modify your code ( clearer to understand ). Concentrate at first  just for the H201 to function
before attempting to control the network analyser which can be controlled manually whislst debugging your application.

Also in the final frame you do not appear to have GPIB reference to controller thus any commands will not be executed as expected.

Xseadog




Message 3 of 14
(3,587 Views)
HI Xseadog,
thx for the reply.


Yes, the address is 10.
Yes, i did initialize the instrument. When i turn on the instrument by pressing the power on button, it asks me to press the red button for initialization. So that is the initialization i did.

Is it necesssary to put wait time in loop(ex: 50ms)? I did put that before, but i didnt notice any change in performance. and also, if i put in wait time. that means the value shown on the front panel will not be  continously updated ?

also, sorry for the confusing....what do you mean by gpib reference? is it why that the controller is stuck?


PS: which gpib example do you recommend?
thanks again

!Happy guy

Message Edited by happyguy on 03-11-2007 03:45 PM

*********************************************************************
Happy guy
~ currently final year undergraduate in Electrical Engr. Graduating soon! Yes!
~ currently looking for jobs : any position related to engineering, labview, programming, tech support would be great.
~ humber learner of LabVIEW lvl: beginner-intermediate
0 Kudos
Message 4 of 14
(3,581 Views)
hi xseadog

i got what you meant about the gpib reference

actually, that final frame works because the gpib reference is already done inside that subvi.

but my problem doesnt arise from that. most of the time ive seen, it arises between the writing frame and the while loop frame. as i mentionned, sometimes. the controller just simply doesnt rotate even i can see the requested position display on the controller lcd screen; also sometimes, just the controller is stuck without acknowledging the write position command. but in labview...while in debug mode. it is shown ok on the block.
*********************************************************************
Happy guy
~ currently final year undergraduate in Electrical Engr. Graduating soon! Yes!
~ currently looking for jobs : any position related to engineering, labview, programming, tech support would be great.
~ humber learner of LabVIEW lvl: beginner-intermediate
0 Kudos
Message 5 of 14
(3,577 Views)
hi xseadog

i just checked the gpib example.

i have never used that gpib write/read block. i wlll try it out tomorrow when i have access to the instrument.

but i have a question. what is the difference between that gpib write/read function and VISA write/read.

If i use the gpib write/read block, do i have to use some sort of clear or flushing before and after ? and how?

thanks again for helping me

happyguy
*********************************************************************
Happy guy
~ currently final year undergraduate in Electrical Engr. Graduating soon! Yes!
~ currently looking for jobs : any position related to engineering, labview, programming, tech support would be great.
~ humber learner of LabVIEW lvl: beginner-intermediate
0 Kudos
Message 6 of 14
(3,572 Views)
Sounds like you are firing commands to the controller with any acknowlegde from it.

Be careful, if you code has an unrecognised ascii character attached then the controller will not function!

Check you manual with regard to the timing of instructions.

What version of Labview are you using?
xseadog
Message 7 of 14
(3,573 Views)
Hi, xseadog

the controller has no problem in manual mode of my program, ie: go to that position , then take a reading of measurement from NA, then end of task

but problem arises in automatic mode: ie: user entered initial position, increment and # of points, 1st loop, go to that position, take measurement, 2nd loop, next position, take measurent unti # of pts = # of measurement done, then end of task

usually, that stucking problem appears after couple incrememnt...sometimes...1st....sometimes....after 2 or 3 loops....

now. i am thinking about it....could it some hidden looping errors that i am not awared of?

regarding the command...i followed exactly the format shown in the user manual of the controller...

about wait time...i am not sure....the manual didnt mention anything about it....

but before...i did get a timeout expired message in my readposition function,,,,,since i didnt know how to eliminate that time out error..i chained it to the "ignore error" block....maybe that is one of the cause?
*********************************************************************
Happy guy
~ currently final year undergraduate in Electrical Engr. Graduating soon! Yes!
~ currently looking for jobs : any position related to engineering, labview, programming, tech support would be great.
~ humber learner of LabVIEW lvl: beginner-intermediate
0 Kudos
Message 8 of 14
(3,567 Views)
and....what is the difference between the gpib function block and the VISA function block?

oh and the one i am using at school is 8.0

thanks again for the help

Message Edited by happyguy on 03-11-2007 04:39 PM

*********************************************************************
Happy guy
~ currently final year undergraduate in Electrical Engr. Graduating soon! Yes!
~ currently looking for jobs : any position related to engineering, labview, programming, tech support would be great.
~ humber learner of LabVIEW lvl: beginner-intermediate
0 Kudos
Message 9 of 14
(3,568 Views)
Hi HappyGuy

Have you used MAX ?

Run MAX  and start NI spy. Which happens to be a monitoring program, so you can see exactly what instructions you are sending to the controller.

Use labview help with regard to gpib function and VISa function block ( I do not have time at work to explain)

Xseadog
Message 10 of 14
(3,545 Views)