【STM32】STM32学习笔记-串口发送和接收(27)

00. 目录

文章目录

    • 00. 目录
    • 01. 串口简介
    • 02. 串口相关API
      • 2.1 USART_Init
      • 2.2 USART_InitTypeDef
      • 2.3 USART_Cmd
      • 2.4 USART_SendData
      • 2.5 USART_ReceiveData
    • 03. 串口发送接线图
    • 04. USB转串口模块
    • 05. 串口发送程序示例
    • 06. 串口发送支持printf
    • 07. 串口发送支持printf_v2
    • 08. 串口发送和接收接线图
    • 09. 串口接收示例(轮询模式)
    • 10. 串口接收示例(中断模式)
    • 11. 程序下载
    • 12. 附录

01. 串口简介

串口通讯(Serial Communication)是一种设备间非常常用的串行通讯方式,因为它简单便捷,因此大部分电子设备都支持该通讯方式, 电子工程师在调试设备时也经常使用该通讯方式输出调试信息。

在计算机科学里,大部分复杂的问题都可以通过分层来简化。如芯片被分为内核层和片上外设;STM32标准库则是在寄存器与用户代码之间的软件层。 对于通讯协议,我们也以分层的方式来理解,最基本的是把它分为物理层和协议层。物理层规定通讯系统中具有机械、电子功能部分的特性, 确保原始数据在物理媒体的传输。协议层主要规定通讯逻辑,统一收发双方的数据打包、解包标准。 简单来说物理层规定我们用嘴巴还是用肢体来交流,协议层则规定我们用中文还是英文来交流。

02. 串口相关API

2.1 USART_Init

/*** @brief  Initializes the USARTx peripheral according to the specified*         parameters in the USART_InitStruct .* @param  USARTx: Select the USART or the UART peripheral. *   This parameter can be one of the following values:*   USART1, USART2, USART3, UART4 or UART5.* @param  USART_InitStruct: pointer to a USART_InitTypeDef structure*         that contains the configuration information for the specified USART *         peripheral.* @retval None*/
void USART_Init(USART_TypeDef* USARTx, USART_InitTypeDef* USART_InitStruct)
功能:根据 USART_InitStruct 中指定的参数初始化外设 USARTx 寄存器
参数:USARTx:x 可以是 12 或者 3,来选择 USART 外设USART_InitStruct:指向结构 USART_InitTypeDef 的指针,包含了外设 USART 的配置信息。
返回值:

2.2 USART_InitTypeDef

/** * @brief  USART Init Structure definition  */ 
typedef struct
{uint32_t USART_BaudRate;            /*!< This member configures the USART communication baud rate.The baud rate is computed using the following formula:- IntegerDivider = ((PCLKx) / (16 * (USART_InitStruct->USART_BaudRate)))- FractionalDivider = ((IntegerDivider - ((u32) IntegerDivider)) * 16) + 0.5 */uint16_t USART_WordLength;          /*!< Specifies the number of data bits transmitted or received in a frame.This parameter can be a value of @ref USART_Word_Length */uint16_t USART_StopBits;            /*!< Specifies the number of stop bits transmitted.This parameter can be a value of @ref USART_Stop_Bits */uint16_t USART_Parity;              /*!< Specifies the parity mode.This parameter can be a value of @ref USART_Parity@note When parity is enabled, the computed parity is insertedat the MSB position of the transmitted data (9th bit whenthe word length is set to 9 data bits; 8th bit when theword length is set to 8 data bits). */uint16_t USART_Mode;                /*!< Specifies wether the Receive or Transmit mode is enabled or disabled.This parameter can be a value of @ref USART_Mode */uint16_t USART_HardwareFlowControl; /*!< Specifies wether the hardware flow control mode is enabledor disabled.This parameter can be a value of @ref USART_Hardware_Flow_Control */
} USART_InitTypeDef;

USART_WordLength

