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.

Instructions

  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.
    image
  3. Start the C# program.
  4. Enter the controller's IP address and push the Connect button.
    image

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.

Comments

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.