Table of contents |

Mach3 Plugin - Passing DROs

Mechanism for transfering values back and forth between Mach3 and KFLOP/Kogna

Mach3 User DROs 1 to 50 map to KFLOP/Kogna UserData 0 to 99 (2 words each double)

ToRead from KFLOP/Kogna to Mach3 use NotifyPlugins codes 18001 to 18050

To Write from Mach3 to KFLOP/Kogna use NotifyPlugins codes 19001 to 19050

Example MACH3 Side

	
	SetOEMDRO(1007,123.456) 'Put a value in a Mach DRO
	NotifyPlugins(19007) 	'Send it to KFLOP
	Sleep(3000) 		'Wait for KFLOP to modify and copy it
	NotifyPlugins(18008) 	'Read the result from KFLOP
	x=GetOEMDRO(1008) 	'Check the value passed back
	

Example KFLOP/Kogna Side

	
	#include "KMotionDef.h"
	#define DROIN 7
	#define DROOUT 8
	main()
	{
		double *pin = (double *)&persist.UserData[(DROIN -1)*2];
		double *pout = (double *)&persist.UserData[(DROOUT-1)*2];
		for(;;)>
		{
			Delay_sec(2);
			*pout = *pin + 999;>
			printf("DROIN %d = %f DROOUT %d = %f\n",DROIN,*pin,DROOUT,*pout);
		}
	}