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

📄 41hard.h

📁 嵌入式单片机开发,嵌入式单片机开发,嵌入式单片机开发
💻 H
字号:
#define ADPIN_BATTERY1_DIR pd9_0
#define ADPIN_BATTERY2_DIR pd9_1
#define AD1_MUL  60
#define AD1_DIV  10
#define AD2_MUL  141
#define AD2_DIV  25




#define pin_biaogai p1_5
#define pindir_biaogai pd1_5
#define pin_duanniugai p1_4
#define pindir_duanniugai pd1_4

#define pin_irrx p5_6
#define pindir_irrx pd5_6
#define comm_remote 0


#define pindir_txd pd6_3
#define pindir_rxd pd6_2
#define comm485_0  2


#define pin_txd2 p7_0
#define pindir_txd2 pd7_0
#define pin_rxd2 p7_1
#define pindir_rxd2 pd7_1
#define comm485_1 1

#define pindir_dog pd8_1
#define pin_dog p8_1
#define open_battery_tingdianchaobiao p4_7=1
#define opendr_battery_tingdianchaobiao pd4_7=1
#define closedr_battery_tingdianchaobiao pd4_7=0
#define close_battery_tingdianchaobiao p4_7=0
#define opendr_battery_ctlir  pd4_6=1
#define open_battery_ctlir  p4_6=1
#define close_battery_ctlir p4_6=0
#define closedr_battery_ctlir pd4_6=0
// main.h
// ting dian停电状态AAAA
#define pin_vcc  p8_0      //p7_4   NEW
#define pindir_vcc pd8_0
// ting dian zhi shi 
// t停电制示AAAA
#define pin_tingchaodianchi p8_2
#define pindir_tingchaodianchi pd8_2

#define key_prog  p1_6              //p2_6              
#define key_read  p1_7             //p2_7 
#define key_updisplay p2_0


#define keydir_prog pd1_6
#define keydir_read pd1_7
#define keydir_updisplay pd2_0

#define pindir_pp pd7_5
#define pin_pp p7_5
#define pindir_qp pd7_6
#define pin_qp p7_6


#define pindir_clktest pd5_1
#define pin_clktest p5_1

//rtc iic
#define scl2 p5_3
#define sda2 p5_2
#define sdr_clk2 pd5_3
#define sdr_sda2 pd5_2


//iic
#define dr_wp0   pd2_5
#define wp0 p2_5
#define sclk0 p2_7 //p2_7// p2_3
#define sda0   p2_6//  p2_6 //p2_2
#define sdr_clk0 pd2_7//pd2_7  //pd2_3
#define sdr_sda0 pd2_6//pd2_6  //pd2_2

#define open_battery_quanshiya p4_2=1
#define opendr_battery_quanshiya pd4_2=1
#define colsedr_battery_quanshiya pd4_2=0
#define close_battery_quanshiya p4_2=0



#define pulse1set p1_3=0
#define pulse1clr p1_3=1
#define pulse2set p1_2=0
#define pulse2clr p1_2=1
#define pulse3set p1_1=0
#define pulse3clr p1_1=1
#define pulse4set p1_0=0
#define pulse4clr p1_0=1

#define pulse1dir pd1_3
#define pulse2dir pd1_2
#define pulse3dir pd1_1
#define pulse4dir pd1_0


#define greenledset p9_5=1
#define greenledclr p9_5=0
#define yellowledset p9_6=1
#define yellowledclr p9_6=0
#define speekset p8_4=1
#define speekclr p8_4=0

#define greenleddir pd9_5
#define yellowleddir pd9_6
#define speekdir pd8_4
//p 7758
#define spi_cs	 	p3_0
#define spi_dcs 		pd3_0	
#define spi_sdi		p3_3
#define spi_dsdi		pd3_3
#define spi_sdo		p3_1
#define spi_dsdo		pd3_1
#define spi_clk		p3_2
#define spi_dclk		pd3_2

#define pin_light p9_4
#define pindir_light pd9_4


