📄 comm_remote.h
字号:
/******************************************/
//remote send----------------------------------->start
unsigned char ta2_status;
union byte_dis ta2_use;
union byte_dis ta2_use1;
void init_ta2()
{
ta2_status=0;
ta2s=0;
ta2ic=0;
ta2mr=0x00;
ta2=8330; //01 boud1200
udf0=0;
trgsr0=0;
onsf0=00;
cpsrf=0x80;
ta2ic=7;
ta2s=1;
ta7s=0;
ta7mr=0x27;
ta7ic=0;
// pwm 38k,50%
ta7=0x8000;
}
#pragma INTERRUPT ta2_int()
void ta2_int()
{
if(RFLAG_SEND_REMOTE_START==1)
{
if(ta2_status==0)
{
if(RLEN_REMOTE_T_BUFFER==0)
{
RFLAG_SEND_REMOTE_START=0;
ta7s=0;
RLEN_REMOTE_HUALONG=0;
remote_status=remote_phase_start;
RREMOTE_TIMER=0;
tb0ic=0;// di
tb0s=0; //start timeb0
udf0=0;
trgsr0=0;
onsf0=0x0;
cpsrf=0x80;
tb0ic=0;
tb0s=0;
// pwm stop
ta7s=0;
int3ic=7;
}
else
{
ta2_use.byte=RREMOTE_HUALONG_BUFFER[RCURRENTADDR_REMOTE_T_BUFFER];
RCURRENTADDR_REMOTE_T_BUFFER=RCURRENTADDR_REMOTE_T_BUFFER+1;
RLEN_REMOTE_T_BUFFER=RLEN_REMOTE_T_BUFFER-1;
ta7s=1;// start bit 0
//changed jiao yan set a value send p or e
ta2_use1.bit.b0=ta2_use.bit.b0^ta2_use.bit.b1^ta2_use.bit.b2^ta2_use.bit.b3
^ta2_use.bit.b4^ta2_use.bit.b5^ta2_use.bit.b6^ta2_use.bit.b7;
if(sendremote_pry==0)// p
ta2_use1.bit.b0=~ta2_use1.bit.b0;
ta2_status=1;
}
}
else
{
if((0<ta2_status)&&(ta2_status<9))
{
if(ta2_use.bit.b0==1)
ta7s=0;
else
ta7s=1;
ta2_use.byte=ta2_use.byte>>1;
ta2_status=ta2_status+1;
}
else
{
if(ta2_status==9)
{
if(ta2_use1.bit.b0==1)
ta7s=0;
else
ta7s=1;
if(RLEN_REMOTE_T_BUFFER==0)
ta2_status=11;// add--------------->
else
ta2_status=10;
}
else
{
if(ta2_status==10)
{
ta7s=0;
ta2_status=11;
}
else
{
ta7s=0;
ta2s=1;
ta2_status=0;
}
}
}
}
}
}
//remote send----------------------------------->end
/**************************************************************/
/*********************************************************************/
//remote comm---------------------------------------------->start
//chu shi hong wai
void remote_use()
{
remote_status=remote_phase_start;
RREMOTE_TIMER=0;
RLEN_REMOTE_HUALONG=0;// zhang ji rec byte len
RPROTOCOL_REMOTE_1=PROTOCOL_START;
tb0ic=0;
tb0s=0;
udf0=0;
trgsr0=0;
onsf0=0x0;
cpsrf=0x80;
tb0ic=0;
tb0s=0;
ta7s=0;
int3ic=7;
RDISPLAY_REMOTEINFO_STATUS=INFO_START;
}
void init_remote()
{
rtime_yaokong_rec=0;// zhang ji chao shi(byte to byte)(max 500 ms)
yaokong_chaoshi_timer=0;// yao kong qi chao shi yong code to code(max 200 ms)
RLEN_REMOTE_YAOKONG=0;// yao kong rec num bit
RLEN_REMOTE_T_BUFFER=0;// zhang ji send byte len
RCURRENTADDR_REMOTE_T_BUFFER=0;//zhang ji send addr(point)
RSEND_REMOTE_DELAY_TIMER=0;//zhang ji delay time (rec to send)
RFLAG_SEND_REMOTE_START=0;// zhang ji start flag (send)
RDISPLAY_REMOTEINFO_STATUS=INFO_START;// addr type ack
remote_status_start=remote_start_1;
remote_status_hualong=REMOTE_HUALONG_1;
remote_status_yaokong=REMOTE_YAOKONG_3617;
remote_status_zhejiang_quanguo=remote_zhejiang_quanguo_1;
RYAOKONG_DUOJIAN_TIMER=0;// time(zu he jian you xiao shi jian)
RSTATUS_DUOJIAN=NODUOJIAN;// dang qian zu he jian zhuang tai
pindir_irrx=0;
remote_use();
}
// remote comm chu li
void comm_remote_mode()// remote main program
{
// 5 second you chu li
// miao hua long zhang ji you xiao 5 second
if(rzhangji_mima_use_second!=RSOFT_RTC_SECOND)
{
rzhangji_mima_use_second=RSOFT_RTC_SECOND;
if(rtime_remote_5second!=0)
rtime_remote_5second=rtime_remote_5second-1;
if(rtime_zhangjimima!=0)
rtime_zhangjimima=rtime_zhangjimima-1;
if(rtime_zhangjimima==0)
rstatus_zhangji_mima_youxiao=zhangji_mima_youxiao_start;
if(rtime_remote_5second==0)
if(rstatus_zhangji_mima_youxiao==zhangji_mima_youxiao_inhao)
rstatus_zhangji_mima_youxiao=zhangji_mima_youxiao_yes;
}
// zai fa song zhuang tai wei start send xia, chao shi ding shi qi qing wei ling
tongdao=comm_remote;
rbuffer=RREMOTE_HUALONG_BUFFER;
if((remote_status==remote_phase_start)||(remote_status==remote_phase_yaokong)||(remote_status==remote_phase_send))
RREMOTE_TIMER=0;
// zai you jie shou shu ju ji zhuang tai bu wei qi shi xia, pan chao shi fou,
// ruo chao shi, ze chao shi chu li
if((RLEN_REMOTE_HUALONG!=0)||((remote_status!=remote_phase_start)&&(remote_status!=remote_phase_yaokong)))
{
if(RREMOTE_TIMER>=MAX_R_REMOTE_TIMER)
{
remote_use();
}
else
{
switch(remote_status)
{
case remote_phase_start:
num_check_remote=0;
break;
case remote_phase_hualong:
// delete by zhanglong ---->start
// phualong(&RLEN_REMOTE_HUALONG,
// &RDISPLAY_REMOTEINFO_STATUS,
// &remote_status);
// delete by zhanglong ---->end
break;
case remote_phase_zhejiang_quanguo:
judge_quanguo_zhejiang(&RLEN_REMOTE_HUALONG,
&RDISPLAY_REMOTEINFO_STATUS,
&remote_status);
break;
}
}
}
}
//remote comm---------------------------------------------->end
/***********************************************************************/
//remote cuofeng receive------------------------------------------->start
//gao zi ji suo yin hao dui ying xian shi suo yin qi shi hao
const unsigned int table_gaozijiduiyinsuoyinhao[]=
{
1, // di zi ji gao zi ji 0
10, // 1
15,//{15,00}, // 2
20,//{20,0x00}, // 3
25,//{25,0x00}, // 4
30,//{30,0x00}, // 5
35,//{35,0x00}, // 6
40,//{40,0x00}, // 7
45,//{45,0x00}, //8
50,//{50,0x00},//9
55,//{55,0x00},//10
60,//{60,0x00},//11
65,//{65,0x00},//12
70,//{70,0x00},//13
75,//{75,0x00},//14
80,//{80,0x00},//15
85,//{85,0x00},//16
90,//{90,0x00},//17
95,//{95,0x00},//18
100,//{0,0x01}, //19
105,//{0x5,0x01}, //20
110,//{10,0x01}, // 21
115,//{15,0x01}, //22
120,//{20,0x01}, // 23
125,//{25,1}, // 24
130,//{30,1}, //25
138,//{37,1}, //26
142,//{41,1}, // 27
146,//{45,1}, //28
148+1,//{48,1}, //29
151+1,//{51,1}, //30
152+1,//{52,1}, //31
163+1,//{63,1},//zhf32
195+1,//{95,1},//zhf33
225+1,//{25,2},//zhf34
238+1,//{38,2},//zhf35
259+1,//{59,2},//zhf36
262+1,//{62,2},//zhf37
439+1,//{39,4},//zhf38
439+1,//{39,4},//zhf39
271+1,//{71,2},//zhf40
439+1,//{39,4},//zhf41
439+1,//{39,4},//zhf42
293+1,//{93,0x2},//zhf43
300+1,//{0,0x3},//zhf44
307+1,//{0x7,0x3},//zhf45
314+1,//{14,0x3},//zh46
321+1,//{21,0x3},//zhf47
439+1,//{39,0x4},// tbr48
439+1,//{39,0x4},// tbr49
328+1,//{28,0x3},// tbr50
336+1,//{36,0x3},// tbr51
439+1,//{39,0x4},//zhf52
439+1,//{39,0x4},//zhf53
344+1,//{44,0x3},//zhf54
439+1,//{39,0x4},//zhf55
439+1,//{39,0x4},//zhf56
355+1,//{55,0x3},//zhf57
391+1,//{91,3},//zh58 1018
408+1,//{0x8,4},// tbr59
417+1,//{17,4},// tbr60b1
433+1,//{33,4},// tbr61b2
440+1,//{40,4},// tbr62b3
466+1,//{66,4}, // tbr63p0
478+1,//{78,4}, // tbr64p1
490+1,//{90,4}, // tbr65p2
502+1,//{2,5}, // tbr66p3
514+1,//{14,5}, // tbr67p4
526+1,//{26,5},// tbr68p5
542+1,//{42,5},// tbr69q0
554+1//{54,5}// tbr70q1
};//zhf
//dan qian zui da suo yin hao
#define MAX_GAOZIJISUOYINHAO 70
void doyaokongduokey(a)
unsigned char a;
{
RSTATUS_DUOJIAN=a;
RYAOKONG_DUOJIAN_TIMER=DUOJIAN_TIME_VALUE;
}
const unsigned char table_num_by_duokeyvalue[]={0,10,20,30,40,50,59,63,69,69,69,69,69,69,69};
void doyaokongremote(a)
unsigned char a;
{unsigned int m;
unsigned char l;
unsigned char value;
value=1;
if(RSTATUS_DUOJIAN==5)
if(a==9)
value=0;
if(RSTATUS_DUOJIAN==6)
if(a>3)
value=0;
if(RSTATUS_DUOJIAN==7)
if(a>5)
value=0;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -