📄 ytep_rf.lst
字号:
###############################################################################
# #
# 04/Dec/2008 16:07:58 #
# IAR ARM ANSI C/C++ Compiler V5.11.0.20622/W32 EVALUATION #
# Copyright 1999-2007 IAR Systems. All rights reserved. #
# #
# Cpu mode = thumb #
# Endian = little #
# Source file = E:\ELE\yten\pro\message\ytep_RF.c #
# Command line = E:\ELE\yten\pro\message\ytep_RF.c -D EMB_FLASH -lcN #
# E:\ELE\yten\pro\Release\List\ -o #
# E:\ELE\yten\pro\Release\Obj\ --no_cse --no_unroll #
# --no_inline --no_code_motion --no_tbaa --no_clustering #
# --no_scheduling --debug --endian little --cpu Cortex-M3 #
# -e --fpu None --dlib_config "C:\Program Files\IAR #
# Systems\Embedded Workbench 5.0 #
# Evaluation\ARM\INC\DLib_Config_Normal.h" -I #
# E:\ELE\yten\pro\ -I E:\ELE\yten\pro\..\LIBRARY\INC\ -I #
# "C:\Program Files\IAR Systems\Embedded Workbench 5.0 #
# Evaluation\ARM\INC\" -On #
# List file = E:\ELE\yten\pro\Release\List\ytep_RF.lst #
# Object file = E:\ELE\yten\pro\Release\Obj\ytep_RF.o #
# #
# #
###############################################################################
E:\ELE\yten\pro\message\ytep_RF.c
1 //******************************************
2 #include"ytep.h"
3 #include"ytepfunction.h"
4 #define ytep_RF_file
5
6 Int32U IsrReceive(REC *Re)
7 {
8 static _ReSend IR;
9 Boolean IO_RFRX=1;
10 if((Re->B_Send!=0)||Re->Flag!=0)
11 {
12 IR.sys=0,IR.low=0;
13 return 0;
14 }
15 if((IO_RFIn1&B_RFIn1)==0)IO_RFRX=0;
16 if((IO_RFIn2&B_RFIn2)==0)IO_RFRX=0;
17 if((IO_RFIn3&B_RFIn3)==0)IO_RFRX=0;
18 if((IO_RFIn4&B_RFIn4)==0)IO_RFRX=0;
19 Clr_bit(IO_RFCTL,B_RFCTL);
20 if(IR.sys==0&&IO_RFRX!=0)
21 {
22 if(IR.low>=30)
23 IR.sys=1,IR.REG=0,IR.loop=0,IR.counter=0;
24 IR.low=0,IR.high=0;
25 }
26 if(IO_RFRX==0&&IR.sys==0)IR.low++;
27 if(IO_RFRX==0&&IR.sys!=0)
28 {
29 if(IR.B_high!=0)
30 {
31 IR.B_high=0,IR.REG<<=1;
32 if(IR.high>=8)
33 IR.REG|=1;
34 if(++IR.counter>=8)
35 {
36 Re->Rec8U[IR.loop]=IR.REG;
37 IR.loop++;
38 IR.counter=0;
39 }
40 IR.low=IR.high=0;
41 }else if(++IR.low>=20)IR.sys=0;
42 }
43 if(IO_RFRX!=0&&IR.sys!=0)
44 {
45 IR.B_high=1;
46 if(++IR.high>=30||IR.loop>=7)
47 IR.sys=0,Re->Flag=1;
48
49 }
50 return 0;
51 }
52 //////////////////////////////////////////
53
54 Int32U IsrSend(REC *Re)
55 {
56 static _ReSend IS;
57 Int16U Sa;
58 if(Re->B_Send==0)
59 {
60 IS.sys=IS.counter=0;
61 return 0;
62 }
63 Set_bit(IO_RFCTL,B_RFCTL);
64 if(IS.sys==0)
65 {
66 if(IS.counter<=3)Set_bit(IO_RFTX,B_RFTX);
67 else Clr_bit(IO_RFTX,B_RFTX);
68
69 if(++IS.counter>=43)IS.sys=1,IS.loop=IS.counter=0;
70 return 0;
71 }
72 if(IS.sys!=0)
73 {
74 if((IS.loop&1)==0)
75 {
76 Set_bit(IO_RFTX,B_RFTX);
77
78 if(Re->SendChannel&0x8)Sa=C_asyn_H;
79 else Sa=C_asyn_L;
80 if(IS.loop>=8)Sa=1;
81 if(++IS.counter>=Sa)
82 {
83 IS.counter=0;
84 IS.loop++;
85 Re->SendChannel<<=1;
86 }
87 }else
88 {
89 Clr_bit(IO_RFTX,B_RFTX);
90 if(++IS.counter>=C_asyn_L)IS.loop++,IS.counter=0;
91 if(IS.loop>=9)Set_bit(IO_RFTX,B_RFTX),Re->B_Send=Re->Flag=0;
92
93 }
94 }
95 return 0;
96 }
97 //////////////////////////////////////////////
98 //////////////////////////////////
99 /*CHK_RF(&RF,YT->Sensor);*///5ms
100 /************************************/
101 Int32U CHK_RF(REC *p,SensorRF *pos)
102 {
103 volatile Int8U a,b;
104 Int16U crc_data;
105 static Int8U Timcount;
106 static Int8U RF_error[4]={0,0,0,0};
107
108 if(++Timcount<4)return 0;
109 Timcount=0;
110 if(p->channel>=4)p->channel=0;
111 if(p->Flag!=0)
112 {
113 crc_data=cal_crc(&p->Rec8U[0],6);
114 crc_data=crc_data&0xff; //???????????
115 a=(p->channel)&0x03;
116 b=p->Rec8U[0]>>6;
117
118 if(a==b&&crc_data==p->Rec8U[6])
119 {
120 RF_error[p->channel]=0;
121 pos+=p->channel;
122 pos->ATem=p->Rec8U[2];
123 pos->AVol=p->Rec8U[0]&0XF;
124 if((p->Rec8U[0]&0x20))pos->AVol+=21;
125 pos->BTem=p->Rec8U[3];
126 pos->BVol=p->Rec8U[1]>>4;
127 if((p->Rec8U[0]&0x20))pos->BVol+=21;
128 pos->CTem=p->Rec8U[4];
129 pos->CVol=p->Rec8U[1]&0XF;
130 if((p->Rec8U[0]&0x20))pos->CVol+=21;
131 }
132 p->Flag=FALSE;
133 }
134
135 if(++RF_error[p->channel]>=5)
136 {
137 pos+=p->channel;
138 pos->ATem=0xFF;
139 pos->AVol=0xFF;
140 pos->BTem=0XFF;
141 pos->BVol=0xFF;
142 pos->CTem=0XFF;
143 pos->CVol=0xFF;
144 }
145 if(++(p->channel)>=4)p->channel=0;
146 a=(p->channel)<<2,b=(p->channel)^0x03;
147 p->SendChannel=a|b;
148 p->B_Send=TRUE,p->Flag=FALSE;;
149 Set_bit(IO_RFCTL,B_RFCTL);
150 return 0;
151 }
152 //////////////////////////////////////////////
153 //////////////////////////////////////////////
154 //////////////////////////////////////////////
155 Int16U cal_crc(Int8U *ptr, Int8U len)
156 {
157 Int16U crc=0xffff;
158 Int8U i;
159 while(len!=0)
160 {
161 crc^=*ptr;
162 for(i=0;i<8;i++)
163 {
164 if((crc&0x0001)==0) crc=crc>>1;
165 else
166 {
167 crc=crc>>1;
168 crc^=0xA001;
169 }
170 }
171 len-=1,ptr++;
172 }
173 return crc;
174 }
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
Maximum stack usage in bytes:
Function .cstack
-------- -------
CHK_RF 24
IsrReceive 0
IsrSend 0
cal_crc 8
Section sizes:
Function/Label Bytes
-------------- -----
IsrReceive 412
IR 8
IsrSend 312
IS 8
CHK_RF 332
Timcount 1
RF_error 4
cal_crc 76
??DataTable1 4
??DataTable3 4
21 bytes in section .bss
1 140 bytes in section .text
1 140 bytes of CODE memory
21 bytes of DATA memory
Errors: none
Warnings: 2
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -