当前位置: 首页 > news >正文

河南省城乡和建设厅网站asp做网站好不好

河南省城乡和建设厅网站,asp做网站好不好,网站后台无编辑器,中国网站模板下载实验目的 1.使用串口和PC机通信#xff1a;接收和发送信息 2.接收GNSS模块定位信息 实验准备 PSoc62™开发板CH340 USB转TTL模块ATGM332D GNSS模块公母头杜邦线x4 板载资源 板载有多少uart 创建工程例程#xff0c;在libraries/HAL_Drivers/uart_config.h中查看BSP支持…实验目的 1.使用串口和PC机通信接收和发送信息 2.接收GNSS模块定位信息 实验准备 PSoc62™开发板CH340 USB转TTL模块ATGM332D GNSS模块公母头杜邦线x4 板载资源 板载有多少uart 创建工程例程在libraries/HAL_Drivers/uart_config.h中查看BSP支持的uart数量及对应的GPIO可以看到一共有7组uart /** Copyright (c) 2006-2023, RT-Thread Development Team** SPDX-License-Identifier: Apache-2.0** Change Logs:* Date Author Notes* 2022-07-08 Rbb666 first version*/#ifndef __UART_CONFIG_H__ #define __UART_CONFIG_H__#include rtthread.h #include board.h#ifdef __cplusplus extern C { #endif#ifdef BSP_USING_UART0/* UART0 device driver structure */cy_stc_sysint_t UART0_SCB_IRQ_cfg {.intrSrc (IRQn_Type)scb_0_interrupt_IRQn,.intrPriority (7u),}; #endif #ifdef BSP_USING_UART1/* UART1 device driver structure */cy_stc_sysint_t UART1_SCB_IRQ_cfg {.intrSrc (IRQn_Type)scb_1_interrupt_IRQn,.intrPriority (7u),}; #endif #ifdef BSP_USING_UART2/* UART2 device driver structure */cy_stc_sysint_t UART2_SCB_IRQ_cfg {.intrSrc (IRQn_Type)scb_2_interrupt_IRQn,.intrPriority (7u),}; #endif #ifdef BSP_USING_UART3/* UART3 device driver structure */cy_stc_sysint_t UART3_SCB_IRQ_cfg {.intrSrc (IRQn_Type)scb_3_interrupt_IRQn,.intrPriority (7u),}; #endif #ifdef BSP_USING_UART4/* UART4 device driver structure */cy_stc_sysint_t UART4_SCB_IRQ_cfg {.intrSrc (IRQn_Type)scb_4_interrupt_IRQn,.intrPriority (7u),}; #endif #ifdef BSP_USING_UART5/* UART5 device driver structure */cy_stc_sysint_t UART5_SCB_IRQ_cfg {.intrSrc (IRQn_Type)scb_5_interrupt_IRQn,.intrPriority (7u),}; #endif#ifdef BSP_USING_UART6/* UART6 device driver structure */cy_stc_sysint_t UART6_SCB_IRQ_cfg {.intrSrc (IRQn_Type)scb_6_interrupt_IRQn,.intrPriority (7u),}; #endif #if defined(BSP_USING_UART0) #ifndef UART0_CONFIG #define UART0_CONFIG \{ \.name uart0, \.tx_pin P0_3, \.rx_pin P0_2, \.usart_x SCB0, \.intrSrc scb_0_interrupt_IRQn, \.userIsr uart_isr_callback(uart0), \.UART_SCB_IRQ_cfg UART0_SCB_IRQ_cfg, \}void uart0_isr_callback(void); #endif /* UART0_CONFIG */ #endif /* BSP_USING_UART0 */#if defined(BSP_USING_UART1) #ifndef UART1_CONFIG #define UART1_CONFIG \{ \.name uart1, \.tx_pin P10_1, \.rx_pin P10_0, \.usart_x SCB1, \.intrSrc scb_1_interrupt_IRQn, \.userIsr uart_isr_callback(uart1), \.UART_SCB_IRQ_cfg UART1_SCB_IRQ_cfg, \}void uart1_isr_callback(void); #endif /* UART1_CONFIG */ #endif /* BSP_USING_UART1 */#if defined(BSP_USING_UART2) #ifndef UART2_CONFIG #if defined(SOC_CY8C6244LQI_S4D92) #define UART2_CONFIG \{ \.name uart2, \.tx_pin P3_1, \.rx_pin P3_0, \.usart_x SCB2, \.intrSrc scb_2_interrupt_IRQn, \.userIsr uart_isr_callback(uart2), \.UART_SCB_IRQ_cfg UART2_SCB_IRQ_cfg, \} #else #define UART2_CONFIG \{ \.name uart2, \.tx_pin P9_1, \.rx_pin P9_0, \.usart_x SCB2, \.intrSrc scb_2_interrupt_IRQn, \.userIsr uart_isr_callback(uart2), \.UART_SCB_IRQ_cfg UART2_SCB_IRQ_cfg, \} #endif /* SOC_CY8C6244LQI_S4D92 */void uart2_isr_callback(void); #endif /* UART2_CONFIG */ #endif /* BSP_USING_UART2 */#if defined(BSP_USING_UART3) #ifndef UART3_CONFIG #define UART3_CONFIG \{ \.name uart3, \.tx_pin P6_1, \.rx_pin P6_0, \.usart_x SCB3, \.intrSrc scb_3_interrupt_IRQn, \.userIsr uart_isr_callback(uart3), \.UART_SCB_IRQ_cfg UART3_SCB_IRQ_cfg, \}void uart3_isr_callback(void); #endif /* UART3_CONFIG */ #endif /* BSP_USING_UART3 */#if defined(BSP_USING_UART4) #ifndef UART4_CONFIG #define UART4_CONFIG \{ \.name uart4, \.tx_pin P7_1, \.rx_pin P7_0, \.usart_x SCB4, \.intrSrc scb_4_interrupt_IRQn, \.userIsr uart_isr_callback(uart4), \.UART_SCB_IRQ_cfg UART4_SCB_IRQ_cfg, \}void uart4_isr_callback(void); #endif /* UART4_CONFIG */ #endif /* BSP_USING_UART4 */#if defined(BSP_USING_UART5) #ifndef UART5_CONFIG #define UART5_CONFIG \{ \.name uart5, \.tx_pin P5_1, \.rx_pin P5_0, \.usart_x SCB5, \.intrSrc scb_5_interrupt_IRQn, \.userIsr uart_isr_callback(uart5), \.UART_SCB_IRQ_cfg UART5_SCB_IRQ_cfg, \}void uart5_isr_callback(void); #endif /* UART5_CONFIG */ #endif /* BSP_USING_UART5 */#if defined(BSP_USING_UART6) #ifndef UART6_CONFIG #define UART6_CONFIG \{ \.name uart6, \.tx_pin P6_5, \.rx_pin P6_4, \.usart_x SCB6, \.intrSrc scb_6_interrupt_IRQn, \.userIsr uart_isr_callback(uart6), \.UART_SCB_IRQ_cfg UART6_SCB_IRQ_cfg, \}void uart6_isr_callback(void); #endif /* UART6_CONFIG */ #endif /* BSP_USING_UART6 */ #ifdef __cplusplus } #endif#endifuart0-uart6和GPIO对应关系表 uart2是比较特殊的两组不同的GPIO都可以使用它 分组RXDTXDuart0P0.2P0.3uart1P10.0P10.1uart2P3.0 / P9.0P3.1 / P9.1uart3P6.0P6.1uart4P7.0P7.1uart5P5.0P5.1uart6P6.4P6.5 电路图 串口IO 这里以uart0为例P0.2对应MCU_ARD_PWM11P0.3对应MCU_ARD_PWM12 模块连接图 右侧排母从上往下第6、7引脚分别对应uart0 TXD、RXD 状态指示灯 板子有两个自主控制的绿色LED通过上拉方式接入GPIOMCU_USER_LED1对应P0.0本次实验使用它来指示uart0的数据接收状态 程序设计 和PC机通信 通过CH340 USB转TTL模块连接PC和uart0实物连接图如下 编码实现 #include rtthread.h #include rtdevice.h #include drv_gpio.h#define LED_PIN GET_PIN(0, 1) #define UART_DEVICE_NAME uart0 #define BSP_UART4_RX_BUFSIZE 1024static rt_device_t serial;struct rx_msg {rt_device_t dev;rt_size_t size; };static struct rt_messagequeue rx_mq;static rt_err_t uart_input(rt_device_t dev, rt_size_t size) {rt_pin_write(LED_PIN, PIN_LOW);struct rx_msg msg;rt_err_t result;msg.dev dev;msg.size size;result rt_mq_send(rx_mq, msg, sizeof(msg));if (result -RT_EFULL){rt_kprintf(message queue full\n);}return result; }static void serial_thread_entry(void *parameter) {struct rx_msg msg;rt_err_t result;rt_uint32_t rx_length;static char rx_buffer[BSP_UART4_RX_BUFSIZE 1];while (1){rt_memset(msg, 0, sizeof(msg));result rt_mq_recv(rx_mq, msg, sizeof(msg), RT_WAITING_FOREVER); // if (result RT_EOK){rx_length rt_device_read(msg.dev, 0, rx_buffer, msg.size);rx_buffer[rx_length] \0;rt_device_write(serial, 0, rx_buffer, rx_length);rt_pin_write(LED_PIN, PIN_HIGH); // rt_kprintf(%s\n,rx_buffer);}} }static int uart0_setup(int argc, char *argv[]) {rt_err_t ret RT_EOK;char uart_name[RT_NAME_MAX];static char msg_pool[256];char str[] uart0 setup successfully!\r\n;if (argc 2){rt_strncpy(uart_name, argv[1], RT_NAME_MAX);}else{rt_strncpy(uart_name, UART_DEVICE_NAME, RT_NAME_MAX);}serial rt_device_find(uart_name);if (!serial){rt_kprintf(find %s failed!\n, uart_name);return RT_ERROR;}struct serial_configure config RT_SERIAL_CONFIG_DEFAULT;config.baud_rate BAUD_RATE_9600;config.data_bits DATA_BITS_8;config.stop_bits STOP_BITS_1;config.bufsz 1024;config.parity PARITY_NONE;rt_device_control(serial, RT_DEVICE_CTRL_CONFIG, config);rt_mq_init(rx_mq, rx_mq, msg_pool, sizeof(struct rx_msg), sizeof(msg_pool), RT_IPC_FLAG_FIFO);rt_device_open(serial, RT_DEVICE_FLAG_INT_RX);rt_device_set_rx_indicate(serial, uart_input);rt_device_write(serial, 0, str, (sizeof(str) - 1));rt_thread_t thread rt_thread_create(serial, serial_thread_entry, RT_NULL, 1024, 25, 10);if (thread ! RT_NULL){rt_thread_startup(thread);}else{ret RT_ERROR;}return ret; }MSH_CMD_EXPORT(uart0_setup, uart0 setup example);int main(void) {rt_pin_mode(LED_PIN, PIN_MODE_OUTPUT);while (1){rt_thread_mdelay(500);} }打开串口调试工具打开对应的COM口串口设置和上面的代码保持一致波特率115200、数据位8位、停止位为1位、奇偶校验位为无 在RT-Thread Studio初始化uart0使用msh终端输入uart0_setup命令 初始化成功可以在串口调试工具看到以下信息 自定义串口消息点击发送按钮可以看到发出去的消息被开发板转发了回来而LED也随即闪了一下 接收GPS模块定位数据 通过uart0连接ATGM332D GNSS模块实物连接图如下 编码实现uart0串口通信注意GNSS模块的波特率默认为9600其它跟上面的example保持一致 #include rtthread.h #include rtdevice.h #include drv_gpio.h#define LED_PIN GET_PIN(0, 1) #define UART_DEVICE_NAME uart0 #define BSP_UART4_RX_BUFSIZE 1024static rt_device_t serial;struct rx_msg {rt_device_t dev;rt_size_t size; };static struct rt_messagequeue rx_mq;static rt_err_t uart_input(rt_device_t dev, rt_size_t size) {rt_pin_write(LED_PIN, PIN_LOW);struct rx_msg msg;rt_err_t result;msg.dev dev;msg.size size;result rt_mq_send(rx_mq, msg, sizeof(msg));if (result -RT_EFULL){rt_kprintf(message queue full\n);}return result; }static void serial_thread_entry(void *parameter) {struct rx_msg msg;rt_err_t result;rt_uint32_t rx_length;static char rx_buffer[BSP_UART4_RX_BUFSIZE 1];while (1){rt_memset(msg, 0, sizeof(msg));result rt_mq_recv(rx_mq, msg, sizeof(msg), RT_WAITING_FOREVER); // if (result RT_EOK){rx_length rt_device_read(msg.dev, 0, rx_buffer, msg.size);rx_buffer[rx_length] \0;rt_device_write(serial, 0, rx_buffer, rx_length);rt_pin_write(LED_PIN, PIN_HIGH);rt_kprintf(%s\n,rx_buffer);}} }static int uart0_setup(int argc, char *argv[]) {rt_err_t ret RT_EOK;char uart_name[RT_NAME_MAX];static char msg_pool[256];char str[] uart0 setup successfully!\r\n;if (argc 2){rt_strncpy(uart_name, argv[1], RT_NAME_MAX);}else{rt_strncpy(uart_name, UART_DEVICE_NAME, RT_NAME_MAX);}serial rt_device_find(uart_name);if (!serial){rt_kprintf(find %s failed!\n, uart_name);return RT_ERROR;}struct serial_configure config RT_SERIAL_CONFIG_DEFAULT;config.baud_rate BAUD_RATE_9600;config.data_bits DATA_BITS_8;config.stop_bits STOP_BITS_1;config.bufsz 1024;config.parity PARITY_NONE;rt_device_control(serial, RT_DEVICE_CTRL_CONFIG, config);rt_mq_init(rx_mq, rx_mq, msg_pool, sizeof(struct rx_msg), sizeof(msg_pool), RT_IPC_FLAG_FIFO);rt_device_open(serial, RT_DEVICE_FLAG_INT_RX);rt_device_set_rx_indicate(serial, uart_input);rt_device_write(serial, 0, str, (sizeof(str) - 1));rt_thread_t thread rt_thread_create(serial, serial_thread_entry, RT_NULL, 1024, 25, 10);if (thread ! RT_NULL){rt_thread_startup(thread);}else{ret RT_ERROR;}return ret; }MSH_CMD_EXPORT(uart0_setup, uart0 setup example);int main(void) {rt_pin_mode(LED_PIN, PIN_MODE_OUTPUT);while (1){rt_thread_mdelay(500);} }在msh终端输入uart0_setup后GNSS数据读取结果如下 运行效果如下可以看到GNSS报文以1Hz的频率打印LED灯在不停地闪烁 PSoc62™开发板之串口通信
http://www.pierceye.com/news/95935/

