/******************************************************************************** **** Copyright (C), 2019, Fortior Technology Co., Ltd. **** ******************************************************************************** File Name : ADC.c Author : Bruce HW&RD Date : 2019-09-11 Description : .C file function description Version : 1.0 Function List : Record : 1.Date : 2019-09-11 Author : Bruce HW&RD Modification: Created file ********************************************************************************/ #include "ADC.h" #include "FU68xx_5_MCU.h" void ADC_Init(void) { /*************ADC PIN Analog Function Config*********************/ SetBit(P2_AN, PIN0); //AD0 P20 CH open--IU-->FOC Trigger mode SetBit(P2_AN, PIN3); //AD1 P23 CH open--IV-->FOC Trigger mode SetBit(P2_AN, PIN4); //AD2 P24 CH open--DCBUS-->FOC Trigger mode SetBit(P2_AN, PIN5); //AD3 P25 CH open SetBit(P2_AN, PIN6); //AD4 P27 CH open--IBUS/IW-->FOC Trigger mode SetBit(P2_AN, PIN6); //AD4 P27 CH open--IBUS/IW-->FOC Trigger mode SetBit(P1_AN, PIN3); //AD12 P27 CH open--IBUS/IW-->FOC Trigger mode SetBit(P1_AN, PIN6); //AD9 P16 CH open-- 盘管温度 SetBit(P2_AN, PIN0); //AD0 P20 CH open-- 环温 SetBit(P2_AN, PIN1); //AD8 P21 CH open-- 排气温度 SetBit(P3_AN, PIN4); //AD7 P34 CH open-- 压机外壳温度 SetBit(P3_AN, PIN3); //AD6 P33 CH open-- FORCE_AD SetBit(P2_AN, PIN6); //AD11 P26 CH open-- IPM温度 SetBit(P1_AN, PIN5); //AD12 P27 CH open--IBUS/IW-->FOC Trigger mode // SetBit(P1_AN , PIN4); //AD12 P27 CH open--IBUS/IW-->FOC Trigger mode /***********************ADC Channel Enable***********************/ SetBit(ADC_MASK, CH0EN | CH1EN | CH2EN | CH4EN | CH3EN); // SetBit(ADC_MASK, CH5EN | CH6EN | CH11EN | CH13EN | CH12EN); // SetBit(ADC_MASK, CH7EN | CH8EN | CH9EN | CH10EN);// /******************ADC Result Alignment*************************** 0:Right Alignment eg:max:0x0fff; 1:Left-Second MSB Alignment eg:max:0x7ff8; *****************************************************************/ SetBit(ADC_CR, ADCALIGN); /***********************ADC Interrupt Enable*********************/ ClrBit(ADC_CR, ADCIE); /***************************ADC Enable***************************/ SetBit(ADC_CR, ADCEN); }