init
This commit is contained in:
+223
@@ -0,0 +1,223 @@
|
||||
C51 COMPILER V9.60.7.0 RF_SEND 07/03/2025 11:27:50 PAGE 1
|
||||
|
||||
|
||||
C51 COMPILER V9.60.7.0, COMPILATION OF MODULE RF_SEND
|
||||
OBJECT MODULE PLACED IN .\hex\rf_send.obj
|
||||
COMPILER INVOKED BY: D:\Program Files\Keil_v5\C51\BIN\C51.EXE rf_send.c OMF2 OPTIMIZE(9,SIZE) BROWSE DEBUG PRINT(.\lst\r
|
||||
-f_send.lst) TABS(2) OBJECT(.\hex\rf_send.obj)
|
||||
|
||||
line level source
|
||||
|
||||
1 #ifndef _rf_send_C_
|
||||
2 #define _rf_send_C_
|
||||
3 /*********************************************************************************************************
|
||||
-************/
|
||||
4 #include "ca51f5_config.h"
|
||||
5 #include "includes\ca51f5sfr.h"
|
||||
6 #include "includes\ca51f5xsfr.h"
|
||||
7 #include "includes\gpiodef_f5.h"
|
||||
8
|
||||
9 #include "Library\Includes\delay.h"
|
||||
10
|
||||
11 #include "rf_send.h"
|
||||
12
|
||||
13 sbit Pin_rf = P3^2;
|
||||
14 unsigned char D0,D1;
|
||||
15 unsigned int idata ID;
|
||||
16 unsigned char RF_Time; //用于控制RF发送间隔时间
|
||||
17
|
||||
18
|
||||
19 unsigned char Send433_Status = 0; //发送过程的状态
|
||||
20 unsigned int Send433_Time = 0; //记录433发送数据的高低电平时间
|
||||
21
|
||||
22 unsigned char Yaokong_Data[3]={0};
|
||||
23
|
||||
24 unsigned char Send433_Byte_Cont=0;//记录发送一组433数据的字节数
|
||||
25 unsigned char Send433_Bit_Cont = 0; //记录发送位
|
||||
26 unsigned char Temp=0;
|
||||
27 unsigned char Chose_Data_En=0;//使能选择一组433数据的第N个字节
|
||||
28
|
||||
29 void Send433_Byte(void) //100us执行一次
|
||||
30 {
|
||||
31 1 switch (Send433_Status)
|
||||
32 1 {
|
||||
33 2 case 0: //同步头高
|
||||
34 2 Pin_rf = 1;
|
||||
35 2 if (++Send433_Time >= 4)//高电平400us
|
||||
36 2 {
|
||||
37 3 Send433_Time = 0;
|
||||
38 3 Send433_Status = 1; //进入同步头低
|
||||
39 3 }
|
||||
40 2 break;
|
||||
41 2 case 1://同步头低电平
|
||||
42 2 Pin_rf = 0;
|
||||
43 2 if (++Send433_Time >= 120)//电平12300us
|
||||
44 2 {
|
||||
45 3 Send433_Time = 0;
|
||||
46 3 Send433_Status = 2; //进入发送24位
|
||||
47 3 }
|
||||
48 2 break;
|
||||
49 2 case 2:
|
||||
50 2
|
||||
51 2 if(!Chose_Data_En)//还没开始发送 或者上次已经发送完一个字节才使能选择
|
||||
52 2 {
|
||||
53 3 Chose_Data_En=1;
|
||||
C51 COMPILER V9.60.7.0 RF_SEND 07/03/2025 11:27:50 PAGE 2
|
||||
|
||||
54 3 Temp=Yaokong_Data[Send433_Byte_Cont];
|
||||
55 3 //Send433_Byte_Cont++;
|
||||
56 3 }
|
||||
57 2
|
||||
58 2 Send433_Time++;
|
||||
59 2 if (Temp & 0x80) //1
|
||||
60 2 {
|
||||
61 3 if (Send433_Time <= 12)
|
||||
62 3 {
|
||||
63 4 Pin_rf = 1;
|
||||
64 4 }
|
||||
65 3 else if (Send433_Time >= 13)
|
||||
66 3 {
|
||||
67 4 Pin_rf = 0;
|
||||
68 4 if (Send433_Time == 16)
|
||||
69 4 {
|
||||
70 5 Send433_Time = 0;
|
||||
71 5 Temp <<= 1;
|
||||
72 5 Send433_Bit_Cont++;
|
||||
73 5 }
|
||||
74 4 }
|
||||
75 3 }
|
||||
76 2 else//0
|
||||
77 2 {
|
||||
78 3 if (Send433_Time <= 4)
|
||||
79 3 {
|
||||
80 4 Pin_rf = 1;
|
||||
81 4 }
|
||||
82 3 else if (Send433_Time >= 5)
|
||||
83 3 {
|
||||
84 4 Pin_rf = 0;
|
||||
85 4 if (Send433_Time == 16)
|
||||
86 4 {
|
||||
87 5 Send433_Time = 0;
|
||||
88 5 Temp <<= 1;
|
||||
89 5 Send433_Bit_Cont++;
|
||||
90 5 }
|
||||
91 4 }
|
||||
92 3 }
|
||||
93 2 if (Send433_Bit_Cont == 8)//发送完一字节
|
||||
94 2 {
|
||||
95 3 Send433_Bit_Cont = 0;
|
||||
96 3
|
||||
97 3 Chose_Data_En=0;//使能选择下一个字节
|
||||
98 3 if(++Send433_Byte_Cont==3)
|
||||
99 3 {
|
||||
100 4 Send433_Byte_Cont=0;
|
||||
101 4
|
||||
102 4 if(flagStart == 1)
|
||||
103 4 {
|
||||
104 5 Send433_Status = 3; //结束脉冲
|
||||
105 5 }
|
||||
106 4 else
|
||||
107 4 {
|
||||
108 5 Send433_Status = 0; //一帧数据发送完毕
|
||||
109 5 }
|
||||
110 4
|
||||
111 4 }
|
||||
112 3 }
|
||||
113 2 break;
|
||||
114 2
|
||||
115 2 case 3:
|
||||
C51 COMPILER V9.60.7.0 RF_SEND 07/03/2025 11:27:50 PAGE 3
|
||||
|
||||
116 2 if (++Send433_Time <= 4)
|
||||
117 2 {
|
||||
118 3 Pin_rf = 1;
|
||||
119 3 }
|
||||
120 2 else
|
||||
121 2 {
|
||||
122 3 Pin_rf = 0;
|
||||
123 3 Send433_Time = 0;
|
||||
124 3 // flagStart = 0;
|
||||
125 3 Send433_Status = 0;
|
||||
126 3 TR0 = 0; //定时器0禁止
|
||||
127 3
|
||||
128 3 }
|
||||
129 2 break;
|
||||
130 2 default:
|
||||
131 2 break;
|
||||
132 2 }
|
||||
133 1 }
|
||||
134
|
||||
135
|
||||
136 //void RF_send(unsigned char cnt);
|
||||
137 //void send_8bit(unsigned char n);
|
||||
138
|
||||
139 ///*****************************************/
|
||||
140
|
||||
141 //void RF_send(unsigned char cnt)
|
||||
142 //{
|
||||
143 // unsigned char i;
|
||||
144
|
||||
145 // for(i=cnt;i>0;i--) //单个包发送次数
|
||||
146 // {
|
||||
147 // Pin_rf=1;
|
||||
148 // Delay_50us(8); //同步码高电平
|
||||
149 // Pin_rf=0;
|
||||
150 // Delay_ms(12); //同步码低电平
|
||||
151 // Pin_rf=1;
|
||||
152
|
||||
153 // send_8bit(D0);
|
||||
154 // send_8bit(D1);
|
||||
155 // send_8bit(valueSend);
|
||||
156 //
|
||||
157 //// if(WheelSliderPosition == -1&&KeysFlagSN == 0)
|
||||
158 //// {
|
||||
159 //// Pin_rf=1;
|
||||
160 //// Delay_50us(7);
|
||||
161 //// Pin_rf=0;
|
||||
162 //// }
|
||||
163 // }
|
||||
164 //}
|
||||
165 ////---------------------------------------------
|
||||
166 //void send_8bit(unsigned char n)
|
||||
167 //{
|
||||
168 // unsigned char i;
|
||||
169 // for(i=8;i>0;i--)
|
||||
170 // {
|
||||
171 // Pin_rf=1;
|
||||
172 // if(n&0x80)
|
||||
173 // {
|
||||
174 // Delay_50us(24);
|
||||
175 // Pin_rf=0;
|
||||
176 // Delay_50us(7);
|
||||
177 // }
|
||||
C51 COMPILER V9.60.7.0 RF_SEND 07/03/2025 11:27:50 PAGE 4
|
||||
|
||||
178 // else
|
||||
179 // {
|
||||
180 // Delay_50us(7);
|
||||
181 // Pin_rf=0;
|
||||
182 // Delay_50us(24);
|
||||
183 // }
|
||||
184 // n<<=1;
|
||||
185 // }
|
||||
186 //}
|
||||
187
|
||||
188 #endif
|
||||
|
||||
|
||||
MODULE INFORMATION: STATIC OVERLAYABLE
|
||||
CODE SIZE = 260 ----
|
||||
CONSTANT SIZE = ---- ----
|
||||
XDATA SIZE = ---- ----
|
||||
PDATA SIZE = ---- ----
|
||||
DATA SIZE = 13 ----
|
||||
IDATA SIZE = 2 ----
|
||||
BIT SIZE = ---- ----
|
||||
EDATA SIZE = ---- ----
|
||||
HDATA SIZE = ---- ----
|
||||
XDATA CONST SIZE = ---- ----
|
||||
FAR CONST SIZE = ---- ----
|
||||
END OF MODULE INFORMATION.
|
||||
|
||||
|
||||
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
|
||||
Reference in New Issue
Block a user