
(* 4x3 flyways 2 xbots - get pmc state, get buffer status *)
FUNCTION_BLOCK Example08_bufferstatus
	(*get pmc state*)
	PMC_GetPmcStatus1(PM_Controller := PM_Controller,Execute := Execute);
	pmc_state1 := PMC_GetPmcStatus1.State;
	nxbots1 := PMC_GetPmcStatus1.nXbots;

	(*get buffer status of xbot 1*)
	PMC_GetBufferStatus1(PM_Controller := PM_Controller,Execute := PMC_GetPmcStatus1.Valid,XbotID := 1);
	buffer_state1 := PMC_GetBufferStatus1.State;
	ncmds1 := PMC_GetBufferStatus1.nCmds;

	(*block buffer of xbot 1*)
	PMC_MotionBufferCtrl1(PM_Controller := PM_Controller,Execute := PMC_GetBufferStatus1.Valid,Level := 0,XbotID := 1);

	(*get buffer status of xbot 1*)
	PMC_GetBufferStatus2(PM_Controller := PM_Controller,Execute := PMC_MotionBufferCtrl1.Done,XbotID := 1);
	buffer_state2 := PMC_GetBufferStatus2.State;
	ncmds2 := PMC_GetBufferStatus2.nCmds;

	(*add move command to xbot 1 buffer*)
	PMC_XYMotion1(PM_Controller := PM_Controller,Execute := PMC_GetBufferStatus2.Valid,cmdLB := 5,XbotID := 1,Mode := 0,Type_ := 0,PosX := 0.9,PosY := 0.06,EndVel := 0,MaxVel := 1,MaxAcc := 10);

	(*add move command to xbot 1 buffer*)
	PMC_XYMotion2(PM_Controller := PM_Controller,Execute := PMC_XYMotion1.Ack,cmdLB := 6,XbotID := 1,Mode := 0,Type_ := 0,PosX := 0.06,PosY := 0.06,EndVel := 0,MaxVel := 1,MaxAcc := 10);

	(*get buffer status of xbot 1*)
	PMC_GetBufferStatus3(PM_Controller := PM_Controller,Execute := PMC_XYMotion2.Ack,XbotID := 1);
	buffer_state3 := PMC_GetBufferStatus3.State;
	ncmds3 := PMC_GetBufferStatus3.nCmds;

	(*release buffer of xbot 1*)
	PMC_MotionBufferCtrl2(PM_Controller := PM_Controller,Execute := PMC_GetBufferStatus3.Valid,Level := 1,XbotID := 1);

	Done := PMC_XYMotion2.Done;
END_FUNCTION_BLOCK
