没有防盗链的网站建网站支持设备是什么意思

张小明 2026/1/12 11:36:26
没有防盗链的网站,建网站支持设备是什么意思,深圳电商网站制作,做网站直接从网上的icon吗FreeModbus移植的文章比较多了#xff0c;分享一个移植好可用的代码。 代码连接#xff1a;STM32F407IGT6移植FreeModbushttps://gitee.com/zhuzheshuai/STM32F407IGT6_FreeModbus 通信使用串口和RS485两种方式#xff0c;RS485发送/接收使能引脚用的PH9#xff0c;可以根…FreeModbus移植的文章比较多了分享一个移植好可用的代码。代码连接STM32F407IGT6移植FreeModbushttps://gitee.com/zhuzheshuai/STM32F407IGT6_FreeModbus通信使用串口和RS485两种方式RS485发送/接收使能引脚用的PH9可以根据实际电路进行修改。原理图和代码。#include bsp_usart.h void USART3_Init(uint32_t baud) { GPIO_InitTypeDef GPIO_InitStructure; USART_InitTypeDef USART_InitStructure; NVIC_InitTypeDef NVIC_InitStructure; GPIO_StructInit(GPIO_InitStructure); USART_StructInit(USART_InitStructure); GPIO_PinAFConfig(GPIOC, GPIO_PinSource10, GPIO_AF_USART3); GPIO_PinAFConfig(GPIOC, GPIO_PinSource11, GPIO_AF_USART3); GPIO_InitStructure.GPIO_Pin GPIO_Pin_10 | GPIO_Pin_11; GPIO_InitStructure.GPIO_Mode GPIO_Mode_AF; GPIO_InitStructure.GPIO_OType GPIO_OType_PP; GPIO_InitStructure.GPIO_PuPd GPIO_PuPd_NOPULL; GPIO_InitStructure.GPIO_Speed GPIO_Speed_50MHz; GPIO_Init(GPIOC, GPIO_InitStructure); USART_InitStructure.USART_BaudRate baud; USART_InitStructure.USART_WordLength USART_WordLength_8b; USART_InitStructure.USART_StopBits USART_StopBits_1; USART_InitStructure.USART_Parity USART_Parity_No; USART_InitStructure.USART_Mode USART_Mode_Tx | USART_Mode_Rx; USART_InitStructure.USART_HardwareFlowControl USART_HardwareFlowControl_None; USART_Init(USART3, USART_InitStructure); USART_Cmd(USART3, ENABLE); NVIC_InitStructure.NVIC_IRQChannel USART3_IRQn; NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority 0; NVIC_InitStructure.NVIC_IRQChannelSubPriority 0; NVIC_InitStructure.NVIC_IRQChannelCmd ENABLE; NVIC_Init(NVIC_InitStructure); } void USART1_Init(uint32_t baud) { GPIO_InitTypeDef GPIO_InitStructure; USART_InitTypeDef USART_InitStructure; NVIC_InitTypeDef NVIC_InitStructure; GPIO_StructInit(GPIO_InitStructure); USART_StructInit(USART_InitStructure); GPIO_PinAFConfig(GPIOB, GPIO_PinSource6, GPIO_AF_USART1); GPIO_PinAFConfig(GPIOB, GPIO_PinSource7, GPIO_AF_USART1); GPIO_InitStructure.GPIO_Pin GPIO_Pin_6 | GPIO_Pin_7; GPIO_InitStructure.GPIO_Mode GPIO_Mode_AF; GPIO_InitStructure.GPIO_OType GPIO_OType_PP; GPIO_InitStructure.GPIO_PuPd GPIO_PuPd_NOPULL; GPIO_InitStructure.GPIO_Speed GPIO_Speed_50MHz; GPIO_Init(GPIOB, GPIO_InitStructure); USART_InitStructure.USART_BaudRate baud; USART_InitStructure.USART_WordLength USART_WordLength_8b; USART_InitStructure.USART_StopBits USART_StopBits_1; USART_InitStructure.USART_Parity USART_Parity_No; USART_InitStructure.USART_Mode USART_Mode_Tx | USART_Mode_Rx; USART_InitStructure.USART_HardwareFlowControl USART_HardwareFlowControl_None; USART_Init(USART1, USART_InitStructure); USART_Cmd(USART1, ENABLE); NVIC_InitStructure.NVIC_IRQChannel USART1_IRQn; NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority 0; NVIC_InitStructure.NVIC_IRQChannelSubPriority 0; NVIC_InitStructure.NVIC_IRQChannelCmd ENABLE; NVIC_Init(NVIC_InitStructure); } void RS485_Init(void) { GPIO_InitTypeDef GPIO_InitStructure; GPIO_StructInit(GPIO_InitStructure); GPIO_InitStructure.GPIO_Pin GPIO_Pin_9; GPIO_InitStructure.GPIO_Mode GPIO_Mode_OUT; GPIO_InitStructure.GPIO_OType GPIO_OType_PP; GPIO_InitStructure.GPIO_PuPd GPIO_PuPd_NOPULL; GPIO_InitStructure.GPIO_Speed GPIO_Speed_50MHz; GPIO_Init(GPIOH, GPIO_InitStructure); GPIO_WriteBit(GPIOH, GPIO_Pin_9, Bit_RESET); } int fputc(int ch, FILE *f) { USART_SendData(USART1, (uint8_t)ch); while(USART_GetFlagStatus(USART1, USART_FLAG_TC) RESET); return ch; } int fgetc(FILE *f) { /* 等待串口1输入数据 */ while (USART_GetFlagStatus(USART1, USART_FLAG_RXNE) RESET); return (int)USART_ReceiveData(USART1); }用了条件编译如果Modbus通讯用的串口注释 #define EN_RS485如果用RS485需要修改对应串口引脚号和RS485的使能引脚。portserial.c/* * FreeModbus Libary: BARE Port * Copyright (C) 2006 Christian Walter woltisil.at * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * * File: $Id$ */ #include port.h /* ----------------------- Modbus includes ----------------------------------*/ #include mb.h #include mbport.h /* ----------------------- User includes ----------------------------------*/ #include bsp_usart.h #define SLAVE_RS485_RECEIVE_MODE GPIO_WriteBit(GPIOH, GPIO_Pin_9, Bit_SET) #define SLAVE_RS485_SEND_MODE GPIO_WriteBit(GPIOH, GPIO_Pin_9, Bit_RESET) #define EN_RS485 /* ----------------------- static functions ---------------------------------*/ static void prvvUARTTxReadyISR( void ); static void prvvUARTRxISR( void ); /* ----------------------- Start implementation -----------------------------*/ void vMBPortSerialEnable( BOOL xRxEnable, BOOL xTxEnable ) { /* If xRXEnable enable serial receive interrupts. If xTxENable enable * transmitter empty interrupts. */ #ifdef EN_RS485 if(xRxEnable TRUE) { SLAVE_RS485_RECEIVE_MODE; USART_ITConfig(USART3, USART_IT_RXNE, ENABLE); } else { SLAVE_RS485_SEND_MODE; USART_ITConfig(USART3, USART_IT_RXNE, DISABLE); } if(xTxEnable TRUE) { USART_ITConfig(USART3, USART_IT_TXE, ENABLE); } else { USART_ITConfig(USART3, USART_IT_TXE, DISABLE); } #else if(xRxEnable TRUE) { USART_ITConfig(USART1, USART_IT_RXNE, ENABLE); } else { USART_ITConfig(USART1, USART_IT_RXNE, DISABLE); } if(xTxEnable TRUE) { USART_ITConfig(USART1, USART_IT_TXE, ENABLE); } else { USART_ITConfig(USART1, USART_IT_TXE, DISABLE); } #endif } BOOL xMBPortSerialInit( UCHAR ucPORT, ULONG ulBaudRate, UCHAR ucDataBits, eMBParity eParity ) { #ifdef EN_RS485 USART3_Init((uint32_t)ulBaudRate); #else USART1_Init((uint32_t)ulBaudRate); #endif return TRUE; } BOOL xMBPortSerialPutByte( CHAR ucByte ) { /* Put a byte in the UARTs transmit buffer. This function is called * by the protocol stack if pxMBFrameCBTransmitterEmpty( ) has been * called. */ #ifdef EN_RS485 SLAVE_RS485_SEND_MODE; USART_SendData(USART3, (uint16_t)ucByte); while(USART_GetFlagStatus(USART3, USART_FLAG_TC) RESET); SLAVE_RS485_RECEIVE_MODE; #else USART_SendData(USART1, (uint16_t)ucByte); #endif return TRUE; } BOOL xMBPortSerialGetByte( CHAR * pucByte ) { /* Return the byte in the UARTs receive buffer. This function is called * by the protocol stack after pxMBFrameCBByteReceived( ) has been called. */ #ifdef EN_RS485 *pucByte (CHAR)USART_ReceiveData(USART3); #else *pucByte (CHAR)USART_ReceiveData(USART1); #endif return TRUE; } /* Create an interrupt handler for the transmit buffer empty interrupt * (or an equivalent) for your target processor. This function should then * call pxMBFrameCBTransmitterEmpty( ) which tells the protocol stack that * a new character can be sent. The protocol stack will then call * xMBPortSerialPutByte( ) to send the character. */ static void prvvUARTTxReadyISR( void ) { pxMBFrameCBTransmitterEmpty( ); } /* Create an interrupt handler for the receive interrupt for your target * processor. This function should then call pxMBFrameCBByteReceived( ). The * protocol stack will then call xMBPortSerialGetByte( ) to retrieve the * character. */ static void prvvUARTRxISR( void ) { pxMBFrameCBByteReceived( ); } #ifdef EN_RS485 void USART3_IRQHandler(void) { if(USART_GetITStatus(USART3, USART_IT_RXNE) ! RESET) { prvvUARTRxISR(); USART_ClearITPendingBit(USART3, USART_IT_RXNE); } if(USART_GetITStatus(USART3, USART_IT_ORE) ! RESET) { USART_ClearITPendingBit(USART3, USART_IT_ORE); prvvUARTRxISR(); } if(USART_GetITStatus(USART3, USART_IT_TXE) ! RESET) { prvvUARTTxReadyISR(); USART_ClearITPendingBit(USART3, USART_IT_TXE); } } #else void USART1_IRQHandler(void) { if(USART_GetITStatus(USART1, USART_IT_RXNE) ! RESET) { prvvUARTRxISR(); USART_ClearITPendingBit(USART1, USART_IT_RXNE); } if(USART_GetITStatus(USART1, USART_IT_ORE) ! RESET) { USART_ClearITPendingBit(USART1, USART_IT_ORE); prvvUARTRxISR(); } if(USART_GetITStatus(USART1, USART_IT_TXE) ! RESET) { prvvUARTTxReadyISR(); USART_ClearITPendingBit(USART1, USART_IT_TXE); } } #endif后续增加了FreeRTOS测试的效果
版权声明:本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!

