
unit ADbasic
{
	public link unit PX {}
	const uint8 channelX = PX.INDEX;
	public link unit PY {}
	const uint8 channelY = PY.INDEX;
	public link unit PZ {}
	const uint8 channelZ = PZ.INDEX;
	
	public const int32 MinValue = 0;
	public const int32 MaxValue = 1000;
	
	link memory VHdata {} = #.USER0.VHdata;
	VHdata int32 ADvalueX = #addr 90 + channelX - 14;
	VHdata int32 ADvalueY = #addr 90 + channelY - 14;
	VHdata int32 ADvalueZ = #addr 90 + channelZ - 14;
	
	public const int32 MAX = 675;//675;

	//---------------------------------------------------
	//[i] function_void OS_init;
	public void OS_init()
	{
		
	}
	//---------------------------------------------------
	//[i] function_int32 get_dataX;
	public int32 get_dataX()
	{
		return MinValue + ADvalueX * (MaxValue - MinValue) / MAX;
	}
	//---------------------------------------------------
	//[i] function_int32 get_dataY;
	public int32 get_dataY()
	{
		return MinValue + ADvalueY * (MaxValue - MinValue) / MAX;
	}
	//---------------------------------------------------
	//[i] function_int32 get_dataZ;
	public int32 get_dataZ()
	{
		return MinValue + ADvalueZ * (MaxValue - MinValue) / MAX;
	}
}





