172 lines
5.9 KiB
Plaintext
172 lines
5.9 KiB
Plaintext
C51 COMPILER V9.60.0.0 RF_SEND 03/28/2026 16:50:47 PAGE 1
|
|
|
|
|
|
C51 COMPILER V9.60.0.0, COMPILATION OF MODULE RF_SEND
|
|
OBJECT MODULE PLACED IN .\hex\rf_send.obj
|
|
COMPILER INVOKED BY: C:\keil5\C51\BIN\C51.EXE rf_send.c OMF2 OPTIMIZE(9,SIZE) BROWSE DEBUG PRINT(.\lst\rf_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 = P0^7;
|
|
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.0.0 RF_SEND 03/28/2026 16:50:47 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 // if(WheelSliderPosition == -1)
|
|
110 5 // {
|
|
111 5 // Send433_Status = 3;
|
|
112 5 // }
|
|
113 5 }
|
|
114 4
|
|
115 4 }
|
|
C51 COMPILER V9.60.0.0 RF_SEND 03/28/2026 16:50:47 PAGE 3
|
|
|
|
116 3 }
|
|
117 2 break;
|
|
118 2
|
|
119 2 case 3:
|
|
120 2 if (++Send433_Time <= 4)
|
|
121 2 {
|
|
122 3 Pin_rf = 1;
|
|
123 3 }
|
|
124 2 else
|
|
125 2 {
|
|
126 3 Pin_rf = 0;
|
|
127 3 Send433_Time = 0;
|
|
128 3 // flagStart = 0;
|
|
129 3 Send433_Status = 0;
|
|
130 3 TR0 = 0; //定时器0禁止
|
|
131 3 }
|
|
132 2 break;
|
|
133 2 default:
|
|
134 2 break;
|
|
135 2 }
|
|
136 1 }
|
|
137
|
|
138 #endif
|
|
|
|
|
|
MODULE INFORMATION: STATIC OVERLAYABLE
|
|
CODE SIZE = 261 ----
|
|
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)
|