
	
	//以下变量存放时间信息,分配在ds1302中(虚拟变量)
	
	//[i] var_int32 year;
	public v_ds1302user int32 year =	#addr 5; 	//年
	//[i] var_int32 month;
	public v_ds1302user int32 month =	#addr 4;	//月份
	//[i] var_int32 day;
	public v_ds1302user int32 day =	#addr 3; 	//天
	//[i] var_int32 hour;
	public v_ds1302user int32 hour =	#addr 2; 	//小时
	//[i] var_int32 minute;
	public v_ds1302user int32 minute =	#addr 1;	//分
	//[i] var_int32 second;
	public v_ds1302user int32 second =	#addr 0; 	//秒
	//[i] var_int32 week;
	public v_ds1302user int32 week =	#addr 6; 	//星期
	
	//---------------------------------------------------
	//初始化
	//[i] function_void OS_init;
	public void OS_init()
	{
		OS_time = 50;
		last_time = 0;
		OS_EventFlag = 0;
		
		isSafe = true;
	}
	//---------------------------------------------------
	//[i] function_void OS_run;
	public void OS_run()
	{
		if( !isSafe ) return;
		
		uint8 current_time = (uint8)(uint16)(uint)second;
		if( last_time != current_time ) {
			OS_EventFlag.0(bit) = 1;
			last_time = current_time;
		}
	}
	
	//---------------------------------------------------
	void set_uint32( uint8 addr, uint32 data0 )
	{
		isSafe = false;
		#.OS.REMO_ModuleWrite( (int)(ID * 0x00010000 + addr), (int)data0 );
		isSafe = true;
	}
	uint32 get_uint32( uint8 addr )
	{
		isSafe = false;
		uint32 d = (uint)#.OS.REMO_ModuleRead( (int)(ID * 0x00010000 + addr) );
		isSafe = true;
		
		if( addr == 5 ) {
			d = d % 100 + 2000;
		}
		
		return d;
	}
	//虚拟变量类型,用于在ds1302中定义整数变量,读写接口指向所在组件
	memory v_ds1302user
	{
		type = [ uint8 ] uint32;
	}



