找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 2462|回复: 1
打印 上一主题 下一主题
收起左侧

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, 下载次数: 55, 下载积分: 黑币 -5

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏1 分享淘帖 顶 踩
回复

使用道具 举报

楼主
ID:1010505 发表于 2024-4-25 23:09 | 只看该作者
mark,好东东,不知道啥时候能玩下,这个对讲机结构够精简
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

快速回复 返回顶部 返回列表