龙岩关键词优化排名网站克隆镜像做关键字seo

Qwen图像编辑完整指南:从新手到专家的快速成长路径 【免费下载链接】Qwen-Image-Edit-Rapid-AIO 项目地址: https://ai.gitcode.com/hf_mirrors/Phr00t/Qwen-Image-Edit-Rapid-AIO 你是否曾经面对这样的困境:想要快速美化照片却发现专业软件操作…

张小明 2026/1/10 10:01:46 网站建设

时尚网站设计学校网站建设计入哪个会计科目

Chrome内存优化终极指南:10个技巧彻底解决浏览器卡顿问题 【免费下载链接】thegreatsuspender A chrome extension for suspending all tabs to free up memory 项目地址: https://gitcode.com/gh_mirrors/th/thegreatsuspender 您是否曾经因为Chrome浏览器打…

张小明 2026/1/9 17:26:42 网站建设

网站搭建手机网站开发费用税

前言 DMN决策引擎的核心价值在于将复杂的业务决策逻辑从程序代码中剥离出来,通过标准化的模型进行可视化管理和执行。它在实战中的应用非常广泛,特别是在需要频繁调整业务规则、追求流程自动化与智能化的场景中。 具体应用场景有: 金融与风控​: 信贷审…

张小明 2026/1/10 10:01:50 网站建设

