ADC.c 2.4 KB

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