LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem !! while using event structure with VISA

Hello All,

 

I am working on a project I have to do controlling of air bearing system.

What controls I have to make,

Absolute Zero : when I click this button air bearing should rotate back to initial zero degree position

Absolute 360 : when I click this button air bearing should rotate to 360 degree degree position

 

Absolute move: it should rotate to certain commanded degree position (Ex: when I command to position of 20 degree it should reach to 20 degree position)

Relative Move : I should rotate to commanded degree further. (Ex : when I command 20 it should further rotate to 20 degree from current position)

Stop Profiler : it should stop profiler (Rotational bearings).

 

Command means:

 

UM=5;   : operation mode

MO=1;   : Motor ON

PA=xxxx;    : Absolute position

PR=xxx;       : Relative position

SP=xxxx;     : Velocity of the rotation

BG;       : begin motion or rotation

 

 

I have created VI to do the same operation, have created event structure do the operation whenever we command the signals, but facing some issues.

 

VI structure:

 

First I initialize the VISA

initialize the rotational air bearing system

 

1)  Time out : doing nothing

2) Absolute move :  Event structure value change _ sending position command and velocity then command to begin operation

3) Relative Move : Even structure value  change _ sending position command and velocity then command to begin operation

4) Absolute Zero : Even structure value  change _ sending position command (Zero degree position) and velocity then command to begin operation

5) Absolute 360 degree : Even structure value  change _ sending position command (360 degree position) and velocity then command to begin operation

6) Stop profiler : Even structure value  change _ Stop rotation of the air bearing system

 

Problem:

 

Whenever I click absolute zero it moves to zero degree position, when I click to absolute 360 degree sometime it moves sometimes not, absolute move /Relative move : it does not work (when I click on light bulb from labveiw and do the operation in slow it performs the task.

 

whenever i change the velocity value, it does not update every time,

 

I also have attached video for more information

 

Do anyone have idea why absolute move and relative move does not perform in real time and only performs the operation in slow execution.

 

I have attached the VI

 

Download All
0 Kudos
Message 1 of 14
(2,324 Views)

Hi mi,

 


@mi1111 wrote:

What controls I have to make,

Absolute Zero : when I click this button air bearing should rotate back to initial zero degree position

Absolute 360 : when I click this button air bearing should rotate to 360 degree degree position

 

Do anyone have idea why absolute move and relative move does not perform in real time and only performs the operation in slow execution.


Is there a difference between 0° and 360°? IMHO it's the same position!

 

Several problems with your VI:

All control terminals belong into their event cases to ensure reading the correct values.

No need for all those boolean local variables when you change the button to latched switching mode!

No need for a TimeOut event when nothing happens inside the event case…

The string formatting can be simplified by using FormatIntoString…

No need for sequence frames inside those event cases!

 

Does your device ever responds to your commands - or can you request its current status?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 14
(2,290 Views)

Hi,

 

Thank you very much for prompt response.

 

Absolute zero and  absolute 360, if we see the position then i look same, but zero is initial position and 360 is end position. it will be helpful in my application.

 

All controls sending right commands and signals, I place probe and checked.

I will remove useless local variable used inside VI (They should effect the operation right ?)

Can I remove the timeout event? (Does it effect the operation?)

I change decimal to string with format to string.

I remove sequence frame

 

My concern about the VI is when I run absolute move and relative move (event change) in slow operation it works and performs, but when i run the same operation in regular mode it does not rotate the air bearings.

It is not same for absolute 360 , in absolute 360 some times it performs and sometime does not.

 

while absolute zero works fine. (in all operation commands are almost same only position value changes )

 

Note: I am using LabVIEW 32 bit version in laptop which has 64 bit configuration can it be a problem?

 

Why VI works fine in slow operation and not in regular mode , I think it is a timing issue.

0 Kudos
Message 3 of 14
(2,270 Views)

If, by "slow mode" you mean "highlighted execution" mode, then that usually means you have an incomplete understanding of the communications protocol.  A corollary to that is if you have to put hard waits between your writes and reads, same thing - you probably have an incomplete understanding of the communications protocol, as well.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 4 of 14
(2,259 Views)

Could you just let me know what should I do , what means incomplete  understanding, could you describe little deeply , where is the problem what could be the solution.

 

"Incomplete understanding" statement it self looks incomplete with out explanation.

 

Thanks 


 

0 Kudos
Message 5 of 14
(2,236 Views)

More people will be in a position to help if you back-save your vi to an earlier LabVIEW version.   (File menu -> Save for Previous Version...)

 

I'd recommend saving back to LV 2016.

 

 

-Kevin P

 

 

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 6 of 14
(2,229 Views)

@mi1111 wrote:

Could you just let me know what should I do , what means incomplete  understanding, could you describe little deeply , where is the problem what could be the solution.

 

"Incomplete understanding" statement it self looks incomplete with out explanation.

 

Thanks 


 


My apologies; you are correct.  Let me see if I can explain it, because it's about the concept more than anything.

 

Now the following is pure conjecture, but this is a scenario I can envision:

The code works in lightbulb mode because you are actually supposed to wait for a response before issuing the next command.  Since lightbulb mode slows the code down immensely, it gives the machine time to get ready for the next command.  When executed at normal speed, you don't have the lightbulb to slow you down, so you send commands before the machine is ready to process the next command.  It will skip some commands while executing others, depending whether it was ready or not.

 

That is what I meant by "incomplete" understanding of the communications protocol, and that is why GerdW asked you if you were expecting a response.

 

Again, sorry about the vagueness of my last post, and I hope this helps you to understand what (GerdW and) I meant.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 7 of 14
(2,202 Views)

 I try on Tuesday and make more comments  afterwards, 

 

I put some delay between commands I am sending.

 

Btw thank you very much dear for your response and explanation.

 

 

0 Kudos
Message 8 of 14
(2,166 Views)

@mi1111 wrote:

 I try on Tuesday and make more comments  afterwards, 

 

I put some delay between commands I am sending.

 

Btw thank you very much dear for your response and explanation.

 

 


Yes, this is what I meant about "incomplete" understanding of the communications protocol.  With most protocols - and I say "most" because I've run into one power supply that actually specified that you needed to wait x msec for the power supply to process the command before sending another one - you don't need to include a hard-coded wait.  Normally, the instrument/equipment will tell you when it is done so all you do is wait for the instrument to tell you that, then you can send the next command.

 

At this point, if there is a manual to read, I suggest trying to re-read it, and also uploading it here so we can read it and maybe give suggestions.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 9 of 14
(2,149 Views)

Now air bearing system start responding, after I put delay in between commands. Thank you very much for your kind help.

 

But now new problem popped up, hahaha.

 

I added one more even to know the position of the profiler.

 

Problem is when I try to find the position of the profiler I mean position of the profiler in degree.

 

When I call profiler position event, it gives me position along with some previous command (ST[1];;PX;157859), you can see output in below screenshot.

 

while the position should be only PX;157859.

 

And when I call the same event second time it gives me position what I need. (PX:157859)

 

I have attached both screenshot.

 

commands : PX; gives current position of the profiler

I read 16 byte information

 

Do you have idea why it does not give me position on first call.

 

 

mi1111_0-1586870393699.png

 

mi1111_1-1586870779551.png

 

I have attached changed VI.

 

I am using command from Elmo language. I have attached the manual

 

0 Kudos
Message 10 of 14
(2,096 Views)