ADC.c 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /********************************************************************************
  2. **** Copyright (C), 2019, Fortior Technology Co., Ltd. ****
  3. ********************************************************************************
  4. File Name : ADC.c
  5. Author : Bruce HW&RD
  6. Date : 2019-09-11
  7. Description : .C file function description
  8. Version : 1.0
  9. Function List :
  10. Record :
  11. 1.Date : 2019-09-11
  12. Author : Bruce HW&RD
  13. Modification: Created file
  14. ********************************************************************************/
  15. #include "ADC.h"
  16. #include "FU68xx_5_MCU.h"
  17. void ADC_Init(void)
  18. {
  19. /*************ADC PIN Analog Function Config*********************/
  20. SetBit(P2_AN, PIN0); //AD0 P20 CH open--IU-->FOC Trigger mode
  21. SetBit(P2_AN, PIN3); //AD1 P23 CH open--IV-->FOC Trigger mode
  22. SetBit(P2_AN, PIN4); //AD2 P24 CH open--DCBUS-->FOC Trigger mode
  23. SetBit(P2_AN, PIN5); //AD3 P25 CH open
  24. SetBit(P2_AN, PIN6); //AD4 P27 CH open--IBUS/IW-->FOC Trigger mode
  25. SetBit(P2_AN, PIN6); //AD4 P27 CH open--IBUS/IW-->FOC Trigger mode
  26. SetBit(P1_AN, PIN3); //AD12 P27 CH open--IBUS/IW-->FOC Trigger mode
  27. SetBit(P1_AN, PIN6); //AD9 P16 CH open-- 盘管温度
  28. SetBit(P2_AN, PIN0); //AD0 P20 CH open-- 环温
  29. SetBit(P2_AN, PIN1); //AD8 P21 CH open-- 排气温度
  30. SetBit(P3_AN, PIN4); //AD7 P34 CH open-- 压机外壳温度
  31. SetBit(P3_AN, PIN3); //AD6 P33 CH open-- FORCE_AD
  32. SetBit(P2_AN, PIN6); //AD11 P26 CH open-- IPM温度
  33. SetBit(P1_AN, PIN5); //AD12 P27 CH open--IBUS/IW-->FOC Trigger mode
  34. // SetBit(P1_AN , PIN4); //AD12 P27 CH open--IBUS/IW-->FOC Trigger mode
  35. /***********************ADC Channel Enable***********************/
  36. SetBit(ADC_MASK, CH0EN | CH1EN | CH2EN | CH4EN | CH3EN); //
  37. SetBit(ADC_MASK, CH5EN | CH6EN | CH11EN | CH13EN | CH12EN); //
  38. SetBit(ADC_MASK, CH7EN | CH8EN | CH9EN | CH10EN);//
  39. /******************ADC Result Alignment***************************
  40. 0:Right Alignment eg:max:0x0fff;
  41. 1:Left-Second MSB Alignment eg:max:0x7ff8;
  42. *****************************************************************/
  43. SetBit(ADC_CR, ADCALIGN);
  44. /***********************ADC Interrupt Enable*********************/
  45. ClrBit(ADC_CR, ADCIE);
  46. /***************************ADC Enable***************************/
  47. SetBit(ADC_CR, ADCEN);
  48. }