/** @defgroup USART_Word_Length * @{*/ #define USART_WordLength_8b                  ((uint16_t)0x0000)
#define USART_WordLength_9b                  ((uint16_t)0x1000)

USART_StopBits

/** @defgroup USART_Stop_Bits * @{*/ #define USART_StopBits_1                     ((uint16_t)0x0000)
#define USART_StopBits_0_5                   ((uint16_t)0x1000)
#define USART_StopBits_2                     ((uint16_t)0x2000)
#define USART_StopBits_1_5                   ((uint16_t)0x3000)

USART_Parity

/** @defgroup USART_Parity * @{*/ #define USART_Parity_No                      ((uint16_t)0x0000)
#define USART_Parity_Even                    ((uint16_t)0x0400)
#define USART_Parity_Odd                     ((uint16_t)0x0600) 

USART_Mode

/** @defgroup USART_Mode * @{*/ #define USART_Mode_Rx                        ((uint16_t)0x0004)
#define USART_Mode_Tx                        ((uint16_t)0x0008)

USART_HardwareFlowControl

/** @defgroup USART_Hardware_Flow_Control * @{*/ 
#define USART_HardwareFlowControl_None       ((uint16_t)0x0000)
#define USART_HardwareFlowControl_RTS        ((uint16_t)0x0100)
#define USART_HardwareFlowControl_CTS        ((uint16_t)0x0200)
#define USART_HardwareFlowControl_RTS_CTS    ((uint16_t)0x0300)

2.3 USART_Cmd

/*** @brief  Enables or disables the specified USART peripheral.* @param  USARTx: Select the USART or the UART peripheral. *         This parameter can be one of the following values:*           USART1, USART2, USART3, UART4 or UART5.* @param  NewState: new state of the USARTx peripheral.*         This parameter can be: ENABLE or DISABLE.* @retval None*/
void USART_Cmd(USART_TypeDef* USARTx, FunctionalState NewState)
功能:使能或者失能 USART 外设
参数:USARTx:x 可以是 12 或者 3,来选择 USART 外设NewState: 外设 USARTx 的新状态这个参数可以取:ENABLE 或者 DISABLE
返回值:

2.4 USART_SendData

/*** @brief  Transmits single data through the USARTx peripheral.* @param  USARTx: Select the USART or the UART peripheral. *   This parameter can be one of the following values:*   USART1, USART2, USART3, UART4 or UART5.* @param  Data: the data to transmit.* @retval None*/
void USART_SendData(USART_TypeDef* USARTx, uint16_t Data)
功能:通过外设 USARTx 发送单个数据
参数:USARTx:x 可以是 12 或者 3,来选择 USART 外设Data: 待发送的数据
返回值:

2.5 USART_ReceiveData

/*** @brief  Returns the most recent received data by the USARTx peripheral.* @param  USARTx: Select the USART or the UART peripheral. *   This parameter can be one of the following values:*   USART1, USART2, USART3, UART4 or UART5.* @retval The received data.*/
uint16_t USART_ReceiveData(USART_TypeDef* USARTx)
功能:返回 USARTx 最近接收到的数据
参数:USARTx:x 可以是 12 或者 3,来选择 USART 外设
返回值:接收到的字      

03. 串口发送接线图

在这里插入图片描述

04. USB转串口模块

在这里插入图片描述

05. 串口发送程序示例

uart.h

#ifndef __UART_H__
#define __UART_H__#include "stm32f10x.h"           void uart_init(void);void uart_send_byte(uint8_t byte);#endif /**/

uart.c

#include "uart.h"void uart_init(void)
{GPIO_InitTypeDef GPIO_InitStruct;USART_InitTypeDef USART_InitStruct;RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1, ENABLE);RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);//GPIO初始化  PA9 TXGPIO_InitStruct.GPIO_Mode = GPIO_Mode_AF_PP;GPIO_InitStruct.GPIO_Pin = GPIO_Pin_9;GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;GPIO_Init(GPIOA, &GPIO_InitStruct);USART_InitStruct.USART_BaudRate = 9600;USART_InitStruct.USART_HardwareFlowControl = USART_HardwareFlowControl_None;USART_InitStruct.USART_Mode = USART_Mode_Tx;USART_InitStruct.USART_Parity = USART_Parity_No;USART_InitStruct.USART_StopBits = USART_StopBits_1;USART_InitStruct.USART_WordLength = USART_WordLength_8b;USART_Init(USART1, &USART_InitStruct);USART_Cmd(USART1, ENABLE);
}void uart_send_byte(uint8_t byte)
{USART_SendData(USART1, byte);while(USART_GetFlagStatus(USART1, USART_FLAG_TXE) == RESET);
}

main.c

#include "stm32f10x.h"#include "delay.h"
#include "oled.h"
#include "uart.h"int main(void){	 //初始化OLED_Init();uart_init();//显示一个字符OLED_ShowChar(1, 1, 'A');uart_send_byte(0x41);while(1){}return 0;}

运行结果
在这里插入图片描述

06. 串口发送支持printf

配置:

在这里插入图片描述

uart.h

#ifndef __UART_H__
#define __UART_H__#include "stm32f10x.h"           void uart_init(void);void uart_send_byte(uint8_t byte);void uart_send_array(uint8_t *arr, uint16_t len);void uart_send_string(char *str);void uart_send_number(uint32_t num, uint8_t len);#endif /**/

uart.c

#include "uart.h"#include <stdio.h>void uart_init(void)
{GPIO_InitTypeDef GPIO_InitStruct;USART_InitTypeDef USART_InitStruct;RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1, ENABLE);RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);//GPIO初始化  PA9 TXGPIO_InitStruct.GPIO_Mode = GPIO_Mode_AF_PP;GPIO_InitStruct.GPIO_Pin = GPIO_Pin_9;GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;GPIO_Init(GPIOA, &GPIO_InitStruct);USART_InitStruct.USART_BaudRate = 9600;USART_InitStruct.USART_HardwareFlowControl = USART_HardwareFlowControl_None;USART_InitStruct.USART_Mode = USART_Mode_Tx;USART_InitStruct.USART_Parity = USART_Parity_No;USART_InitStruct.USART_StopBits = USART_StopBits_1;USART_InitStruct.USART_WordLength = USART_WordLength_8b;USART_Init(USART1, &USART_InitStruct);USART_Cmd(USART1, ENABLE);
}void uart_send_byte(uint8_t byte)
{USART_SendData(USART1, byte);while(USART_GetFlagStatus(USART1, USART_FLAG_TXE) == RESET);
}void uart_send_array(uint8_t *arr, uint16_t len)
{uint16_t i;for (i = 0; i < len; i++){uart_send_byte(arr[i]);}
}void uart_send_string(char *str)
{uint16_t i = 0;while(*(str + i) != '\0'){uart_send_byte(str[i]);i++;}
}//x的y次方
uint32_t uart_pow(uint32_t x, uint32_t y)
{uint32_t result = 1;while(y){result *= x;y--;}return result;
}void uart_send_number(uint32_t num, uint8_t len)
{uint8_t i;for (i = 0; i < len; i++){uart_send_byte(num / uart_pow(10, len - i - 1) % 10 + '0');}}int fputc(int ch, FILE *fp)
{uart_send_byte(ch);return ch;
}

main.c

#include "stm32f10x.h"
#include <stdio.h>
#include "delay.h"
#include "oled.h"
#include "uart.h"int main(void){	uint8_t arr[] = {0x42, 0x43, 0x44, 0x45, 0x46};//初始化OLED_Init();uart_init();//显示一个字符OLED_ShowChar(1, 1, 'A');#if 0uart_send_byte('B');//发送数组uart_send_array(arr, 5);//发送字符串uart_send_string("hello world\r\n");uart_send_string("1234567890\r\n");uart_send_number(1234, 4);
#endifprintf("num = %d\r\n", 6666);while(1){}return 0;}

