Motion Control and Motor Drives

cancel
Showing results for 
Search instead for 
Did you mean: 

controlling 3540i

Solved!
Go to solution

Hello everyone, 

 

I am trying to achieve simple continuous back and forth motion with a linear actuator controlled by an Applied Motion 3540i stepper drive but am having no luck. It works the first couple of iterations and then it starts skipping commands and behaving erratically. I believe my buffer is becoming overrun but I am unsure how to properly control that. I have attached my code. Can someone please tell me what I am doing wrong? I tried putting in a conditional statement that checked how much room the buffer has remaining but when I run it in highlight execution mode I can see that the values are becoming jumbled up with each successive iteration, rendering my check useless. I am brand new to serial communication and would really appreciate some help. Thank you to everyone in advance. 

 

Nicholas

0 Kudos
Message 1 of 4
(5,429 Views)
Solution
Accepted by niccarroll

What distance values are you feeding to the controller?  With only a 1 second pause, you may not be allowing enough time for the buffer on the controller (vs the buffer on the serial port) to clear out before you send additional commands. 

 

Writing the BS command is requesting the buffer status of the controller.  Reading the port (offset by 6 characters?  Why?) is reading the buffer of the serial port, not the controller.  I am not certain of the buffer size on the controller without looking it up but I generally make sure I program in enough time for the move before sending additional commands.

 

If you want to read the buffer on the port, use the property node to get Number of Bytes at Serial Port and feed that to the read vi.

 

Reading the buffer status of the controller returns the number of command sequences that are available. As this nears zero, the number of open spaces becomes fewer.

 

I would try adding time to slow the entire sequence down and see what effect that has.

 

Post any results you get.

 

 

Doug

"My only wish is that I am capable of learning each and every day until my last breath."
Message 2 of 4
(5,418 Views)
Thank you for your help. I added the property node to the BS command and also provided more time in the waits between sending new distance commands and it works like a champ now! Am I understanding it correctly that the buffer of the drive doesn't clear completely until the actual physical movement has transpired?

Thanks again,
Nic
0 Kudos
Message 3 of 4
(5,404 Views)

Glad it worked for you.   I really don't know the specifics about the I/O of the drive and when the buffer clears and such.  My movements are generally small and timed to not interfere with each other. I drive a stepper driven linear drive (ball screw & nut)

 

Good luck with the project

Doug

"My only wish is that I am capable of learning each and every day until my last breath."
0 Kudos
Message 4 of 4
(5,401 Views)