标题: BK4815 RF transceiver源程序开发资料下载 [打印本页]

作者: 1713643329    时间: 2021-5-12 10:51
标题: BK4815 RF transceiver源程序开发资料下载
The BK4815N is a half duplex TDD FM
transceiver operating from 124 MHz to 560 MHz band for worldwide personalradio. Besides speech communication, the BK4815N on-chip FSK data modem
supports F2D and F1W emission to be
used in both FRS and DPMR band for textmessage and GPS information exchange.


单片机源程序如下:
  1. #include"system.h"
  2. #include"math.h"
  3. #include"bk4815.h"
  4. #include"memory.h"
  5. #include"voice.h"
  6. #include"uart.h"
  7. #include"time.h"

  8. #define OUT_BK4815_SCK                P06
  9. #define OUT_BK4815_SCN                P05
  10. #define OUT_BK4815_SDATA        P04
  11. #define IN_BK4815_SDATA                P04
  12. #define IN_BK4815_IO0                P03
  13. #define IN_BK4815_IO1                P02
  14. #define IN_BK4815_INIT                P01

  15. #define SET_BK4815_DATA_IN        {P0MDH &= 0xFC; P0MDH |= 0x01;}
  16. #define SET_BK4815_DATA_OUT {P0MDH &= 0xFC; P0MDH |= 0x02;}

  17. #define OSC                26000000L
  18. #define IF                IF_137K
  19. #define        DIV         DIV_8

  20. #define VCC_TX        0x0491
  21. #define VCC_RX        0x048a
  22. #define VCC_NO        0x0492




  23. u16 readBK4815Reg(u8 reg)
  24. {
  25.         u8 i;
  26.         u16 dat;
  27.         
  28.         reg <<= 1;
  29.         reg |= 0x01;  //读的地址
  30.         OUT_BK4815_SCK = 0;
  31.         OUT_BK4815_SCN = 0;  
  32.         
  33.         for(i=0; i<8; i++)
  34.         {
  35.                 if(reg & 0x80) OUT_BK4815_SDATA = 1;
  36.                 else OUT_BK4815_SDATA = 0;
  37.                 OUT_BK4815_SCK = 1;
  38.                 OUT_BK4815_SCK = 0;
  39.                 reg <<= 1;
  40.         }
  41.         SET_BK4815_DATA_IN
  42.         for(i=0; i<16; i++)
  43.         {
  44.                 dat <<= 1;
  45.                 dat |= IN_BK4815_SDATA;
  46.                 OUT_BK4815_SCK = 1;
  47.                 OUT_BK4815_SCK = 0;
  48.         }
  49.         OUT_BK4815_SCN = 1;
  50.         SET_BK4815_DATA_OUT
  51.         return dat;
  52. }

  53. void writeBK4815Reg(u8 reg, u16 dat)
  54. {
  55.         u8 i;
  56.         
  57.         reg <<= 1;         //写的地址

  58.         OUT_BK4815_SCK = 0;
  59.         OUT_BK4815_SCN = 0;  
  60.         
  61.         for(i=0; i<8; i++)
  62.         {
  63.                 if(reg & 0x80) OUT_BK4815_SDATA = 1;
  64.                 else OUT_BK4815_SDATA = 0;
  65.                 OUT_BK4815_SCK = 1;
  66.                 OUT_BK4815_SCK = 0;
  67.                 reg <<= 1;
  68.         }
  69.         for(i=0; i<16; i++)
  70.         {
  71.                 if(dat & 0x8000) OUT_BK4815_SDATA = 1;
  72.                 else OUT_BK4815_SDATA = 0;
  73.                 OUT_BK4815_SCK = 1;
  74.                 OUT_BK4815_SCK = 0;
  75.                 dat <<= 1;
  76.         }
  77.         OUT_BK4815_SCN = 1;  
  78. }

  79. void initBK4815Port(void)
  80. {
  81. //#define OUT_BK4815_SCK        P06
  82. //#define OUT_BK4815_SCN        P05
  83. //#define OUT_BK4815_SDATA        P04
  84.         P0MDH &= 0XC0;
  85.         P0MDH |= 0X2A;
  86.         OUT_BK4815_SCN = 1;
  87. }
复制代码


BK4815.zip

3.72 MB, 下载次数: 64, 下载积分: 黑币 -5


作者: Kongman    时间: 2024-4-25 23:09
mark,好东东,不知道啥时候能玩下,这个对讲机结构够精简




欢迎光临 (http://www.51hei.com/bbs/) Powered by Discuz! X3.1