You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

51 lines
1.4 KiB

  1. /*****************头文件*************************/
  2. #include "fsl_common.h"
  3. #include "fsl_gpio.h"
  4. #include "pin_Init.h"
  5. #include "pit.h"
  6. #include "delay.h"
  7. #include "uart_Interrupt.h"
  8. #include "adc_Interrupt.h"
  9. #include "fsl_uart.h"
  10. #include "system_MKV56F24.h"
  11. /*********************************************
  12. PTA15——LED灯闪烁
  13. **********************************************/
  14. void main()
  15. {
  16. MCG->C4 = 0x40;
  17. SystemCoreClockUpdate ();
  18. // NVIC_SetPriorityGrouping(3u); //设置优先级分组3
  19. // NVIC_SetPriority(SysTick_IRQn, NVIC_EncodePriority(3u, 3, 2)); //抢占优先级3,子优先级2
  20. // NVIC_SetPriority(UART1_RX_TX_IRQn, NVIC_EncodePriority(3u, 1, 2)); //抢占优先级1,子优先级2
  21. //NVIC_SetPriority(UART2_RX_TX_IRQn, NVIC_EncodePriority(3u, 2, 1)); //抢占优先级1,子优先级2
  22. //NVIC_SetPriority(ADC0_IRQn, NVIC_EncodePriority(3u, 2, 2)); //抢占优先级1,子优先级2
  23. Delay_Init(); //延时函数初始化
  24. pin_Init(); //GPIO初始化
  25. UART1_InterrputInit(); //UART1初始化
  26. UART2_InterrputInit(); //UART2初始化
  27. ADC12_InterrputInit(); //ADC初始化
  28. Pit_MyInit(); //PIT定时器初始化
  29. while (1)
  30. {
  31. // GPIO_PinWrite(GPIOA, 15, 0);
  32. // Delay_ms(100U);
  33. // GPIO_PinWrite(GPIOA, 15, 1);
  34. // Delay_ms(100U);
  35. // UART1_sendData();
  36. RS485_Recieve_Data();
  37. ADC16_Recieve_Data();
  38. UART2_sendData();
  39. Delay_ms(1000U);
  40. }
  41. }