运行结果
在这里插入图片描述

07. 串口发送支持printf_v2

uart.h

#ifndef __UART_H__
#define __UART_H__#include "stm32f10x.h"           void uart_init(void);void uart_send_byte(uint8_t byte);void uart_send_array(uint8_t *arr, uint16_t len);void uart_send_string(char *str);void uart_send_number(uint32_t num, uint8_t len);void uart_printf(char *format, ...);#endif /**/

uart.c

#include "uart.h"#include <stdio.h>
#include <stdarg.h>void uart_init(void)
{GPIO_InitTypeDef GPIO_InitStruct;USART_InitTypeDef USART_InitStruct;RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1, ENABLE);RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);//GPIO初始化  PA9 TXGPIO_InitStruct.GPIO_Mode = GPIO_Mode_AF_PP;GPIO_InitStruct.GPIO_Pin = GPIO_Pin_9;GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;GPIO_Init(GPIOA, &GPIO_InitStruct);USART_InitStruct.USART_BaudRate = 9600;USART_InitStruct.USART_HardwareFlowControl = USART_HardwareFlowControl_None;USART_InitStruct.USART_Mode = USART_Mode_Tx;USART_InitStruct.USART_Parity = USART_Parity_No;USART_InitStruct.USART_StopBits = USART_StopBits_1;USART_InitStruct.USART_WordLength = USART_WordLength_8b;USART_Init(USART1, &USART_InitStruct);USART_Cmd(USART1, ENABLE);
}void uart_send_byte(uint8_t byte)
{USART_SendData(USART1, byte);while(USART_GetFlagStatus(USART1, USART_FLAG_TXE) == RESET);
}void uart_send_array(uint8_t *arr, uint16_t len)
{uint16_t i;for (i = 0; i < len; i++){uart_send_byte(arr[i]);}
}void uart_send_string(char *str)
{uint16_t i = 0;while(*(str + i) != '\0'){uart_send_byte(str[i]);i++;}
}//x的y次方
uint32_t uart_pow(uint32_t x, uint32_t y)
{uint32_t result = 1;while(y){result *= x;y--;}return result;
}void uart_send_number(uint32_t num, uint8_t len)
{uint8_t i;for (i = 0; i < len; i++){uart_send_byte(num / uart_pow(10, len - i - 1) % 10 + '0');}}int fputc(int ch, FILE *fp)
{uart_send_byte(ch);return ch;
}void uart_printf(char *format, ...)
{char str[128];va_list arg;va_start(arg, format);vsprintf(str, format, arg);va_end(arg);uart_send_string(str);
}

main.c

#include "stm32f10x.h"
#include <stdio.h>
#include "delay.h"
#include "oled.h"
#include "uart.h"int main(void){	char string[100];uint8_t arr[] = {0x42, 0x43, 0x44, 0x45, 0x46};//初始化OLED_Init();uart_init();//显示一个字符OLED_ShowChar(1, 1, 'A');#if 0uart_send_byte('B');//发送数组uart_send_array(arr, 5);//发送字符串uart_send_string("hello world\r\n");uart_send_string("1234567890\r\n");uart_send_number(1234, 4);printf("num = %d\r\n", 6666);
#endifsprintf(string, "\r\nnum=%d", 3333);uart_send_string(string);uart_printf("\r\nnum = %d\r\n", 4444);uart_printf("\r\n");while(1){}return 0;}

测试结果


num=3333
num = 4444

08. 串口发送和接收接线图

在这里插入图片描述

09. 串口接收示例(轮询模式)

uart.h

#ifndef __UART_H__
#define __UART_H__#include "stm32f10x.h"           void uart_init(void);void uart_send_byte(uint8_t byte);void uart_send_array(uint8_t *arr, uint16_t len);void uart_send_string(char *str);void uart_send_number(uint32_t num, uint8_t len);void uart_printf(char *format, ...);#endif /**/

