下面是楼主的接受程序
- #include "led.h"
- #include "delay.h"
- #include "key.h"
- #include "sys.h"
- #include "usart.h"
- #include "wdg.h"
- #include "timer.h"
- #include "beep.h"
- #include "si4463.h"
- #include <string.h>
- #include <stdlib.h>
- int main(void)
- {
- // u16 t=0;
- delay_init(); //延时函数初始化
- NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);//设置中断优先级分组为组2:2位抢占优先级,2位响应优先级
- uart_init(115200); //串口初始化为115200
- LED_Init(); //初始化与LED连接的硬件接口
- KEY_Init(); //初始化按键
- BEEP_Init();BEEP=1;
- TIM3_Int_Init(49,7199);//10Khz的计数频率,计数到5000为500ms 主要用于喂狗500ms一次6
- // IWDG_Init(6,625); //与分频数为4*2^6=256,重载值为625,溢出时间为256*625/40=4000ms=4s 4s没喂就复位
- flag_interrupt_4463=0;//清除标志位
- RF433_GPIO_config();
- EXTI_RF433Configuration();
- SI446X_RESET( ); //SI446X 模块复位
- SI446X_CONFIG_INIT( ); //SI446X 模块初始化配置函数
- SI446X_SET_PROPERTY_1(PA_PWR_LVL, 0X7F);
- SI446X_START_RX( 0, 0, PACKET_LENGTH,8,8,8 ); //接收状态
- // memset(Si4463_rxbuffer,0,10);//清空接受缓存
- BEEP=0;
-
- while(1)
- {
- if(si4463irq==0)
- {
- flag_interrupt_4463=0;//清除标志位
- SI446X_INT_STATUS( Si4463_rxbuffer ); //读状态寄存器
- if( Si4463_rxbuffer[3] & ( 1<<4 ) ) //接收中断产生 收到有效数据包
- {
- g_length = SI446X_READ_PACKET( Si4463_rxbuffer );//未知
- g_Si4463_RecvFlag=1;//未知
- SI446X_START_RX( 0, 0, PACKET_LENGTH,8,8,8 );
- if(Si4463_rxbuffer[1]==0x50)
- {
- memset(Si4463_rxbuffer,0,10);//清空接受缓存
- BEEP=!BEEP;
- }
- SI446X_CONFIG_INIT(); // ??????,?????WDS??????
- SI446X_START_RX(0, 0, PACKET_LENGTH, 8, 8, 8); // ??????
- }
- if (Si4463_rxbuffer[3] & ( 1<<5 )) //发送中断
- {
- SI446X_START_RX( 0, 0, PACKET_LENGTH,8,8,8 ); //接收状态
- }
- }
- if(send_adc_flag>100)//大约1s钟改变一次状态
- {
- send_adc_flag=0;
- LED0=!LED0;
- }
- }
- }
复制代码 |