⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 initialz.h

📁 Fujitsu MB89P475的应用实例
💻 H
字号:
#define		Freq_8M
#define		Baurd_1200

#ifdef		Freq_8M
	#ifdef  Baurd_600
		#define Baurd	208
	#endif
	#ifdef	Baurd_1200
		#define Baurd	104
	#endif
	#ifdef  Baurd_2400
		#define Baurd	52
	#endif
	#ifdef	Baurd_4800
		#define Baurd	26
	#endif
#endif		

#define		JKQ     1
#define		XKQ			0

LcdRamIni()
{
	ResetCode[0]=0x33;
	ResetCode[1]=0x44;
	ResetCode[2]=0x55;
	ResetCode[3]=0x66;

//	RemoteModeFlag=JKQ;					//=0 是线控器; =1 是集控器

//	RemoteModeFlag=0;					//=0 是线控器; =1 是集控器
//============================	
//遥控器区			
	point= &Seg0_Seg1.byte;
	for (i=0;i<IndoorMacs;i++)
		{
			*point++ =0xff;
			ModeRegister[i].byte=0x81;				//默认关机、使用线控器传感器 2003-12-01
			FuctionRegister[i].byte=0x80;		//
			FanDoorAndSetTemp[i].byte=128;
			if (RemoteModeFlag==0)
				{Command1[i].byte=0x80;}
			ValveOpen[i]=200;
//			TimerOn[i]=0;
//			TimerOff[i]=0;
			SetCoolHeartTemp[i].byte	=0x88;
		}	
//	SetCoolHeartTemp.byte	=0x88;
	ValveOpenH=2;
//	ValveOpenL=0;
	OutValve=300;
//显示区			
//	DisplayMode=0x0;
//	DisplayDataOrder=0x00;
//	DisplayMachineOrder=0;//室内机器号
	AllMacOn_Off.word=0xffff;
	Lcd_M_State.word=0xffff;	  //LCD中图标 “M” 状态寄存器
//	NewIndoorNumber=0;			  //新室内机编号

	ForceFrequency=60;
//	InformationType=0;
}