uart.c

#include "uart.h"#include <stdio.h>
#include <stdarg.h>void uart_init(void)
{GPIO_InitTypeDef GPIO_InitStruct;USART_InitTypeDef USART_InitStruct;RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1, ENABLE);RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);//GPIO初始化  PA9 TXGPIO_InitStruct.GPIO_Mode = GPIO_Mode_AF_PP;GPIO_InitStruct.GPIO_Pin = GPIO_Pin_9;GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;GPIO_Init(GPIOA, &GPIO_InitStruct);//GPIO初始化  PA10 RXGPIO_InitStruct.GPIO_Mode = GPIO_Mode_IPU;GPIO_InitStruct.GPIO_Pin = GPIO_Pin_10;GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;GPIO_Init(GPIOA, &GPIO_InitStruct);USART_InitStruct.USART_BaudRate = 9600;USART_InitStruct.USART_HardwareFlowControl = USART_HardwareFlowControl_None;USART_InitStruct.USART_Mode = USART_Mode_Tx | USART_Mode_Rx;USART_InitStruct.USART_Parity = USART_Parity_No;USART_InitStruct.USART_StopBits = USART_StopBits_1;USART_InitStruct.USART_WordLength = USART_WordLength_8b;USART_Init(USART1, &USART_InitStruct);USART_Cmd(USART1, ENABLE);
}void uart_send_byte(uint8_t byte)
{USART_SendData(USART1, byte);while(USART_GetFlagStatus(USART1, USART_FLAG_TXE) == RESET);
}void uart_send_array(uint8_t *arr, uint16_t len)
{uint16_t i;for (i = 0; i < len; i++){uart_send_byte(arr[i]);}
}void uart_send_string(char *str)
{uint16_t i = 0;while(*(str + i) != '\0'){uart_send_byte(str[i]);i++;}
}//x的y次方
uint32_t uart_pow(uint32_t x, uint32_t y)
{uint32_t result = 1;while(y){result *= x;y--;}return result;
}void uart_send_number(uint32_t num, uint8_t len)
{uint8_t i;for (i = 0; i < len; i++){uart_send_byte(num / uart_pow(10, len - i - 1) % 10 + '0');}}int fputc(int ch, FILE *fp)
{uart_send_byte(ch);return ch;
}void uart_printf(char *format, ...)
{char str[128];va_list arg;va_start(arg, format);vsprintf(str, format, arg);va_end(arg);uart_send_string(str);
}

main.c

#include "stm32f10x.h"
#include <stdio.h>
#include "delay.h"
#include "oled.h"
#include "uart.h"int main(void){	uint16_t data = 0;OLED_Init();uart_init();OLED_ShowChar(1, 1, 'A');while(1){if (USART_GetFlagStatus(USART1, USART_FLAG_RXNE) == SET){data = USART_ReceiveData(USART1);OLED_ShowHexNum(1, 1, data, 2);}}return 0;}

10. 串口接收示例(中断模式)

uart.h

#ifndef __UART_H__
#define __UART_H__#include "stm32f10x.h"           void uart_init(void);void uart_send_byte(uint8_t byte);void uart_send_array(uint8_t *arr, uint16_t len);void uart_send_string(char *str);void uart_send_number(uint32_t num, uint8_t len);void uart_printf(char *format, ...);uint8_t uart_getRxFlag(void);uint8_t uart_getRxData(void);#endif /**/

uart.c

