FUNCTION_BLOCK PMC_SendDigitalSignalToPMC
	IF Enable = TRUE THEN
		(* Statement section IF*)
		(*read xbot ID*)
		IF (DoID > 0) AND (DoID <= 128) THEN
			(* Statement section IF*)
			(* *)
			ByteOffset := LREAL_TO_DINT(floor((DoID - 1) / 8));
			BitOffset := (DoID - 1) - ByteOffset * 8;
			(*read X force from frame*)
			memcpy(pDest := ADR(step1),pSrc := ADR(FBout_pointer) + H2P_START + H2P_DO_OFFSET + ByteOffset,length := 1);
			step2 := step1 AND NOT(SHL(1,BitOffset));(*2**BitOffset;*)
			step3 := step2 + (SHL(BOOL_TO_DINT(Level),BitOffset));
	         
			RegVal := DINT_TO_USINT(step3);
			memcpy(pDest := ADR(FBout_pointer) + H2P_START + H2P_DO_OFFSET + ByteOffset,pSrc := ADR(RegVal),length := 1);
			Valid := TRUE;
		ELSE
			Valid := FALSE;
		END_IF;
	    
	ELSE
		Valid := FALSE;
	END_IF;

END_FUNCTION_BLOCK
