问答

汇集网友智慧,解决技术难题

21ic问答首页 - TAG - ar
  • 如何解决keil5编译但lcd12864显示汉字时乱码? sos

    [align=left][color=rgb(47, 47, 47)][backcolor=rgb(255, 255, 255)][font=微软雅黑, "]这是部分代码:[/font][/backcolor][/color][/align][align=left][color=rgb(47, 47, 47)][backcolor=rgb(255, 255, 255)][font=微软雅黑, "]#include [/font][/backcolor][/color][/align] [align=left][color=rgb(47, 47, 47)][backcolor=rgb(255, 255, 255)][font=微软雅黑, "]#define uchar unsigned char // 以后unsigned char就可以用uchar代替[/font][/backcolor][/color][/align][align=left][color=rgb(47, 47, 47)][backcolor=rgb(255, 255, 255)][font=微软雅黑, "]#define uint unsigned int // 以后unsigned int 就可以用uint 代替[/font][/backcolor][/color][/align] [align=left][color=rgb(47, 47, 47)][backcolor=rgb(255, 255, 255)][font=微软雅黑, "]sbit LcdRs_P = P2^0; // 液晶的RS管脚 [/font][/backcolor][/color][/align][align=left][color=rgb(47, 47, 47)][backcolor=rgb(255, 255, 255)][font=微软雅黑, "]sbit LcdRw_P = P2^1; // 液晶的RW管脚 [/font][/backcolor][/color][/align][align=left][color=rgb(47, 47, 47)][backcolor=rgb(255, 255, 255)][font=微软雅黑, "]sbit LcdEn_P = P2^2; // 液晶的EN管脚[/font][/backcolor][/color][/align] [align=left][color=rgb(47, 47, 47)][backcolor=rgb(255, 255, 255)][font=微软雅黑, "]// 毫秒级的延时函数,time是要延时的毫秒数[/font][/backcolor][/color][/align] [align=left][color=rgb(47, 47, 47)][backcolor=rgb(255, 255, 255)][font=微软雅黑, "]void DelayMs(uint time)[/font][/backcolor][/color][/align][align=left][color=rgb(47, 47, 47)][backcolor=rgb(255, 255, 255)][font=微软雅黑, "]{[/font][/backcolor][/color][/align][align=left][color=rgb(47, 47, 47)][backcolor=rgb(255, 255, 255)][font=微软雅黑, "] uint i,j;[/font][/backcolor][/color][/align][align=left][color=rgb(47, 47, 47)][backcolor=rgb(255, 255, 255)][font=微软雅黑, "] for(i=0;i

    ar unsigned keil5 编译 LCD12864 单片机

    1170浏览量 0回复量 关注量
  • GD32F405RG 芯片 DMA 初始化代码异常

    GD32F405RG 芯片 DMA 初始化代码如下。 发现 USART_DENT_ENABLE 和 USART_DENR_ENABLE 无法识别。 已经加载 "gd32f4xx_usart.h" "gd32f4xx_dma.h" 2个文件。依旧不行。 有知道是什么问题吗?

    ar RT 芯片 GD32F405 DMA 初始化代码

    1133浏览量 2回复量 关注量
  • AC78406 多个串口中断失效 sos

    各位前辈好。第一次用AC78406芯片。使用uart0 uart1中断接受不定长数据。单个串口可以接收了。两个串口同时使用只有先初始化的那个串口可以进入中断。请问哪里配置有问题吗?代码是用AutoGen Studio生成的。[color=#dadada][backcolor=rgb(30, 30, 30)][font=Consolas, "][color=#b4b4b4]#[/color][color=#9a9a9a]include[/color][color=#c8c8c8] [/color][color=#e8c9bb]"[/color][color=#ce9178]string.h[/color][color=#e8c9bb]"[/color] [color=#b4b4b4]#[/color][color=#9a9a9a]include[/color][color=#c8c8c8] [/color][color=#e8c9bb]"[/color][color=#ce9178]ckgen_drv.h[/color][color=#e8c9bb]"[/color] [color=#b4b4b4]#[/color][color=#9a9a9a]include[/color][color=#c8c8c8] [/color][color=#e8c9bb]"[/color][color=#ce9178]gpio_drv.h[/color][color=#e8c9bb]"[/color] [color=#b4b4b4]#[/color][color=#9a9a9a]include[/color][color=#c8c8c8] [/color][color=#e8c9bb]"[/color][color=#ce9178]gpio_hw.h[/color][color=#e8c9bb]"[/color] [color=#b4b4b4]#[/color][color=#9a9a9a]include[/color][color=#c8c8c8] [/color][color=#e8c9bb]"[/color][color=#ce9178]uart_drv.h[/color][color=#e8c9bb]"[/color] [color=#b4b4b4]#[/color][color=#9a9a9a]include[/color][color=#c8c8c8] [/color][color=#e8c9bb]"[/color][color=#ce9178]uart_hw.h[/color][color=#e8c9bb]"[/color] [color=#b4b4b4]#[/color][color=#9a9a9a]include[/color][color=#c8c8c8] [/color][color=#e8c9bb]"[/color][color=#ce9178]uart_irq.h[/color][color=#e8c9bb]"[/color] [color=#b4b4b4]#[/color][color=#9a9a9a]include[/color][color=#c8c8c8] [/color][color=#e8c9bb]"[/color][color=#ce9178]dma_drv.h[/color][color=#e8c9bb]"[/color] [color=#b4b4b4]#[/color][color=#9a9a9a]include[/color][color=#c8c8c8] [/color][color=#e8c9bb]"[/color][color=#ce9178]gpio.h[/color][color=#e8c9bb]"[/color] [color=#b4b4b4]#[/color][color=#9a9a9a]include[/color][color=#c8c8c8] [/color][color=#e8c9bb]"[/color][color=#ce9178]drv_comm.h[/color][color=#e8c9bb]"[/color] [color=#b4b4b4]#[/color][color=#9a9a9a]include[/color][color=#c8c8c8] [/color][color=#e8c9bb]"[/color][color=#ce9178]FreeRTOS.h[/color][color=#e8c9bb]"[/color] [color=#b4b4b4]#[/color][color=#9a9a9a]include[/color][color=#c8c8c8] [/color][color=#e8c9bb]"[/color][color=#ce9178]event_groups.h[/color][color=#e8c9bb]"[/color] [color=#b4b4b4]#[/color][color=#9a9a9a]include[/color][color=#c8c8c8] [/color][color=#e8c9bb]"[/color][color=#ce9178]ac7840x_irq_cb.h[/color][color=#e8c9bb]"[/color] [color=#b4b4b4]#[/color][color=#9a9a9a]define[/color][color=#c8c8c8] [/color][color=#beb7ff]RECELENGTHMAX[/color][color=#c8c8c8] [/color][color=#b5cea8]1024[/color] [color=#569cd6]static[/color] [color=#4ec9b0]uart_state_t[/color] [color=#c8c8c8]s_uart0State[/color] [color=#b4b4b4]=[/color] [color=#b4b4b4]{[/color][color=#569cd6]NULL[/color][color=#b4b4b4]};[/color][color=#57a64a] /*UART运行变量状态*/[/color] [color=#569cd6]static[/color] [color=#4ec9b0]uart_state_t[/color] [color=#c8c8c8]s_uart1State[/color] [color=#b4b4b4]=[/color] [color=#b4b4b4]{[/color][color=#569cd6]NULL[/color][color=#b4b4b4]};[/color][color=#57a64a] /*UART运行变量状态*/[/color] [color=#569cd6]static[/color] [color=#4ec9b0]uart_user_config_t[/color] [color=#c8c8c8]uart0Config[/color][color=#b4b4b4];[/color] [color=#569cd6]static[/color] [color=#4ec9b0]uart_user_config_t[/color] [color=#c8c8c8]uart1Config[/color][color=#b4b4b4];[/color] [color=#569cd6]static[/color] [color=#569cd6]unsigned[/color] [color=#569cd6]char[/color] [color=#c8c8c8]g_receive0Data[/color] [color=#b4b4b4]=[/color] [color=#b5cea8]0[/color][color=#b4b4b4];[/color] [color=#569cd6]static[/color] [color=#569cd6]unsigned[/color] [color=#569cd6]short[/color] [color=#569cd6]int[/color] [color=#c8c8c8]g_receive0Data_count[/color] [color=#b4b4b4]=[/color] [color=#b5cea8]0[/color][color=#b4b4b4];[/color] [color=#569cd6]static[/color] [color=#569cd6]unsigned[/color] [color=#569cd6]char[/color] [color=#c8c8c8]receive0Data_group[/color][color=#b4b4b4][[/color][color=#beb7ff]RECELENGTHMAX[/color] [color=#b4b4b4]=[/color] [color=#b4b4b4]{[/color][color=#b5cea8]0[/color][color=#b4b4b4]};[/color] [color=#569cd6]static[/color] [color=#569cd6]unsigned[/color] [color=#569cd6]char[/color] [color=#c8c8c8]g_receive1Data[/color] [color=#b4b4b4]=[/color] [color=#b5cea8]0[/color][color=#b4b4b4];[/color] [color=#569cd6]static[/color] [color=#569cd6]unsigned[/color] [color=#569cd6]short[/color] [color=#569cd6]int[/color] [color=#c8c8c8]g_receive1Data_count[/color] [color=#b4b4b4]=[/color] [color=#b5cea8]0[/color][color=#b4b4b4];[/color] [color=#569cd6]static[/color] [color=#569cd6]unsigned[/color] [color=#569cd6]char[/color] [color=#c8c8c8]receive1Data_group[/color][color=#b4b4b4][[/color][color=#beb7ff]RECELENGTHMAX[/color] [color=#b4b4b4]=[/color] [color=#b4b4b4]{[/color][color=#b5cea8]0[/color][color=#b4b4b4]};[/color] [color=#4ec9b0]EventGroupHandle_t[/color] [color=#c8c8c8]EventGroupHandle_uart[/color] [color=#b4b4b4]=[/color] [color=#569cd6]NULL[/color][color=#b4b4b4];[/color] [color=#57a64a]/**[/color] [color=#57a64a] * [/color][color=#569cd6]@brief[/color][color=#57a64a] This function handle UART0 rx interrupt.[/color] [color=#57a64a] * [/color][color=#569cd6]@param[/color][color=#57a64a][[/color][color=#569cd6]in[/color][color=#57a64a]] [/color][color=#9a9a9a]driverState[/color][color=#57a64a]: callback parameter[/color] [color=#57a64a] * [/color][color=#569cd6]@param[/color][color=#57a64a][[/color][color=#569cd6]in[/color][color=#57a64a]] [/color][color=#9a9a9a]event[/color][color=#57a64a]: callback parameter[/color] [color=#57a64a] * [/color][color=#569cd6]@param[/color][color=#57a64a][[/color][color=#569cd6]in[/color][color=#57a64a]] [/color][color=#9a9a9a]userData[/color][color=#57a64a]: callback parameter[/color] [color=#57a64a] * [/color][color=#569cd6]@return[/color][color=#57a64a] none[/color] [color=#57a64a] */[/color] [color=#569cd6]void[/color] [color=#dcdcaa]UART0_RX_IRQHandler_Callback[/color][color=#b4b4b4]([/color][color=#569cd6]void[/color] [color=#b4b4b4]*[/color][color=#9a9a9a]driverState[/color][color=#b4b4b4],[/color] [color=#4ec9b0]uint32_t[/color] [color=#9a9a9a]event[/color][color=#b4b4b4],[/color] [color=#569cd6]void[/color] [color=#b4b4b4]*[/color][color=#9a9a9a]userData[/color][color=#b4b4b4])[/color] [color=#b4b4b4]{[/color] [color=#57a64a] /* USER CODE BEGIN UART0_RX_IRQHandler_Callback */[/color] [color=#d8a0df]if[/color] [color=#b4b4b4]([/color][color=#9a9a9a]event[/color] [color=#b4b4b4]==[/color] [color=#b5cea8]UART_EVENT_RX_FULL[/color][color=#b4b4b4])[/color] [color=#b4b4b4]{[/color] [color=#b4b4b4] [/color][color=#57a64a]// xEventGroupSetBits(EventGroupHandle_uart1, EVENT_UART1_RX);[/color] [color=#c8c8c8]receive0Data_group[/color][color=#b4b4b4][[/color][color=#c8c8c8]g_receive0Data_count[/color] [color=#b4b4b4]=[/color] [color=#c8c8c8]g_receive0Data[/color][color=#b4b4b4];[/color] [color=#c8c8c8]g_receive0Data_count[/color][color=#b4b4b4]++;[/color] [color=#d8a0df]if[/color] [color=#b4b4b4]([/color][color=#c8c8c8]g_receive0Data_count[/color] [color=#b4b4b4]>=[/color] [color=#beb7ff]RECELENGTHMAX[/color][color=#b4b4b4])[/color] [color=#b4b4b4]{[/color] [color=#c8c8c8]g_receive0Data_count[/color] [color=#b4b4b4]=[/color] [color=#b5cea8]0[/color][color=#b4b4b4];[/color] [color=#b4b4b4]}[/color] [color=#b4b4b4]}[/color] [color=#dcdcaa]UART_DRV_ReceiveData[/color][color=#b4b4b4]([/color][color=#b5cea8]0[/color][color=#b4b4b4],[/color] [color=#b4b4b4]&[/color][color=#c8c8c8]g_receive0Data[/color][color=#b4b4b4],[/color] [color=#b5cea8]1[/color][color=#b4b4b4]);[/color] [color=#57a64a] /* USER CODE END UART0_RX_IRQHandler_Callback */[/color] [color=#b4b4b4]}[/color] [color=#57a64a]/**[/color] [color=#57a64a] * [/color][color=#569cd6]@brief[/color][color=#57a64a] This function handle UART1 rx interrupt.[/color] [color=#57a64a] * [/color][color=#569cd6]@param[/color][color=#57a64a][[/color][color=#569cd6]in[/color][color=#57a64a]] [/color][color=#9a9a9a]driverState[/color][color=#57a64a]: callback parameter[/color] [color=#57a64a] * [/color][color=#569cd6]@param[/color][color=#57a64a][[/color][color=#569cd6]in[/color][color=#57a64a]] [/color][color=#9a9a9a]event[/color][color=#57a64a]: callback parameter[/color] [color=#57a64a] * [/color][color=#569cd6]@param[/color][color=#57a64a][[/color][color=#569cd6]in[/color][color=#57a64a]] [/color][color=#9a9a9a]userData[/color][color=#57a64a]: callback parameter[/color] [color=#57a64a] * [/color][color=#569cd6]@return[/color][color=#57a64a] none[/color] [color=#57a64a] */[/color] [color=#569cd6]void[/color] [color=#dcdcaa]UART1_RX_IRQHandler_Callback[/color][color=#b4b4b4]([/color][color=#569cd6]void[/color] [color=#b4b4b4]*[/color][color=#9a9a9a]driverState[/color][color=#b4b4b4],[/color] [color=#4ec9b0]uint32_t[/color] [color=#9a9a9a]event[/color][color=#b4b4b4],[/color] [color=#569cd6]void[/color] [color=#b4b4b4]*[/color][color=#9a9a9a]userData[/color][color=#b4b4b4])[/color] [color=#b4b4b4]{[/color] [color=#57a64a] /* USER CODE BEGIN UART1_RX_IRQHandler_Callback */[/color] [color=#d8a0df]if[/color] [color=#b4b4b4]([/color][color=#9a9a9a]event[/color] [color=#b4b4b4]==[/color] [color=#b5cea8]UART_EVENT_RX_FULL[/color][color=#b4b4b4])[/color] [color=#b4b4b4]{[/color] [color=#b4b4b4] [/color][color=#57a64a]// xEventGroupSetBits(EventGroupHandle_uart1, EVENT_UART1_RX);[/color] [color=#c8c8c8]receive1Data_group[/color][color=#b4b4b4][[/color][color=#c8c8c8]g_receive1Data_count[/color] [color=#b4b4b4]=[/color] [color=#c8c8c8]g_receive1Data[/color][color=#b4b4b4];[/color] [color=#c8c8c8]g_receive1Data_count[/color][color=#b4b4b4]++;[/color] [color=#d8a0df]if[/color] [color=#b4b4b4]([/color][color=#c8c8c8]g_receive1Data_count[/color] [color=#b4b4b4]>=[/color] [color=#beb7ff]RECELENGTHMAX[/color][color=#b4b4b4])[/color] [color=#b4b4b4]{[/color] [color=#c8c8c8]g_receive1Data_count[/color] [color=#b4b4b4]=[/color] [color=#b5cea8]0[/color][color=#b4b4b4];[/color] [color=#b4b4b4]}[/color] [color=#b4b4b4]}[/color] [color=#dcdcaa]UART_DRV_ReceiveData[/color][color=#b4b4b4]([/color][color=#b5cea8]1[/color][color=#b4b4b4],[/color] [color=#b4b4b4]&[/color][color=#c8c8c8]g_receive1Data[/color][color=#b4b4b4],[/color] [color=#b5cea8]1[/color][color=#b4b4b4]);[/color] [color=#57a64a] /* USER CODE END UART1_RX_IRQHandler_Callback */[/color] [color=#b4b4b4]}[/color] [color=#57a64a]/* UART0 init function */[/color] [color=#569cd6]static[/color] [color=#569cd6]void[/color] [color=#dcdcaa]ATC_UART0_Init[/color][color=#b4b4b4]([/color][color=#569cd6]void[/color][color=#b4b4b4])[/color] [color=#b4b4b4]{[/color] [color=#dcdcaa]memset[/color][color=#b4b4b4](&[/color][color=#c8c8c8]uart0Config[/color][color=#b4b4b4],[/color] [color=#b5cea8]0[/color][color=#b4b4b4],[/color] [color=#569cd6]sizeof[/color][color=#b4b4b4]([/color][color=#c8c8c8]uart0Config[/color][color=#b4b4b4]));[/color] [color=#57a64a] /**[/color] [color=#57a64a] GPIO Configuration for UART0[/color] [color=#57a64a] PB1 --> UART0_TX[/color] [color=#57a64a] PB0 --> UART0_RX[/color] [color=#57a64a] */[/color] [color=#dcdcaa]GPIO_DRV_SetMuxModeSel[/color][color=#b4b4b4]([/color][color=#beb7ff]PORTB[/color][color=#b4b4b4],[/color] [color=#b5cea8]1[/color][color=#b4b4b4],[/color] [color=#b5cea8]PORT_MUX_ALT2[/color][color=#b4b4b4]);[/color] [color=#dcdcaa]GPIO_DRV_SetMuxModeSel[/color][color=#b4b4b4]([/color][color=#beb7ff]PORTB[/color][color=#b4b4b4],[/color] [color=#b5cea8]0[/color][color=#b4b4b4],[/color] [color=#b5cea8]PORT_MUX_ALT2[/color][color=#b4b4b4]);[/color] [color=#57a64a] /* UART0 interrupt1 Init */[/color] [color=#dcdcaa]NVIC_SetPriority[/color][color=#b4b4b4]([/color][color=#b5cea8]UART0_IRQn[/color][color=#b4b4b4],[/color] [color=#b5cea8]0[/color][color=#b4b4b4]);[/color] [color=#dcdcaa]NVIC_EnableIRQ[/color][color=#b4b4b4]([/color][color=#b5cea8]UART0_IRQn[/color][color=#b4b4b4]);[/color] [color=#c8c8c8]uart0Config[/color][color=#b4b4b4].[/color]baudRate [color=#b4b4b4]=[/color] [color=#b5cea8]38400[/color][color=#b4b4b4];[/color] [color=#c8c8c8]uart0Config[/color][color=#b4b4b4].[/color]parityMode [color=#b4b4b4]=[/color] [color=#b5cea8]UART_PARITY_DISABLED[/color][color=#b4b4b4];[/color] [color=#c8c8c8]uart0Config[/color][color=#b4b4b4].[/color]stopBitCount [color=#b4b4b4]=[/color] [color=#b5cea8]UART_ONE_STOP_BIT[/color][color=#b4b4b4];[/color] [color=#c8c8c8]uart0Config[/color][color=#b4b4b4].[/color]bitCountPerChar [color=#b4b4b4]=[/color] [color=#b5cea8]UART_8_BITS_PER_CHAR[/color][color=#b4b4b4];[/color] [color=#c8c8c8]uart0Config[/color][color=#b4b4b4].[/color]transferType [color=#b4b4b4]=[/color] [color=#b5cea8]UART_USING_INTERRUPTS[/color][color=#b4b4b4];[/color] [color=#c8c8c8]uart0Config[/color][color=#b4b4b4].[/color]rxCallback [color=#b4b4b4]=[/color] [color=#dcdcaa]UART0_RX_IRQHandler_Callback[/color][color=#b4b4b4];[/color] [color=#dcdcaa]UART_DRV_Init[/color][color=#b4b4b4]([/color][color=#b5cea8]0[/color][color=#b4b4b4],[/color] [color=#b4b4b4]&[/color][color=#c8c8c8]s_uart0State[/color][color=#b4b4b4],[/color] [color=#b4b4b4]&[/color][color=#c8c8c8]uart0Config[/color][color=#b4b4b4]);[/color] [color=#57a64a] /* USER CODE BEGIN UART0_Init 2 */[/color] [color=#dcdcaa]UART_DRV_ReceiveData[/color][color=#b4b4b4]([/color][color=#b5cea8]0[/color][color=#b4b4b4],[/color] [color=#b4b4b4]&[/color][color=#c8c8c8]g_receive0Data[/color][color=#b4b4b4],[/color] [color=#b5cea8]1[/color][color=#b4b4b4]);[/color] [color=#57a64a] /* USER CODE END UART0_Init 2 */[/color] [color=#b4b4b4]}[/color] [color=#57a64a]/* UART1 init function */[/color] [color=#569cd6]static[/color] [color=#569cd6]void[/color] [color=#dcdcaa]ATC_UART1_Init[/color][color=#b4b4b4]([/color][color=#569cd6]void[/color][color=#b4b4b4])[/color] [color=#b4b4b4]{[/color] [color=#dcdcaa]memset[/color][color=#b4b4b4](&[/color][color=#c8c8c8]uart1Config[/color][color=#b4b4b4],[/color] [color=#b5cea8]0[/color][color=#b4b4b4],[/color] [color=#569cd6]sizeof[/color][color=#b4b4b4]([/color][color=#c8c8c8]uart1Config[/color][color=#b4b4b4]));[/color] [color=#57a64a] /**[/color] [color=#57a64a] GPIO Configuration for UART1[/color] [color=#57a64a] PC9 --> UART1_TX[/color] [color=#57a64a] PC8 --> UART1_RX[/color] [color=#57a64a] */[/color] [color=#dcdcaa]GPIO_DRV_SetMuxModeSel[/color][color=#b4b4b4]([/color][color=#beb7ff]PORTC[/color][color=#b4b4b4],[/color] [color=#b5cea8]9[/color][color=#b4b4b4],[/color] [color=#b5cea8]PORT_MUX_ALT2[/color][color=#b4b4b4]);[/color] [color=#dcdcaa]GPIO_DRV_SetMuxModeSel[/color][color=#b4b4b4]([/color][color=#beb7ff]PORTC[/color][color=#b4b4b4],[/color] [color=#b5cea8]8[/color][color=#b4b4b4],[/color] [color=#b5cea8]PORT_MUX_ALT2[/color][color=#b4b4b4]);[/color] [color=#57a64a] /* UART1 interrupt1 Init */[/color] [color=#dcdcaa]NVIC_SetPriority[/color][color=#b4b4b4]([/color][color=#b5cea8]UART1_IRQn[/color][color=#b4b4b4],[/color] [color=#b5cea8]1[/color][color=#b4b4b4]);[/color] [color=#dcdcaa]NVIC_EnableIRQ[/color][color=#b4b4b4]([/color][color=#b5cea8]UART1_IRQn[/color][color=#b4b4b4]);[/color] [color=#c8c8c8]uart1Config[/color][color=#b4b4b4].[/color]baudRate [color=#b4b4b4]=[/color] [color=#b5cea8]38400[/color][color=#b4b4b4];[/color] [color=#c8c8c8]uart1Config[/color][color=#b4b4b4].[/color]parityMode [color=#b4b4b4]=[/color] [color=#b5cea8]UART_PARITY_DISABLED[/color][color=#b4b4b4];[/color] [color=#c8c8c8]uart1Config[/color][color=#b4b4b4].[/color]stopBitCount [color=#b4b4b4]=[/color] [color=#b5cea8]UART_ONE_STOP_BIT[/color][color=#b4b4b4];[/color] [color=#c8c8c8]uart1Config[/color][color=#b4b4b4].[/color]bitCountPerChar [color=#b4b4b4]=[/color] [color=#b5cea8]UART_8_BITS_PER_CHAR[/color][color=#b4b4b4];[/color] [color=#c8c8c8]uart1Config[/color][color=#b4b4b4].[/color]transferType [color=#b4b4b4]=[/color] [color=#b5cea8]UART_USING_INTERRUPTS[/color][color=#b4b4b4];[/color] [color=#c8c8c8]uart1Config[/color][color=#b4b4b4].[/color]rxCallback [color=#b4b4b4]=[/color] [color=#dcdcaa]UART1_RX_IRQHandler_Callback[/color][color=#b4b4b4];[/color] [color=#dcdcaa]UART_DRV_Init[/color][color=#b4b4b4]([/color][color=#b5cea8]1[/color][color=#b4b4b4],[/color] [color=#b4b4b4]&[/color][color=#c8c8c8]s_uart1State[/color][color=#b4b4b4],[/color] [color=#b4b4b4]&[/color][color=#c8c8c8]uart1Config[/color][color=#b4b4b4]);[/color] [color=#57a64a] /* USER CODE BEGIN UART1_Init 2 */[/color] [color=#dcdcaa]UART_DRV_ReceiveData[/color][color=#b4b4b4]([/color][color=#b5cea8]1[/color][color=#b4b4b4],[/color] [color=#b4b4b4]&[/color][color=#c8c8c8]g_receive1Data[/color][color=#b4b4b4],[/color] [color=#b5cea8]1[/color][color=#b4b4b4]);[/color] [color=#57a64a] /* USER CODE END UART1_Init 2 */[/color] [color=#b4b4b4]}[/color] [color=#569cd6]void[/color] [color=#dcdcaa]drv_comm_init[/color][color=#b4b4b4]([/color][color=#569cd6]void[/color][color=#b4b4b4])[/color] [color=#b4b4b4]{[/color] [color=#dcdcaa]memset[/color][color=#b4b4b4]([/color][color=#c8c8c8]receive0Data_group[/color][color=#b4b4b4],[/color] [color=#b5cea8]0[/color][color=#b4b4b4],[/color] [color=#569cd6]sizeof[/color][color=#b4b4b4]([/color][color=#c8c8c8]receive0Data_group[/color][color=#b4b4b4]));[/color] [color=#dcdcaa]memset[/color][color=#b4b4b4]([/color][color=#c8c8c8]receive1Data_group[/color][color=#b4b4b4],[/color] [color=#b5cea8]0[/color][color=#b4b4b4],[/color] [color=#569cd6]sizeof[/color][color=#b4b4b4]([/color][color=#c8c8c8]receive1Data_group[/color][color=#b4b4b4]));[/color] [color=#c8c8c8]EventGroupHandle_uart[/color] [color=#b4b4b4]=[/color] [color=#dcdcaa]xEventGroupCreate[/color][color=#b4b4b4]();[/color] [color=#dcdcaa]ATC_UART0_Init[/color][color=#b4b4b4]();[/color] [color=#dcdcaa]ATC_UART1_Init[/color][color=#b4b4b4]();[/color] [color=#b4b4b4]}[/color] [color=#569cd6]void[/color] [color=#dcdcaa]drv_comm_write[/color][color=#b4b4b4]([/color][color=#569cd6]unsigned[/color] [color=#569cd6]char[/color] [color=#b4b4b4]*[/color][color=#9a9a9a]p_data[/color][color=#b4b4b4],[/color] [color=#569cd6]unsigned[/color] [color=#569cd6]char[/color] [color=#9a9a9a]length[/color][color=#b4b4b4])[/color] [color=#b4b4b4]{[/color] [color=#b4b4b4]}[/color] [color=#569cd6]void[/color] [color=#dcdcaa]drv_comm_read[/color][color=#b4b4b4]([/color][color=#569cd6]void[/color][color=#b4b4b4])[/color] [color=#b4b4b4]{[/color] [color=#b4b4b4]}[/color] [/font][/backcolor][/color]

    RT ar 串口中断 失效 AC78406

    1305浏览量 0回复量 关注量
  • 请教一下普冉MCU可以用JLINK开仿真吗

    [color=#252525][backcolor=rgb(255, 255, 255)][font=Tahoma, "]请教一下普冉MCU可以用JLINK开仿真吗,看资料上说好像只能用厂家自己的仿真器样。[/font][/backcolor][/color] [color=rgb(37, 37, 37)][font=Tahoma, "]以前用的几款国产的ARM核的MCU都可以用JLINK来调试。[/font][/color]

    单片机 仿真 MCU link ar ARM

    1414浏览量 3回复量 关注量
  • gd32E定时器频率动态更新的问题 sos

    [i=s] 本帖最后由 wahaha95 于 2022-10-5 20:01 编辑 [/i] [color=#000][font=Tahoma, Arial, Helvetica, snas-serif][size=14px] [/size][/font][/color][color=#000][font=Tahoma, Arial, Helvetica, snas-serif][size=14px]你好,我使用gd32E503要实现两路pwm功能,要求载波相位错开180度,频率可动态设置。[/size][/font][/color][color=#000][font=Tahoma, Arial, Helvetica, snas-serif][size=14px] 我使用timer0和timer7采用 增计数模式 实现,tim0和tim7都设置car和ch0cv的影子寄存器开启,tim7使用ch3比较事件触发dma,当ch3比较事件发生时,dma往tim0的swevg里写入0x01,即触发up事件,使得tim0复位cnt值,且更新car和ch0cv,以此来实现相位动态变化。[/size][/font][/color] [color=#000][font=Tahoma, Arial, Helvetica, snas-serif][size=14px] 测试使用25kHz定时器任务周期,同时更新tim0和tim7的car与ch0cv,每个周期100kH与200kHz来回变化。实际波形大部分时间相位和频率正确,但是偶尔会出现 频率不一致的情况。思考的很多天没理解为啥 同一时刻更新的car,但是实际会出现周期错位的情况。[/size][/font][/color] [color=#000][font=Tahoma, Arial, Helvetica, snas-serif][size=14px] 请问这是什么原因呢?[/size][/font][/color] [color=#000][/color]

    TIMER0 hz DM ar TI

    1064浏览量 0回复量 关注量
  • MounRiver Studio下载程序错误

    ------------ Begin flash process of "obj\GPIO_Toggle.hex" ------------ 08:41:20:512 >> Current project vendor is WCH, debugger is WCH-Link 08:41:20:513 >> Attempt to open device and upgrade firmware if necessary... 08:41:20:517 >> WCH-Link no need to upgrade. Already the latest version. 08:41:20:557 >> Starting to Send Chip Type... 08:41:20:569 >> Not support this packaged chip type Not support this packaged chip type 08:41:20:569 >> Starting to Close Link... 08:41:20:569 >> Close Link Success 有知道原因的吗,谢谢!

    MounRiver 错误 Studio 下载程序 link ar

    1131浏览量 4回复量 关注量
  • 51串口打印不出来,12M晶振!!哪里出问题了!!求看!

    晶振12M,波特率设置的2400,打印就不出来,更别提别的数据了。 #include #include #include sbit Temp_data = P3^6; void DHT11_start(); unsigned char DHT11_rec_byte(); void DHT11_receive(); void DHT11_delay_us(unsigned char n); void DHT11_delay_ms(unsigned int z); void InitUART(void); unsigned int rec_dat[4]; void main() { InitUART(); P1 = 0Xf0; EA = 1; while(1) { DHT11_delay_ms(150); DHT11_receive(); printf("Humi:%d.%d\n",rec_dat[0],rec_dat[1]); printf("Temp:%d.%d C\n",rec_dat[2],rec_dat[3]); } } void DHT11_start() { Temp_data =1; DHT11_delay_us(2); Temp_data =0; DHT11_delay_ms(20); Temp_data =1; DHT11_delay_us(13); } unsigned char DHT11_rec_byte() { unsigned char i,dat; for(i=0;i<8;i++) { while(!Temp_data); DHT11_delay_us(8); dat<<=1; if(Temp_data ==1) { dat+=1; } while(Temp_data); } return dat; } void DHT11_receive() { unsigned int R_H,R_L,T_H,T_L; unsigned char RH,RL,TH,TL,revise; DHT11_start(); Temp_data =1; if(Temp_data == 0) { while(Temp_data == 0); DHT11_delay_us(40); R_H=DHT11_rec_byte(); R_L=DHT11_rec_byte(); T_H=DHT11_rec_byte(); T_L=DHT11_rec_byte(); revise=DHT11_rec_byte(); DHT11_delay_us(25); if((R_H+R_L+T_H+T_L)==revise) { RH=R_H; RL=R_L; TH=T_H; TL=T_L; } rec_dat[0]=RH; rec_dat[1]=RL; rec_dat[2]=TH; rec_dat[3]=TL; } } void DHT11_delay_us(unsigned char n) { while(--n); } void DHT11_delay_ms(unsigned int z) { unsigned int i,j; for(i=z;i>0;i--) for(j=110;j>0;j--); } void InitUART(void) { SCON=0x50; REN =1; TMOD = 0x20; TH1 = 0xE6; // ??????V1.3???2400??????? TL1 = TH1; // ??????????? PCON = 0x80; // ???????? T1 =1; TR1 =1; }

    51单片机 嵌入式 51串口 晶振 串口打印 ar

    827浏览量 5回复量 关注量