相关文章:

  • 深圳企业网站seo郑州汉狮专业做网站公司
  • 广东网站建设多少钱辛集专业网站建设
  • 怎样做网站公司的销售小程序推广计划怎么赚钱
  • 网站开发文档编写wordpress小说站群
  • 南宁网站开发推广网站html模板下载
  • 网络编辑的网站建设题二手域名交易平台
  • 定制网站开发商业计划书贵南县网站建设公司
  • 如何免费发布个人网站网站项目需求分析
  • 太原免费网站建设网站开发合作协议书
  • 深圳龙华做网站上海响应式网站制作公司
  • 招投标 网站建设专业型网站和个人网站
  • 网站建设需要那些基础增城线上教学
  • 专注移动网站建设免费咨询电脑维修
  • 六里桥做网站公司惠州做网站 百度优化
  • 做网站怎么选择上市公司wordpress 进销存
  • 做视频网站用哪个模板昆明贤邦网站建设
  • 自建网站工具wordpress仿内涵段子
  • 做推广最好的网站是哪个菜鸟网站建设
  • 首钢建设公司网站微信网站怎么做的好处
  • 西安网站开发费用网站即将 模板
  • 个人做商业网站需要什么热门网站建设代理
  • 企业网站手机端和pc端一个后台吗企业网站管理系统的运维服务
  • 北京官网开发优化游戏性能的软件
  • 网站开发选asp还是hph集约化网站群建设情况
  • 做网站域名重要吗10000ip网站怎么做
  • 途牛的旅游网站是谁做的wordpress 注册用户列表
  • 如何编辑网站新吁网站建设
  • 网站开发采集工具免费引流在线推广
  • 全面的锦州网站建设西安建筑工程有限公司
  • 做网站 郑州公司哪家好哪个购物网站最便宜