Hi,
I'm going to use a LabView software interface to control a 5-axis Robot via the RS232 interface.
Each axis will have a dedicated PIC with a PID Servo loop controlling a DC motor.
To address each axis (PIC) individually from the software interface there are a number of options:-
(1) Use a dedicated PIC for comms which takes in RS232 and outputs an I2C message on a shared i2C bus to each axis (PIC) chip. Setting up a slave address on each of the PICs used for each axis will distinguish one axis from the other.
(2) Use a dedicated comms chip which takes in RS232 and outputs a dedicated RS232 set of lines to each individual chip. This will obviously require multiple software UARTs to be employed.
I would like the communication be two-way so that the axis position of each motor can be read back into labview.
Any advice on the best approach of how to implement the comms would be much appreciated.
Thanks,
Paul
Comms for 5-axis Robot
- QMESAR
- Valued Contributor

- Posts: 1287
- Joined: Sun Oct 05, 2014 3:20 pm
- Location: Russia
- Has thanked: 384 times
- Been thanked: 614 times
Re: Comms for 5-axis Robot
Hi
I do not know the reason why you need 5 PIC's to control each axis However a dsPIC33 has enough Processing power to run all 5 axis
even a PIC18 can do that but i would rather use a dsPIC(ECIO board) which has the DSP engine that can do PID controls very fast .
you can then link the dsPIC/PIC to LABVIEW using the Serial to USB functionality of FC
Here is an example
http://www.flowcode.co.uk/mmforums/viewt ... 58&t=15494
See This post as well
http://www.flowcode.co.uk/mmforums/viewt ... =7&t=15488
http://www.flowcode.co.uk/article.php?a=363
PID
http://www.flowcode.co.uk/article.php?a=56
Hope this helps
Regards
Peter
I do not know the reason why you need 5 PIC's to control each axis However a dsPIC33 has enough Processing power to run all 5 axis
even a PIC18 can do that but i would rather use a dsPIC(ECIO board) which has the DSP engine that can do PID controls very fast .
you can then link the dsPIC/PIC to LABVIEW using the Serial to USB functionality of FC
Here is an example
http://www.flowcode.co.uk/mmforums/viewt ... 58&t=15494
See This post as well
http://www.flowcode.co.uk/mmforums/viewt ... =7&t=15488
http://www.flowcode.co.uk/article.php?a=363
PID
http://www.flowcode.co.uk/article.php?a=56
Hope this helps
Regards
Peter
https://www.flowcodexchange.com/
Regards QMESAR
Regards QMESAR
Re: Comms for 5-axis Robot
Hi Peter,
thanks you for the reply.
Historically, most of the PICs that I have come across only have 1 or 2 PWM outputs. I see that the 40 pin dsPIC 33 ECIO has 16 PWM outputs. I will probably choose that. However, my problem is that I have only flowcode 5. I don't think I can program the dsPIC33 using flowcode 5.
It definitely simplifies the comms side of things if I use the one PIC chip.
In my LabView interface, I want to send the position setpoint to each axis on the Robot and readback the actual motor position through a potentiometer connected to an analog input on the PIC for each axis. I would also like to programmatically change the PID parameters on each axis from Labview so that they can be easily adjusted rather than hard-coded into the PIC.
Does anybody have an example of a comms protocol setup similar to what I want to accomplish using RS23C?
An Example that I was thinking of is as follows using 5 Bytes:-
Byte 1: Bits 2-0-> used to decide which axis to write/read from; Bit 3:- Write Setpoint or Read Output; Bit 4; Update or don't update PID values from Labview. Bits 7-5 spare.
Byte 2: P Value (8 bitsvalue)
Byte 3: I value (8 bit value)
Byte 4: D Value (8 bit value)
Byte 5: Setpoint or Output value. (8 bit value)
Thanks,
Paul
thanks you for the reply.
Historically, most of the PICs that I have come across only have 1 or 2 PWM outputs. I see that the 40 pin dsPIC 33 ECIO has 16 PWM outputs. I will probably choose that. However, my problem is that I have only flowcode 5. I don't think I can program the dsPIC33 using flowcode 5.
It definitely simplifies the comms side of things if I use the one PIC chip.
In my LabView interface, I want to send the position setpoint to each axis on the Robot and readback the actual motor position through a potentiometer connected to an analog input on the PIC for each axis. I would also like to programmatically change the PID parameters on each axis from Labview so that they can be easily adjusted rather than hard-coded into the PIC.
Does anybody have an example of a comms protocol setup similar to what I want to accomplish using RS23C?
An Example that I was thinking of is as follows using 5 Bytes:-
Byte 1: Bits 2-0-> used to decide which axis to write/read from; Bit 3:- Write Setpoint or Read Output; Bit 4; Update or don't update PID values from Labview. Bits 7-5 spare.
Byte 2: P Value (8 bitsvalue)
Byte 3: I value (8 bit value)
Byte 4: D Value (8 bit value)
Byte 5: Setpoint or Output value. (8 bit value)
Thanks,
Paul