VX-3R APRS发射试验

VX-3R本身是不带APRS功能的,不过可能通过外加TNC实现APRS功能。
有大佬已经用Arduino实现了相应的发射功能:
https://github.com/handiko/Arduino-APRS
我要做的,就是简单修改一下代码,做一个转接板。
YEASU官方没有给出VX-3R的音频接口四节定义,估计是为了推销自家的CT-44,手册上只有这么一个图
在这里插入图片描述
在网上查了一圈,pinguide上有这么个图,然后提了一句“Pinouts for speaker and mic are reversed on the vx-3r”。但是经我实际验证,VX-3R的定义跟网站上是一样的,并没有reversed。
转接板原理图如下:
在这里插入图片描述
实物图如下:
在这里插入图片描述
值得注意的是,VX-3R的PTT是低电平发射。
完整的代码如下:

/**  Copyright (C) 2018 - Handiko Gesang - www.github.com/handiko*  *  This program is free software: you can redistribute it and/or modify*  it under the terms of the GNU General Public License as published by*  the Free Software Foundation, either version 3 of the License, or*  (at your option) any later version.*  *  This program is distributed in the hope that it will be useful,*  but WITHOUT ANY WARRANTY; without even the implied warranty of*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the*  GNU General Public License for more details.*  *  You should have received a copy of the GNU General Public License*  along with this program.  If not, see <https://www.gnu.org/licenses/>.*/
#include <math.h>
#include <stdio.h>// Defines the Square Wave Output Pin
#define OUT_PIN 2#define _1200   1
#define _2400   0#define _FLAG       0x7e
#define _CTRL_ID    0x03
#define _PID        0xf0
#define _DT_EXP     ','
#define _DT_STATUS  '>'
#define _DT_POS     '!'#define _NORMAL     1
#define _BEACON     2#define _FIXPOS         1
#define _STATUS         2
#define _FIXPOS_STATUS  3#define _PTT      5bool nada = _2400;/** SQUARE WAVE SIGNAL GENERATION* * baud_adj lets you to adjust or fine tune overall baud rate* by simultaneously adjust the 1200 Hz and 2400 Hz tone,* so that both tone would scales synchronously.* adj_1200 determined the 1200 hz tone adjustment.* tc1200 is the half of the 1200 Hz signal periods.* *      -------------------------                           -------*     |                         |                         |*     |                         |                         |*     |                         |                         |* ----                           -------------------------* *     |<------ tc1200 --------->|<------ tc1200 --------->|*     * adj_2400 determined the 2400 hz tone adjustment.* tc2400 is the half of the 2400 Hz signal periods.* *      ------------              ------------              -------*     |            |            |            |            |*     |            |            |            |            |            *     |            |            |            |            |* ----              ------------              ------------* *     |<--tc2400-->|<--tc2400-->|<--tc2400-->|<--tc2400-->|*     */
const float baud_adj = 0.975;
const float adj_1200 = 1.0 * baud_adj;
const float adj_2400 = 1.0 * baud_adj;
unsigned int tc1200 = (unsigned int)(0.5 * adj_1200 * 1000000.0 / 1200.0);
unsigned int tc2400 = (unsigned int)(0.5 * adj_2400 * 1000000.0 / 2400.0);/** This strings will be used to generate AFSK signals, over and over again.*/
const char *mycall = "BG7GF";
char myssid = 7;const char *dest = "APRS";
const char *dest_beacon = "BEACON";const char *digi = "WIDE2";
char digissid = 1;const char *mystatus = "Hello World, This is a simple Arduino APRS Transmitter !";const char *lat = "28XX.09N";
const char *lon = "112XX.62E";
const char sym_ovl = 'H';
const char sym_tab = 'a';unsigned int tx_delay = 5000;
unsigned int str_len = 400;char bit_stuff = 0;
unsigned short crc=0xffff;/** */
void set_nada_1200(void);
void set_nada_2400(void);
void set_nada(bool nada);void send_char_NRZI(unsigned char in_byte, bool enBitStuff);
void send_string_len(const char *in_string, int len);void calc_crc(bool in_bit);
void send_crc(void);void send_packet(char packet_type, char dest_type);
void send_flag(unsigned char flag_len);
void send_header(char msg_type);
void send_payload(char type);void set_io(void);
void print_code_version(void);
void print_debug(char type, char dest_type);/** */
void set_nada_1200(void)
{digitalWrite(OUT_PIN, HIGH);delayMicroseconds(tc1200);digitalWrite(OUT_PIN, LOW);delayMicroseconds(tc1200);
}void set_nada_2400(void)
{digitalWrite(OUT_PIN, HIGH);delayMicroseconds(tc2400);digitalWrite(OUT_PIN, LOW);delayMicroseconds(tc2400);digitalWrite(OUT_PIN, HIGH);delayMicroseconds(tc2400);digitalWrite(OUT_PIN, LOW);delayMicroseconds(tc2400);
}void set_nada(bool nada)
{if(nada)set_nada_1200();elseset_nada_2400();
}/** This function will calculate CRC-16 CCITT for the FCS (Frame Check Sequence)* as required for the HDLC frame validity check.* * Using 0x1021 as polynomial generator. The CRC registers are initialized with* 0xFFFF*/
void calc_crc(bool in_bit)
{unsigned short xor_in;xor_in = crc ^ in_bit;crc >>= 1;if(xor_in & 0x01)crc ^= 0x8408;
}void send_crc(void)
{unsigned char crc_lo = crc ^ 0xff;unsigned char crc_hi = (crc >> 8) ^ 0xff;send_char_NRZI(crc_lo, HIGH);send_char_NRZI(crc_hi, HIGH);
}void send_header(char msg_type)
{char temp;/** APRS AX.25 Header * ........................................................* |   DEST   |  SOURCE  |   DIGI   | CTRL FLD |    PID   |* --------------------------------------------------------* |  7 bytes |  7 bytes |  7 bytes |   0x03   |   0xf0   |* --------------------------------------------------------* * DEST   : 6 byte "callsign" + 1 byte ssid* SOURCE : 6 byte your callsign + 1 byte ssid* DIGI   : 6 byte "digi callsign" + 1 byte ssid* * ALL DEST, SOURCE, & DIGI are left shifted 1 bit, ASCII format.* DIGI ssid is left shifted 1 bit + 1* * CTRL FLD is 0x03 and not shifted.* PID is 0xf0 and not shifted.*//********* DEST ***********/if(msg_type == _NORMAL){temp = strlen(dest);for(int j=0; j<temp; j++)send_char_NRZI(dest[j] << 1, HIGH);}else if(msg_type == _BEACON){temp = strlen(dest_beacon);for(int j=0; j<temp; j++)send_char_NRZI(dest_beacon[j] << 1, HIGH);}if(temp < 6){for(int j=0; j<(6 - temp); j++)send_char_NRZI(' ' << 1, HIGH);}send_char_NRZI('0' << 1, HIGH);/********* SOURCE *********/temp = strlen(mycall);for(int j=0; j<temp; j++)send_char_NRZI(mycall[j] << 1, HIGH);if(temp < 6){for(int j=0; j<(6 - temp); j++)send_char_NRZI(' ' << 1, HIGH);}send_char_NRZI((myssid + '0') << 1, HIGH);/********* DIGI ***********/temp = strlen(digi);for(int j=0; j<temp; j++)send_char_NRZI(digi[j] << 1, HIGH);if(temp < 6){for(int j=0; j<(6 - temp); j++)send_char_NRZI(' ' << 1, HIGH);}send_char_NRZI(((digissid + '0') << 1) + 1, HIGH);/***** CTRL FLD & PID *****/send_char_NRZI(_CTRL_ID, HIGH);send_char_NRZI(_PID, HIGH);
}void send_payload(char type)
{/** APRS AX.25 Payloads* * TYPE : POSITION* ........................................................* |DATA TYPE |    LAT   |SYMB. OVL.|    LON   |SYMB. TBL.|* --------------------------------------------------------* |  1 byte  |  8 bytes |  1 byte  |  9 bytes |  1 byte  |* --------------------------------------------------------* * DATA TYPE  : !* LAT        : ddmm.ssN or ddmm.ssS* LON        : dddmm.ssE or dddmm.ssW* * * TYPE : STATUS* ..................................* |DATA TYPE |    STATUS TEXT      |* ----------------------------------* |  1 byte  |       N bytes       |* ----------------------------------* * DATA TYPE  : >* STATUS TEXT: Free form text* * * TYPE : POSITION & STATUS* ..............................................................................* |DATA TYPE |    LAT   |SYMB. OVL.|    LON   |SYMB. TBL.|    STATUS TEXT      |* ------------------------------------------------------------------------------* |  1 byte  |  8 bytes |  1 byte  |  9 bytes |  1 byte  |       N bytes       |* ------------------------------------------------------------------------------* * DATA TYPE  : !* LAT        : ddmm.ssN or ddmm.ssS* LON        : dddmm.ssE or dddmm.ssW* STATUS TEXT: Free form text* * * All of the data are sent in the form of ASCII Text, not shifted.* */if(type == _FIXPOS){send_char_NRZI(_DT_POS, HIGH);send_string_len(lat, strlen(lat));send_char_NRZI(sym_ovl, HIGH);send_string_len(lon, strlen(lon));send_char_NRZI(sym_tab, HIGH);}else if(type == _STATUS){send_char_NRZI(_DT_STATUS, HIGH);send_string_len(mystatus, strlen(mystatus));}else if(type == _FIXPOS_STATUS){send_char_NRZI(_DT_POS, HIGH);send_string_len(lat, strlen(lat));send_char_NRZI(sym_ovl, HIGH);send_string_len(lon, strlen(lon));send_char_NRZI(sym_tab, HIGH);send_char_NRZI(' ', HIGH);send_string_len(mystatus, strlen(mystatus));}
}/** This function will send one byte input and convert it* into AFSK signal one bit at a time LSB first.* * The encode which used is NRZI (Non Return to Zero, Inverted)* bit 1 : transmitted as no change in tone* bit 0 : transmitted as change in tone*/
void send_char_NRZI(unsigned char in_byte, bool enBitStuff)
{bool bits;for(int i = 0; i < 8; i++){bits = in_byte & 0x01;calc_crc(bits);if(bits){set_nada(nada);bit_stuff++;if((enBitStuff) && (bit_stuff == 5)){nada ^= 1;set_nada(nada);bit_stuff = 0;}}else{nada ^= 1;set_nada(nada);bit_stuff = 0;}in_byte >>= 1;}
}void send_string_len(const char *in_string, int len)
{for(int j=0; j<len; j++)send_char_NRZI(in_string[j], HIGH);
}void send_flag(unsigned char flag_len)
{for(int j=0; j<flag_len; j++)send_char_NRZI(_FLAG, LOW); 
}/** In this preliminary test, a packet is consists of FLAG(s) and PAYLOAD(s).* Standard APRS FLAG is 0x7e character sent over and over again as a packet* delimiter. In this example, 100 flags is used the preamble and 3 flags as* the postamble.*/
void send_packet(char packet_type, char dest_type)
{print_debug(packet_type, dest_type);digitalWrite(LED_BUILTIN, 1);digitalWrite(_PTT, LOW);/** AX25 FRAME* * ........................................................* |  FLAG(s) |  HEADER  | PAYLOAD  | FCS(CRC) |  FLAG(s) |* --------------------------------------------------------* |  N bytes | 22 bytes |  N bytes | 2 bytes  |  N bytes |* --------------------------------------------------------* * FLAG(s)  : 0x7e* HEADER   : see header* PAYLOAD  : 1 byte data type + N byte info* FCS      : 2 bytes calculated from HEADER + PAYLOAD*/send_flag(100);crc = 0xffff;send_header(dest_type);send_payload(packet_type);send_crc();send_flag(3);digitalWrite(_PTT, HIGH);digitalWrite(LED_BUILTIN, 0);
}/** Function to randomized the value of a variable with defined low and hi limit value.* Used to create random AFSK pulse length.*/
void randomize(unsigned int &var, unsigned int low, unsigned int high)
{var = random(low, high);
}/** */
void set_io(void)
{pinMode(LED_BUILTIN, OUTPUT);pinMode(OUT_PIN, OUTPUT);pinMode(_PTT, OUTPUT);digitalWrite(_PTT, HIGH);Serial.begin(115200);
}void print_code_version(void)
{Serial.println(" ");Serial.print("Sketch:   ");   Serial.println(__FILE__);Serial.print("Uploaded: ");   Serial.println(__DATE__);Serial.println(" ");Serial.println("Random String Pulsed AFSK Generator - Started \n");
}void print_debug(char type, char dest_type)
{/** PROTOCOL DEBUG.* * Will outputs the transmitted data to the serial monitor* in the form of TNC2 string format.* * MYCALL-N>APRS,DIGIn-N:<PAYLOAD STRING> <CR><LF>*//****** MYCALL ********/Serial.print(mycall);Serial.print('-');Serial.print(myssid, DEC);Serial.print('>');/******** DEST ********/if(dest_type == _NORMAL){Serial.print(dest);}else if(dest_type == _BEACON){Serial.print(dest_beacon);}Serial.print(',');/******** DIGI ********/Serial.print(digi);Serial.print('-');Serial.print(digissid, DEC);Serial.print(':');/******* PAYLOAD ******/if(type == _FIXPOS){Serial.print(_DT_POS);Serial.print(lat);Serial.print(sym_ovl);Serial.print(lon);Serial.print(sym_tab);}else if(type == _STATUS){Serial.print(_DT_STATUS);Serial.print(mystatus);}else if(type == _FIXPOS_STATUS){Serial.print(_DT_POS);Serial.print(lat);Serial.print(sym_ovl);Serial.print(lon);Serial.print(sym_tab);Serial.print(' ');Serial.print(mystatus);}Serial.println(' ');
}/** */
void setup()
{set_io();print_code_version();
}void loop()
{send_packet(random(1,4), random(1,3));delay(tx_delay);randomize(tx_delay, 10, 5000);randomize(str_len, 10, 420);
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/160471.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

AI:56-基于深度学习的微表情识别

🚀 本文选自专栏:AI领域专栏 从基础到实践,深入了解算法、案例和最新趋势。无论你是初学者还是经验丰富的数据科学家,通过案例和项目实践,掌握核心概念和实用技能。每篇案例都包含代码实例,详细讲解供大家学习。 📌📌📌在这个漫长的过程,中途遇到了不少问题,但是…

C语言之动态内存管理实现通讯录(完整版)

我们在之前的博客中写过静态版的通讯录&#xff0c;我们今天来写一个动态版的&#xff0c;不需要规定它到底需要多大空间&#xff0c;只要还有内存&#xff0c;我们都可以存放的下&#xff01;同时&#xff0c;函数实现原理&#xff0c;我在通讯录静态版的博客里做了详细的讲解…

LabVIEW对多个同一类型控件进行操作

LabVIEW对多个同一类型控件进行操作 有时候LabVIEW要多多个同一类的控件进行操作&#xff0c;如对tab中某个page中所有String控件设为dissable。就可以用如下的方式。className是获取不同类型的控件。通过类型选择&#xff0c;可以选择所有的String控件&#xff0c;并可对特定…

prometheus + grafana进行服务器资源监控

在性能测试中&#xff0c;服务器资源是值得关注一项内容&#xff0c;目前&#xff0c;市面上已经有很多的服务器资 源监控方法和各种不同的监控工具&#xff0c;方便在各个项目中使用。 但是&#xff0c;在性能测试中&#xff0c;究竟哪些指标值得被关注呢&#xff1f; 监控有…

从零开始制作一个割草机器人

项目背景 为啥要做一个割草机器人呢&#xff1f;&#xff08;个人因素&#xff1a;我梦想就是做一款人形机器人保护人类&#xff0c;解放人类&#xff09; 基础准备&#xff1a;我们公司本身做过高精度&#xff0c;基于高精度的技术扩展到农机自动化驾驶。目前可以实现AB线拖…

0003Java安卓程序设计-springboot基于Android的学习生活交流APP

文章目录 **摘** **要**目 录系统设计开发环境 编程技术交流、源码分享、模板分享、网课教程 &#x1f427;裙&#xff1a;776871563 摘 要 网络的广泛应用给生活带来了十分的便利。所以把学习生活交流管理与现在网络相结合&#xff0c;利用java技术建设学习生活交流APP&…

【算法】昂贵的聘礼(dijkstra算法)

题目 年轻的探险家来到了一个印第安部落里。 在那里他和酋长的女儿相爱了&#xff0c;于是便向酋长去求亲。 酋长要他用 10000 个金币作为聘礼才答应把女儿嫁给他。 探险家拿不出这么多金币&#xff0c;便请求酋长降低要求。 酋长说&#xff1a;”嗯&#xff0c;如果你能够替我…

云智慧联合北航提出智能运维(AIOps)大语言模型及评测基准

随着各行业数字化转型需求的不断提高&#xff0c;人工智能、云计算、大数据等新技术的应用已不仅仅是一个趋势。各行业企业和组织纷纷投入大量资源&#xff0c;以满足日益挑剔的市场需求&#xff0c;追求可持续性和竞争力&#xff0c;这也让运维行业迎来了前所未有的挑战和机遇…

MacOS安装git

文章目录 通过Xcode Command Lines Tool安装(推荐)终端直接运行git命令根据流程安装先安装Command Lines Tool后再安装git 官网下载二进制文件进行安装官方国外源下载二进制文件(不推荐)国内镜像下载二进制文件(推荐)安装git 通过Xcode Command Lines Tool安装(推荐) 简单来讲C…

vivado布局分析

1、高亮显示布局 1. 在“ Netlist ” &#xff08; 网表 &#xff09; 窗口中 &#xff0c; 选择要分析的层级。 2. 从弹出菜单中 &#xff0c; 选择“ Highlight Leaf Cells ” → “ Select a color ” &#xff08; 高亮叶节点单元 > 选择颜色 &#xff09; 。 3. …

Docker DeskTop安装与启动(Windows版本)

一、官网下载Docker安装包 Docker官网如下&#xff1a; Docker官网不同操作系统下载页面https://docs.docker.com/desktop/install/windows-install/ 二、安装Docker DeskTop 2.1 双击 Docker Installer.exe 以运行安装程序 2.2 安装操作 默认勾选&#xff0c;具体操作如下…

【React】【react-globe.gl】3D Objects效果

目录 想要实现的效果实现过程踩坑安装依赖引入页面 想要实现的效果 示例地址 实现过程 踩坑 示例是通过script引入的依赖&#xff0c;但本人需要在react项目中实现该效果。按照react-globe.gl官方方法引入总是报错 Cant import the named export AmbientLight from non EcmaS…