PLC Serial Communication

General discussion of using Roboclaw motor controllers
Post Reply
PdoubleU
Posts: 12
Joined: Mon Aug 20, 2018 7:05 am

PLC Serial Communication

Post by PdoubleU » Mon Apr 15, 2019 9:01 am

Hey Guys

I am trying to control the Roboclaw via codesys PLC on a Raspberry Pi.

My general question is if its better to open and close the serial port everytime you send a command to the roboclaw or just keep it open all the time?

I think that if you keep it open you might run into problems regarding the handles etc. meaning that you exceed the maximum amount of handles.

Thanks

User avatar
Basicmicro Support
Posts: 1279
Joined: Thu Feb 26, 2015 9:45 pm

Re: PLC Serial Communication

Post by Basicmicro Support » Mon Apr 15, 2019 10:05 am

In general, you should keep the port open but when you do that you need to keep a reference to the handle. You should only have one handle to the port at a time.

If you can't do that(keep a reference to the handle) then you will have to close and then open the port each time you talk to the Roboclaw. This may add several milliseconds to your communications(or it may not, I have not tested port opening/closing latency on the RPi). It will definitely add some time but maybe not enough to matter.

Post Reply