FUNCTION_BLOCK PMC_WriteStream
	IF Enable = TRUE THEN
		(* Statement section IF*)
		Valid := TRUE;
		IF (StmID > 0) AND (StmID <= 10) AND (AxisID > 0) AND (AxisID <= 7) THEN
			(* Statement section IF*)
			(*calculate byte offset*)
			ByteOffset := H2P_START + H2P_STM_OFFSET + (StmID-1) * 28 + (AxisID-1) * 4;
			memcpy(pDest := ADR(FBout_pointer) + ByteOffset,pSrc := ADR(Pos),length := 4);
			Valid := TRUE;
		ELSE
			Valid := FALSE;
		END_IF;
	ELSE
		Valid := FALSE;
	END_IF;

END_FUNCTION_BLOCK