#include "uart.h"#include <stdio.h>
#include <stdarg.h>uint8_t recvData;
uint8_t recvFlag;void uart_init(void)
{GPIO_InitTypeDef GPIO_InitStruct;USART_InitTypeDef USART_InitStruct;NVIC_InitTypeDef NVIC_InitStruct;RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1, ENABLE);RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);//GPIO初始化  PA9 TXGPIO_InitStruct.GPIO_Mode = GPIO_Mode_AF_PP;GPIO_InitStruct.GPIO_Pin = GPIO_Pin_9;GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;GPIO_Init(GPIOA, &GPIO_InitStruct);//GPIO初始化  PA10 RXGPIO_InitStruct.GPIO_Mode = GPIO_Mode_IPU;GPIO_InitStruct.GPIO_Pin = GPIO_Pin_10;GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;GPIO_Init(GPIOA, &GPIO_InitStruct);USART_InitStruct.USART_BaudRate = 9600;USART_InitStruct.USART_HardwareFlowControl = USART_HardwareFlowControl_None;USART_InitStruct.USART_Mode = USART_Mode_Tx | USART_Mode_Rx;USART_InitStruct.USART_Parity = USART_Parity_No;USART_InitStruct.USART_StopBits = USART_StopBits_1;USART_InitStruct.USART_WordLength = USART_WordLength_8b;USART_Init(USART1, &USART_InitStruct);//设置串口中断USART_ITConfig(USART1, USART_IT_RXNE, ENABLE);//设置中断分组NVIC_InitStruct.NVIC_IRQChannel = USART1_IRQn;NVIC_InitStruct.NVIC_IRQChannelCmd = ENABLE;NVIC_InitStruct.NVIC_IRQChannelPreemptionPriority = 1;NVIC_InitStruct.NVIC_IRQChannelSubPriority = 1;NVIC_Init(&NVIC_InitStruct);USART_Cmd(USART1, ENABLE);
}void uart_send_byte(uint8_t byte)
{USART_SendData(USART1, byte);while(USART_GetFlagStatus(USART1, USART_FLAG_TXE) == RESET);
}void uart_send_array(uint8_t *arr, uint16_t len)
{uint16_t i;for (i = 0; i < len; i++){uart_send_byte(arr[i]);}
}void uart_send_string(char *str)
{uint16_t i = 0;while(*(str + i) != '\0'){uart_send_byte(str[i]);i++;}
}//x的y次方
uint32_t uart_pow(uint32_t x, uint32_t y)
{uint32_t result = 1;while(y){result *= x;y--;}return result;
}void uart_send_number(uint32_t num, uint8_t len)
{uint8_t i;for (i = 0; i < len; i++){uart_send_byte(num / uart_pow(10, len - i - 1) % 10 + '0');}}int fputc(int ch, FILE *fp)
{uart_send_byte(ch);return ch;
}void uart_printf(char *format, ...)
{char str[128];va_list arg;va_start(arg, format);vsprintf(str, format, arg);va_end(arg);uart_send_string(str);
}void USART1_IRQHandler(void)
{if (USART_GetITStatus(USART1, USART_IT_RXNE) == SET){recvData = USART_ReceiveData(USART1);recvFlag = 1;USART_ClearITPendingBit(USART1, USART_IT_RXNE);}}uint8_t uart_getRxFlag(void)
{if (1 == recvFlag){recvFlag = 0;return 1;}return 0;
}uint8_t uart_getRxData(void)
{return recvData;
}

main.c

#include "stm32f10x.h"
#include <stdio.h>
#include "delay.h"
#include "oled.h"
#include "uart.h"int main(void){	uint16_t data = 0;OLED_Init();uart_init();//中断分组NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);OLED_ShowChar(1, 1, 'A');while(1){if (1 == uart_getRxFlag()){data = uart_getRxData();uart_send_byte(data);OLED_ShowHexNum(1, 1, data, 2);}}return 0;}

11. 程序下载

22-UART发送.rar

23-UART发送和接收.rar

12. 附录

参考: 【STM32】江科大STM32学习笔记汇总

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

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

相关文章

Transformer - Attention is all you need 论文阅读

虽然是跑路来NLP&#xff0c;但是还是立flag说要做个project&#xff0c;结果kaggle上的入门project给的例子用的是BERT&#xff0c;还提到这一方法属于transformer&#xff0c;所以大概率读完这一篇之后&#xff0c;会再看BERT的论文这个样子。 在李宏毅的NLP课程中多次提到了…