安新网站建设沈阳网站备案

Langchain-Chatchat在诗歌生成中的美学探索 在数字人文与人工智能交汇的今天,我们正见证一场静默却深刻的创作革命——AI不再只是回答问题的工具,而是开始参与那些曾被认为专属于人类灵魂的艺术表达。当一位诗人深夜伏案,试图捕捉心头那一缕难…

张小明 2026/1/10 10:01:51 网站建设

营销网站的策划方案怎么做邯郸网站设计哪家好

Ofd2Pdf终极指南:轻松实现OFD转PDF的完美转换 【免费下载链接】Ofd2Pdf Convert OFD files to PDF files. 项目地址: https://gitcode.com/gh_mirrors/ofd/Ofd2Pdf 想要快速将OFD文档转换为PDF格式吗?Ofd2Pdf就是你需要的终极解决方案&#xff01…

张小明 2026/1/10 10:01:51 网站建设

效果好的网站建设公系统开发的五个阶段

3分钟极速修复:六音音源完美兼容洛雪音乐全攻略 【免费下载链接】New_lxmusic_source 六音音源修复版 项目地址: https://gitcode.com/gh_mirrors/ne/New_lxmusic_source 还在为洛雪音乐升级后无法播放而苦恼?六音音源修复项目为您提供简单高效的…

张小明 2026/1/10 10:01:52 网站建设