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.
The KAS UDP functions udpSendTo and udpRcvFrom are used to send and receive characters between PxMMs.
|Controller||IP Address||Client Port||Listening Port|
with .kas 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
with .kas 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.