Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Automation Direct STP-MTRD-23065RE Motion Control Program

Hello,

 

I am working on a program on a RT platform (CRIO-9045) to control two of the motors stated in the title.  These motors will operate perpendicular to one another to raster over an area of a specific size once and then repeat that same raster in reverse.  The motors communicate over RS485 and follow the set of commands Automation Direct uses in their SCL Language. I have a program written to control this motion, however, I am having trouble figuring out how to program a hard stop.  The command to be sent to the motors is "ST" to hard stop.

 

I realize that I may have written a spaghetti code program, and I am very open to suggestions as to how I can optimize this (I have 0 prior LabView experience, so please go easy).  If someone could please be so kind as to point me in the right direction to setting up a hard stop button on the front panel, I would be much obliged.

 

Also, please let me know what I can do to improve the flow of my program and the amount of hardware resources that it uses.  I will be glad to provide more details if needed.  Attached you will find the Real Time code and the Motion Control VI I am working with.

0 Kudos
Message 1 of 4
(2,297 Views)

Hi

You forgot the attachments.

greetings from the Netherlands
Message 2 of 4
(2,281 Views)

Sorry, forgot to attach files.  Here they are.

Download All
0 Kudos
Message 3 of 4
(2,264 Views)

Hi

I edited some problems away, but others will stay. I did not edit the RT part yet.

 

Stopping this main vi does not work, All while loops run until hell freezes over!

You could at least stop on an error in the wire.

 

Try to use subvi's

Don't use local variables except when really needed, but that is seldom.

e.g. writing to a control from the block diagram or having parallel loops that use the same variable.

 

But the biggest error is the event structure in which code is executed for a long time.

Don't do that. Event structures can pass information to execute somewhere else.

Event structures should not execute code that last more than  a few milliseconds.

To solve this look at client server systems, one possibility is to check the Queued Message Handler

That is found in the create project and has a lot of documentation.

A better Queued message handler is the delacore version but thatone  needs a bit more study,

a lot of tutorials for that one is available.

greetings from the Netherlands
Message 4 of 4
(2,253 Views)