
unit motor
{
	public const uint16 ID = 0;
	
	#include "$run$.txt"
	
	public link unit PORT {}
	
	//[i] var_uint8 OS_time;
	uint8 OS_time;

	//[i] linkconst_int32_30_毫秒 Time;
	public const int32 Time = 0;
	
	uint8 OUTPUT;
	
	//方向  0:停止  1:正转  2:反转
	uint8 DIR;
	
	int32 time;
	
	//----------------------------------------------------
	//[i] function_void OS_init;
	public void OS_init()
	{
		PORT.D0 = 0;
		PORT.D1 = 0;
		PORT.D2 = 0;
		PORT.D3 = 0;
		
		OS_time = (uint8)(uint16)(uint)Time;
		OUTPUT = 0x01;
	}
	//----------------------------------------------------
	//[i] function_void OS_run;
	
	//----------------------------------------------------
	//[i] function_void run_right;
	public void run_right()
	{
		time = -1;
		DIR = 1;
	}
	//[i] function_void run_left;
	public void run_left()
	{
		time = -1;
		DIR = 2;
	}
	//[i] function_void run_right_t int32;
	public void run_right_t( int32 t )
	{
		time = t;
		DIR = 1;
	}
	//[i] function_void run_left_t int32;
	public void run_left_t( int32 t )
	{
		time = t;
		DIR = 2;
	}
	//[i] function_void stop;
	public void stop()
	{
		//time = -1;
		DIR = 0;
	}
}