#define showcomm lram17=0x10|lram17// COMM FLAGsho
// watch dog
unsigned char num_watch;
void watchdog()
{static unsigned char dog;
pindir_dog=1;
if(dog==0) 
	{
	 	pin_dog=0;
        	dog=1;
	}
else
 	{
 	 	pin_dog=1;
        	dog=0;
	}
}
void chushi_io()
{
pd1=0;
pd2=0;
pd3=0;
pd5=0;
pd6=0;
pd7=0;
pd8=0;
pd9=0;
pd13=0;

}

// ting dian 停电硬件设置AAA
extern unsigned int remote_display_7day;
extern void displayalloroff(unsigned char );
void set_tingdian()
{
unsigned char dn11,*dn12;
asm("FCLR I");
asm("NOP");
asm("NOP");
asm("NOP");
asm("NOP");
//rtc8025_set();
adcon0=0x20;
pd0=0;
 pd1=0;
// pd2=2;//0-------------->
//pd2=pd2&0x2;
/*
pd2_0=0;
pd2_2=0;
pd2_3=0;
pd2_4=0;
pd2_5=0;
pd2_6=0;
pd2_7=0;
*/
pd2=0;
 pd3=0;
 //pd4=0;
// pd5=8;//0
 pd6=0;
 pd7=0;
 pd8=0;
 pd9=0;
 pd13=0;


//pd4=0x39;
pd4_0=1;
pd4_1=0;
pd4_3=1;
pd4_4=1;
pd4_5=1;
//pd4_7=0;

//tc close
//closedr_battery_tingdianchaobiao;//test
//pd5=0x38;//38
pd5_0=0;
pd5_1=0;
pd5_2=0;
pd5_3=0;
pd5_4=1;
pd5_5=1;
pd5_6=0;
pd5_7=0;





pd6=0xf0;
pd8=0xa8;
pd9=0x80;
pd10=0xf0;
pd12=0xc0;
pd13=0x4;

 p1=0xff;
 p2=0xff;
 p3=0xff;
 p4=0xff;
 p5=0xff;
 p6=0xff;
 p7=0xff;
 p8=0xff;
 p9=0xff;
 p10=0xff;
 p12=0xff;
 p13=0xff;
 pu20=0;

 
ta0s=0;
ta0ic=0;
ta1s=0;
ta1ic=0;
ta7s=0;
ta7mr=00;
ta7ic=0;
tb0s=0;
tb0ic=0;
//tb1s=0;------>
//tb1ic=0;
int1ic=0;
int2ic=0;
int3ic=0;
int4ic=0;
// 
s2ric=0;
s2tic=0;
s0tic=0;
s0ric=0;
ta2ic=0;
//add-------------2004--2-21
u0mr=0;
u2mr=0;
//add2004-2-21
if((0==pin_tingchaodianchi)||(0==remote_display_7day))
	{
		displayalloroff(0);     

// lcd off

//delay_1ms();
		seg=00;
		lcdm=00;
		seg=0xff;
	}
//add-------------------->2003-7-21
asm("mov.b #00h,3a8h"); 
asm("mov.b #00h,3a9h");
//seg=0xff;
//add-------------------->2003-7-21end


pd0=0;
adcon2=00;
// an0
adcon1=0x00;//     0x31;
adcon0=0x00;
adst=0;
kupm=0;


asm("NOP");
asm("NOP");
asm("NOP");
asm("NOP");
asm("FSET I");     // SET
asm("NOP");
asm("NOP");
asm("NOP");
asm("NOP");
prc0=1;
cm04=1;
cm07=1;
asm("NOP");
asm("NOP");
asm("NOP");
asm("NOP");
asm("NOP");
asm("NOP");
asm("NOP");
asm("NOP");
cm05=1;
prc0=0;
asm("NOP");
asm("NOP");
asm("NOP");
asm("NOP");
asm("NOP");
asm("NOP");
asm("NOP");
asm("NOP");
asm("WAIT");
asm("NOP");
asm("NOP");
asm("NOP");
asm("NOP");
asm("NOP");
asm("NOP");
asm("NOP");
asm("NOP");

}


⌨️ 快捷键说明

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