03-28-2014 02:42 PM
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
Solved! Go to Solution.
03-29-2014 12:05 PM - edited 03-29-2014 12:16 PM
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.
03-31-2014 01:44 PM
03-31-2014 03:29 PM
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