12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- #include "ALL_Includes.h"
- uint8_t MyType=0;
- unsigned char USART1_Finish_Flag;
- extern uint32_t baudrateval;
- void USART_Receive_Init(void)
- {
- if (MyType>10)
- USART1_Receive_Init(baudrateval, USART_Parity_No, USART_StopBits_1);
- }
- int main(void)
- {
- ALL_Config(); //初始化IO口和蓝牙
- LED_On(); //开LED灯
-
- if (MyType<0x10)
- {
- USART1_Send_Init();
- USART_SendData(USART1, MyType); //输出编码器当前值 115200
- }
-
- LED_Off(); //关LED灯
- USART1_Finish_Flag=1;
- if (MyType==1)
- TQ_SDT_Init(); //司达特LED提取 初始化读取io口, 使用IO中断
- else if (MyType==2)
- TQ_SDT_Init(); //EZ3400 LED提取 初始化读取io口, 使用模拟SPI
- else if (MyType==3)
- I2C_InitConfig(); //RMH LED提取 初始化读取io口, 使用I2C
- else if (MyType==4)
- TQ_SDT_Init(); //sitrex LED提取 初始化读取io口, 使用模拟SPI
- else if (MyType==5)
- TQ_SDT_Init(); //1040XL 提取 初始化读取io口, 使用模拟SPI 1电源 3地 6sd 7sc 8ss
- else if (MyType==6 || MyType==7)
- TQ_SDT_Init(); //2500 提取 初始化读取io口, 使用模拟SPI
- else if(MyType==8) //sitrex 串口提取
- USART1_Receive_Init(115200, USART_Parity_No, USART_StopBits_1);
- else USART_Receive_Init();
-
- while(1)
- {
- if (MyType==1) SDT_TQ(); //司达特LED提取
- else
- {
- while (USART1_Finish_Flag)
- {
- if(8==MyType)
- {
- Uart_Process();
- USART1_Receive_Init(115200, USART_Parity_No, USART_StopBits_1);
- }
- else
- {
- USART1_Send_Buffer();
- USART_Receive_Init();
- }
- }
- }
- }
- }
|