Back to top
Getting Started with KAS UDP Communications
Attached is a sample program showing basic UDP communications between two KAS PxMM controllers. The concepts here can easily be applied to communicating between a PxMM controller and a PC or other non-Kollmorgen product.
With PxMM UDP communications:
- a Port is an internal Software structure that is identified as a Port Number
- The udpCreate function is used to create a Socket which is the combination of a IP address and a Port Number.
- Typically a PxMM requires 2 Sockets: one to receive data and the other to send data
The KAS UDP udpSendTo and udpRcvFrom functions are used to send and receive characters between PxMMs or a PxMM and a third party device.
EXAMPLE: 2 PxMMs using UDP communications to transfer data to each other
|Controller||IP Address||Client Port (sending data)||Listening Port (receiving data)|
PxMM example project: UDP_SendPositionConmmandAndReceiveFeedback
The program SendPosition below sends a position (1001) over UDP using Port 0 (Client_Port) from a PxMM (address 10.50.67.226 ) to another device (Controller 2) with IP address 10.50.67.95. Prior to sending information with the udpSendTo function a socket (udpCreate) and address “add” (udpAddrMake) are created to send information to Controller 2.
The program MonitorPosition below receives a actual motor position from Controller 2 (address 10.50.67.95) over UDP using Port 20 (Listening_Port). Prior to receiving information with the udpRcvFrom function a socket was created (udpCreate) to receive information from Controller 2
PxMM sample project: UDP_ReceivePositionAndSendFeedback
The program ReceivePosition receives a position from Controller 1 (address 10.50.67.226) over UDP using Port 20 (Listening_Port). Prior to receiving information with the udpRcvFrom function a socket was created (udpCreate) to receive information from Controller 1. The program receives a position and places it in a relative motion command (Pipe Network motion function k MLAxisRel).
The program SendFeedback below sends back a parameter (feedback) over UDP using Port 20 (Server_Port) to Controller 1(IP address 10.50.67.226) . Prior to sending information with the udpSendTo function a socket (udpCreate) and address “add” (udpAddrMake) are created to send information to Controller 1.
- For more information on the UDP functions in KAS:
- For more information on sending/receiving KAS project variables (in an array/structure format) across UDP using the udpRcvFromVar and udpSendToVar functions.