wrtrf01.c

来自「keil C51编写的的RFM01和RFM02应用程序」· C语言 代码 · 共 34 行

C
34
字号
//-变量声明---------------------------------------------------------------------------------
#include <reg52.h>
#include "WRT_CMD.h"
#include "UART_init.h"
#include "GET_CMD.h"
sbit nSEL1=P1^3;
sbit nSEL2=P1^2;
//sbit REC_flag=P0^1;
//------------------------------------------------------------------------------------------
// name:wrtRF01
//description:designed for Wireless RS232 adapter.setting the "A" board RFM01 frequence command
//input:NON
//output:NON
//designed by KongRui,Version 1.0,2007/05/13
//-------------------------------------------------------------------------------------------
void wrtRF01(unsigned int RF01CSC,RF01FSC,RF01DRC){
//  bit SDI,SCK;
  nSEL1=0;			//choose RFM01
  nSEL2=1;
//  REC_flag=0;
 // SDI=P1^7;
 // SCK=P1^5;
  WRT_CMD(0xc080);		//receiver setting command
  WRT_CMD(0xc240);		//low battery detector and microcontroller clock divider command
						//CLK out=1.66MHz
  WRT_CMD(0xc6db);		//AFC command,digital filler,DQD=4
  WRT_CMD(0xce88);   	//output and FIFO mode command,no use FIFO
  WRT_CMD(RF01CSC);	//configuration setting command,get the command from the computer
  WRT_CMD(RF01FSC);	//frequency setting command,get the command from the computer
  WRT_CMD(RF01DRC);	//data rate command,get the command from the computer
  WRT_CMD(0xc081);		//open RX,allow receive
//  REC_flag=1;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?