tq.c 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #include "tq.h"
  2. #include "ALL_Includes.h"
  3. #include "stm32f0xx_iwdg.h"
  4. extern uint8_t MyType;
  5. uint8_t sendbuf[10];
  6. void sendstr(void)
  7. {
  8. int k=0; int l=0;
  9. int i;
  10. for (i=0;i<5;i++)
  11. {
  12. if (sendbuf[i]!=0x20) l++;
  13. if ((sendbuf[i]>=0x30 && sendbuf[i]<=0x39) || sendbuf[i]==0x2D||sendbuf[i]<=0x20)
  14. k=1;
  15. else if (sendbuf[i]<0x30 || sendbuf[i]>0x39) { k=2; break;}
  16. }
  17. if (k<2 && l>0)
  18. {
  19. LED_On();
  20. if (MyType==1 ||MyType==3)
  21. {
  22. for (i=5;i>=0;i--) USART_SendData(USART1, sendbuf[i]);
  23. //for (i=0;i<6;i++) USART_SendData(USART1, sendbuf[i]);
  24. }
  25. else if (MyType==4)
  26. {
  27. for (i=0;i<6;i++) USART_SendData(USART1, sendbuf[i]);
  28. }
  29. else if (MyType==5)
  30. {
  31. for (i=0;i<6;i++) USART_SendData(USART1, sendbuf[i]);
  32. }
  33. else if (MyType==6 || MyType==7)
  34. {
  35. for (i=0;i<6;i++) USART_SendData(USART1, sendbuf[i]);
  36. }
  37. else if (MyType==2) //ez3400
  38. {
  39. for (i=6;i>0;i--)
  40. {
  41. if ((sendbuf[i])==0x20)
  42. {
  43. sendbuf[i]=sendbuf[1];
  44. break;
  45. }
  46. }
  47. for (i=2;i<8;i++) USART_SendData(USART1, sendbuf[i]);
  48. }
  49. WatchDog_Feed();
  50. LED_Off();
  51. }
  52. }