#include "wifi.h" #include "string.h" #include "delay.h" ///////////////���ڻ�������////////////////// /////////////////////////////////////////////// /////////////////////////////////////////////// /////////////////////////////////////////////// /************* ���ر������� **************/ char Uart3_Buf[Buf3_Max];//����2���ջ��� u8 First_Int = 0; //����3��ʼ�� void USART3_init(u32 bound) { //GPIO�˿����� // GPIO_InitTypeDef GPIO_InitStructure; // USART_InitTypeDef USART_InitStructure; // NVIC_InitTypeDef NVIC_InitStructure; // RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE); //ʹ��USART3��GPIOBʱ�� // RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART3, ENABLE); //ʹ��USART3��GPIOBʱ�� // // //USART3_TX GPIOB10 // GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10; //PB10 // GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; // GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; //����������� // GPIO_Init(GPIOB, &GPIO_InitStructure);//��ʼ��GPIOB // //USART3_RX GPIOB11��ʼ�� // GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11;//PB11 // GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;//�������� // GPIO_Init(GPIOB, &GPIO_InitStructure);//��ʼ��GPIOB // //Usart3 NVIC ���� // NVIC_InitStructure.NVIC_IRQChannel = USART3_IRQn; // NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority=0 ;//��ռ���ȼ�3 // NVIC_InitStructure.NVIC_IRQChannelSubPriority = 3; //�����ȼ�3 // NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; //IRQͨ��ʹ�� // NVIC_Init(&NVIC_InitStructure); //����ָ���IJ�����ʼ��VIC�Ĵ��� // //USART3 ��ʼ������ // USART_InitStructure.USART_BaudRate = bound;//���ڲ����� // USART_InitStructure.USART_WordLength = USART_WordLength_8b;//�ֳ�Ϊ8λ���ݸ�ʽ // USART_InitStructure.USART_StopBits = USART_StopBits_1;//һ��ֹͣλ // USART_InitStructure.USART_Parity = USART_Parity_No;//����żУ��λ // USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;//��Ӳ������������ // USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx; //�շ�ģʽ // USART_Init(USART3, &USART_InitStructure); //��ʼ������3 // USART_ITConfig(USART3, USART_IT_RXNE, ENABLE);//�������ڽ����ж� // USART_Cmd(USART3, ENABLE); //ʹ�ܴ���3 } void USART3_IRQHandler(void) //����3�жϷ������ { u8 Res=0; Res = USART_ReceiveData(USART3); Uart3_Buf[First_Int] = Res; //�����յ����ַ����浽������ First_Int++; //����ָ������ƶ� if(First_Int >= Buf3_Max) //���������,������ָ��ָ�򻺴���׵�ַ { First_Int = 0; } } //������ڻ������� void CLR_Buf(void) { u16 k; for(k=0;k",3,50); //����ͨ���ţ��Լ���Ҫ���͵��ַ����� delay_ms(200); UART3_SendString(buf); delay_ms(100); }