Back to top

PC and KAS UDP communication: C# example (Visual Studio Express 2013)

This example shows how to exchange data between a PCMM or AKD PDMM and a PC using UDP.

The attached KAS program works with the target controller and 2 AKD drives. 

The PC-based program is written in C# and receives the axis positions from the controller. It is also possible to send text to the PC.


  1. Download the attached KAS program to the target controller (PCMM or AKD PDMM) and use the integrated control panel "Panel_UDP" for activating the connection.
  2. Enter the IP address of the PC (IP Client field) and push the Start Communication button. You have 40 sec to start the C# program and activate the connection before timeout.
  3. Start the C# program.
  4. Enter the controller's IP address and push the Connect button.

KAS Panel Controls

Received Text  
Text to Send Text entered here will be sent to the C# program upon pressing the Send button.

C# Program Controls

UDP Port The standard UDP port is 20.
Write Machine Speed This button will write the variable MachineSpeed.
Enable Axes / Disable Axes These buttons will write to the variable MachineState.
Enable / Disable Commands from UDP The flag Enable Commands from UDP will activate the writing from the PC, on the contrary the previous variable will not be written and the user will change them by KAS.
Pos Axis 1, Pos Axis 2 These text fields are the axes positions sent by the controller. 
Received Text This field displays text sent by the controller.


PxMM Project

The project is based on a 2 axis New Project Template written  with the SFC code format and uses ST for coding of each step. Note the same code is available with ST or FFLD  languages. The parameter  sent through the UDP communications are included in the KAS Project Dictionary






Motion Function Block in KAS program with Speed set in C# Program




C# Form (running)



PxMM Control Panel (running)



PxMM Code for UDP communication (running)






Stefano Giacomelli's picture
Stefano Giacomelli
In case of no PCMM available it's also possible to use 2 PCs: in the first the KAS simulator should run, in the second the program in C#.
Pay attention to set up the right IP address on both side.