【MySQL】:掌握SQL中DDL的数据库定义与操作

&#x1f3a5; 屿小夏 &#xff1a; 个人主页 &#x1f525;个人专栏 &#xff1a; MySQL从入门到进阶 &#x1f304; 莫道桑榆晚&#xff0c;为霞尚满天&#xff01; 文章目录 &#x1f4d1;前言一. SQL的分类二. DDL数据库操作2.1 查询所有数据库2.2 查询当前数据库2.3 创建数…

8.云原生存储之Ceph集群

1. 私有云实战之基础环境搭建 2. 云原生实战之kubesphere搭建 3.云原生之kubesphere运维 4. 云原生之kubesphere基础服务搭建 5.云原生安全之kubesphere应用网关配置域名TLS证书 6.云原生之DevOps和CICD 7.云原生之jenkins集成SonarQube 8.云原生存储之Ceph集群 文章目录 为什么…

(超详细)3-YOLOV5改进-添加SE注意力机制

1、在yolov5/models下面新建一个SE.py文件&#xff0c;在里面放入下面的代码 代码如下&#xff1a; import numpy as np import torch from torch import nn from torch.nn import initclass SEAttention(nn.Module):def __init__(self, channel512,reduction16):super()._…

OpenWrt智能路由器Wan PPPoE拨号配置方法

OpenWrt智能路由器的wan PPPoE拨号配置方法和我们常见的不太一样, 需要先找到wan网卡,然后将协议切换为 PPPoE然后才能看到输入上网账号和密码的地方. 首先登录路由器 http://openwrt.lan/ 然后找到 Network --> Interfaces 这里会显示你当前的路由器的所有接口, 选择 …

java求链表中倒数第k个结点

下面我用两种方法求解&#xff1a; 第一种方法&#xff1a;通常我们做这种题就是求出链表的长度length&#xff0c;然后呢length-k的值就是我们要从链表头部走几步就可以了&#xff0c;代码解释&#xff1a; public class Solution {public class ListNode {int val;ListNode…

BitMap源码解析

文章目录 前言数据结构添加与删除操作 JDK中BitSet源码解析重要成员属性初始化添加数据清除数据获取数据size和length方法集合操作&#xff1a;与、或、异或优缺点 前言 为什么称为bitmap&#xff1f; bitmap不仅仅存储介质以及数据结构不同于hashmap&#xff0c;存储的key和v…

selenium模拟浏览器查询导出参考文献

通过使用Selenium和BeautifulSoup&#xff0c;在CNKI网站上&#xff0c;以"知识图谱"为关键词&#xff0c;通过自动化工具在搜索页面提取相关文章信息。点击清楚并全选进行文献导出&#xff0c;随后从导出页面和管理导出的页面提取参考文献。 浏览器及WebDriver下载…

【模块系列】STM32BMP280

前言 最进想练习下I2C的应用&#xff0c;手上好有BMP280也没用过&#xff0c;就看着机翻手册和原版手册&#xff0c;开始嘎嘎写库函数了。库的命名应该还1是比较规范了吧&#xff0c;就是手册对于最终值的计算方式很迷糊&#xff0c;所以现在也不能保证有可靠性啊&#xff0c;大…

2023极客大挑战web小记

拿到题目提示post传参还以为是道签到题 刚开始直接把自己极客大挑战的username以及password怼上去&#xff0c;但是不对。看看F12&#xff0c;有提示。 当一个搜索蜘蛛访问一个站点时&#xff0c;它会首先检查该站点根目录下是否存在robots.txt&#xff0c;如果存在&#xff0c…

24-1-9 bilibilic++音视频

下午两点面试&#xff0c;面试官迟到了一会&#xff0c;面试官人很好&#xff0c;整体面试经历很不错&#xff0c;但是我人太紧张了&#xff0c;基础知识掌握的深度不够&#xff0c;没有深挖&#xff0c; 是做音视频的底层相关的&#xff0c; 实习要求只要每天打卡够九个小时就…

精细微调技术在大型预训练模型优化中的应用

目录 前言1 Delta微调简介2 参数微调的有效性2.1 通用知识的激发2.2 高效的优化手段3 Delta微调的类别3.1 增量式微调3.2 指定式微调3.3 重参数化方法 4 统一不同微调方法4.1 整合多种微调方法4.2 动态调整微调策略4.3 超参数搜索和优化 结语 前言 随着大型预训练模型在自然语…

全网唯一!Matlab周杰伦专辑配色包MJay

前段时间杰伦出了新歌&#xff0c;第一时间听完&#xff0c;感觉没过瘾&#xff0c;便又翻出他以前的作品&#xff0c;想着继续回忆青春。 翻着翻着&#xff0c;突然发现每张专辑封面的配色都别有一番味道&#xff0c;似乎可以搞些事情…… 于是&#xff0c;我默默打开了Matl…

【博士每天一篇论文-理论分析】Dynamical systems, attractors, and neural circuits

阅读时间&#xff1a;2023-11-19 1 介绍 年份&#xff1a;2016 作者&#xff1a;Paul Miller 马萨诸塞州沃尔瑟姆市布兰代斯大学Volen国家复杂系统中心 期刊&#xff1a; F1000Research 引用量&#xff1a;63 这篇论文主要关注神经回路中的动力系统和吸引子。作者指出神经回路…

C# Cad2016二次开发HelloWorld(一)

1 新建类库 二 引用 acdbmgd.dll、acmgd.dll、accoremgd.dll 三 HelloWorld代码 public class Class1{/// <summary>/// 程序入口标识/// </summary>[CommandMethod("HelloWorld")]public void HelloWorld(){Document adoc Autodesk.AutoCAD.Applicatio…

数据结构实战:变位词侦测

文章目录 一、实战概述二、实战步骤&#xff08;一&#xff09;逐个比较法1、编写源程序2、代码解释说明&#xff08;1&#xff09;函数逻辑解释&#xff08;2&#xff09;主程序部分 3、运行程序&#xff0c;查看结果4、计算时间复杂度 &#xff08;二&#xff09;排序比较法1…

设计模式之访问者模式【行为型模式】

提示&#xff1a;文章写完后&#xff0c;目录可以自动生成&#xff0c;如何生成可参考右边的帮助文档> 学习的最大理由是想摆脱平庸&#xff0c;早一天就多一份人生的精彩&#xff1b;迟一天就多一天平庸的困扰。各位小伙伴&#xff0c;如果您&#xff1a; 想系统/深入学习某…

What does `HandlerInterceptor` do?

HandlerInterceptor 是 SpringMVC 中的一个接口&#xff0c;在SpringMVC应用中它提供了一种实现应用级拦截器的机制。 第1步&#xff1a;引入依赖 <dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web<…

基于SSM中小型医院管理系统的设计与实现

末尾获取源码 开发语言&#xff1a;Java Java开发工具&#xff1a;JDK1.8 后端框架&#xff1a;SSM 前端&#xff1a;采用JSP技术开发 数据库&#xff1a;MySQL5.7和Navicat管理工具结合 服务器&#xff1a;Tomcat8.5 开发软件&#xff1a;IDEA / Eclipse 是否Maven项目&#x…

【Golang】IEEE754标准二进制字符串转为浮点类型

IEEE754介绍 IEEE 754是一种标准&#xff0c;用于表示和执行浮点数运算的方法。在这个标准中&#xff0c;单精度浮点数使用32位二进制表示&#xff0c;分为三个部分&#xff1a;符号位、指数位和尾数位。 符号位(s)用一个位来表示数的正负&#xff0c;0表示正数&#xff0c;1表…