SFR_ini()
{
	ADC2.byte=0x01;
	ADER.byte=bittobyte(IO,IO,IO,IO,IO,IO,IO,AD);		/*#00000011 =0 I/O Port   ; =1 AD mode*/

	PDR0.byte=bittobyte(1,1,1,1,1,1,0,1);
	PURC0.byte=bittobyte(on,on,on,on,on,on,on,off);
	DDR0.byte=bittobyte(in,in,in,in,out,out,out,in);
	
	DDR1.byte=bittobyte(out,out,out,out,out,out,out,out);
	PURC1.byte=bittobyte(on,on,on,on,on,on,on,on);
	PDR1.byte=bittobyte(1,1,1,1,1,1,1,1);

	DDR2.byte=bittobyte(out,out,in,out,out,in,out,out);
	PURC2.byte=bittobyte(on,on,on,on,on,on,on,on);
	PDR2.byte=bittobyte(1,1,1,1,1,1,1,1);
	
	PURC3.byte=bittobyte(on,on,on,on,on,on,on,on);
	PDR3.byte=bittobyte(0,1,0,0,0,0,0,0);
	
	DDR5.byte=bittobyte(in,in,in,in,in,in,in,in);
	PURC5.byte=bittobyte(on,on,on,on,on,on,on,on);
	PDR5.byte=bittobyte(1,1,1,1,1,1,1,1);
	
	ILR1.byte=bittobyte(1,1,1,1,1,1,1,1);/*
	        		    | | | | | | |_|________External Interrupt 1_0
     	        	    | | | | |_|____________External Interrupt 1_1	 
        	            | | |_|________________External Interrupt 1_2    
            	        |_|____________________External Interrupt 1_3	*/
	ILR2.byte=bittobyte(1,0,1,0,1,1,1,1);/*
	        		        | | | | | | |_|________External Interrupt 2
     	        	      | | | | |_|____________Uart/SIO 1
        	            | | |_|________________Uart/SIO 2
            	        |_|____________________Timer11/12					*///CH1
	ILR3.byte=bittobyte(1,1,1,1,1,1,1,1);/*
	        		        | | | | | | |_|________Timer21/22					//CH2
     	        	      | | | | |_|____________A/D CONVERTER 
        	            | | |_|________________PWM
            	        |_|____________________PWC						*/
	ILR4.byte=bittobyte(1,1,1,1,1,1,1,0);/*
	        		        | | | | | | |_|________TimeBasic	Timer
     	        	      | | | | |_|____________Watch Prescaler
        	            | | |_|________________
            	        |_|____________________							*/
	TBTC.byte=bittobyte(0,1,0,0,0,0,1,0);/*
	        		      |       |_|__________	=00,2^13/Fch;=01,2^15/Fch;
     	        	      |     				=10,2^18/Fch;=11,2^22/Fch
        	              |                    
            	          |____________________	=1 Enable Interrupt;=0 Disbale Interrupt*/
//=============================================================================================            	          
	T1DR.byte=loword(0x0F41);		//Timer 1S    (1000/(512*4/8))-1=3905.25
	T2DR.byte=hiword(0x0F41);		//Timer 1S    (1000/(512*4/8))-1=3905.25
    T2CR.byte=bittobyte(0,0,0,0,1,1,0,0);/*指令周期=4/Fch=0.5uS
            	        | | | | | | | |________=0 stop; =1 start 
            	        | | | | | | |__________=0 counter; =1 临时停止计数
            	        | | | | |_|____________=00 2Tinst;=01 32Tinst; =10 512Tinst ;=11 16bit Mode
            	        | | |_|________________=00 
            	        | |____________________=0 Dis Interrupt; =1 En Interrupt
            	        |______________________clear then Interrupt*/
    T1CR.byte=bittobyte(0,1,0,0,1,0,0,1);/*
            	        | | | | | | | |________=0 stop; =1 start 
            	        | | | | | | |__________=0 counter; =1 临时停止计数
            	        | | | | |_|____________=00 2Tinst;=01 32Tinst; =10 512Tinst ;=11 Ext Clk
            	        | | |_|________________=00 
            	        | |____________________=0 Dis Interrupt; =1 En Interrupt
            	        |______________________clear then Interrupt*/
            	          
//=======================UART通讯
	//--------------------------------------------------------------------------
	// 	set Uart Interrupt
	//	The Uart use for 8 bit data length,1 bit stop,600 baud,Odd parity
	//--------------------------------------------------------------------------'
#ifdef	__Uart2	
	UartFlag.byte=0;							//	各标志位清零
	cUart2Send=1;
	SMC21.byte=bittobyte(0,1,1,0,1,0,1,1);/*
						 | | | | | | | |       	=100,外部时钟  ;=011,波特率发生器
						 | | | | | |_|_|_______	=010,32指令周期;=001,8指令周期;  =000,2指令周期
						 | | | | |_____________ =0, 7 bit data    =1, 8 bit data	
						 | | | |_______________	=0, 1 stop bit	  =1, 2 stop bit
						 | | |_________________ =0, 偶校验;       =1, 寄校验
						 | |___________________ =0, 无校验位;     =1,有校验位
						 |_____________________	=0, Uart fuction; =1, SIO fuction		*/
	SRC2.byte=Baurd;
	//mov	SRC1,#208 	;Board=600
	//    $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
	//    $		    		  1				   $	
	//    $	Baud=----------------------------------------------- (bps) $	
	//    $		8*2*SRC值*指令周期(4 or 8 or 16 or 64/Fch)         $
	//    $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
	SMC22.byte=bittobyte(0,1,1,1,1,0,1,0);/*
			             | | | | | | | |______	=0,禁止传送中断;    =1 允许传送中断
			             | | | | | | |_________	=0,禁止接收中断;    =1 允许接收中断
  			             | | | | | |___________ =0,SCK作为I/O  ;    =1 SCK作为SCK   			
			             | | | | |_____________ =0,SO作为I/O  ;     =1 SO作为SO	
			             | | | |_______________	=0,停止波特率发生器 =1,启动波特率发送器
			             | | |_________________ =0,禁止发送;        =1,运行发送
			             | |___________________ =0,禁止接收;        =1,运行接收
			             |_____________________	=0,清除SSD重的错误标志	*/
#endif
#ifdef	__Uart1
	SMC11.byte=bittobyte(0,1,1,0,1,0,1,1);/*
						 | | | | | | | |       	=100,外部时钟  ;=011,波特率发生器
						 | | | | | |_|_|_______	=010,32指令周期;=001,8指令周期;  =000,2指令周期
						 | | | | |_____________ =0, 7 bit data    =1, 8 bit data	
						 | | | |_______________	=0, 1 stop bit	  =1, 2 stop bit
						 | | |_________________ =0, 偶校验;       =1, 寄校验
						 | |___________________ =0, 无校验位;     =1,有校验位
						 |_____________________	=0, Uart fuction; =1, SIO fuction		*/
	SRC1.byte=208;
	//mov	SRC1,#208 	;Board=600
	//    $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
	//    $		    		  1				   $	
	//    $	Baud=----------------------------------------------- (bps) $	
	//    $		8*2*SRC值*指令周期(4 or 8 or 16 or 64/Fch)         $
	//    $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
	SMC12.byte=bittobyte(0,1,0,1,1,0,1,0);/*
						 | | | | | | | |_______	=0,禁止传送中断;    =1 允许传送中断
						 | | | | | | |_________	=0,禁止接收中断;    =1 允许接收中断
						 | | | | | |___________ =0,SCK作为I/O  ;    =1 SCK作为SCK   			
						 | | | | |_____________ =0,SO作为I/O  ;     =1 SO作为SO	
						 | | | |_______________	=0,停止波特率发生器 =1,启动波特率发送器
						 | | |_________________ =0,禁止发送;        =1,运行发送
						 | |___________________ =0,禁止接收;        =1,运行接收
						 |_____________________	=0,清除SSD重的错误标志	*/
#endif
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -