| 12345678910111213141516171819202122232425262728293031323334353637383940 |
- /**
- * @copyright None
- * @file ADC.c
- * @author Comment Vivre
- * @date 2024-08-28
- * @brief None
- */
- #include <Myproject.h>
- /**
- * @function ADC_Init
- * @brief ADC端口初始化
- * @param[in] None
- * @return None
- * @date 2024-08-28
- */
- void ADC_Init(void)
- {
- // SetBit(P2_AN, PIN0); //AD0 P20 CH open--IU--固定
- // SetBit(P2_AN, PIN3); //AD1 P23 CH open--IV--固定
- SetBit(P2_AN, PIN4); //AD2 P24 OVP √
- // SetBit(P2_AN, PIN5); //AD3 P25 CH open
- SetBit(P2_AN, PIN7); //AD4 P27 CH open--IBUS/IW--固定
- // SetBit(P3_AN , PIN2); //AD5 P32 CH open
- // SetBit(P3_AN , PIN3); //AD6 P33 CH open
- // SetBit(P3_AN, PIN4); //AD7 P34 CH open
- SetBit(P2_AN, PIN1); //AD8 P21 MOS √
- SetBit(P1_AN, PIN6); //AD9 P16 VSP
- // SetBit(P1_AN , PIN4); //AD10 P14 CH open
- // SetBit(P2_AN , PIN6); //AD11 P26 CH open
- // SetBit(P1_AN , PIN3); //AD12 P13 CH open
- // SetBit(P1_AN , PIN5); //AD13 P15 CH open
- SetBit(ADC_MASK,CH2EN | CH4EN | CH8EN | CH9EN); //通道使能
- SetBit(ADC_CR, ADCALIGN); //ADC数据次高位对齐使能0-->Disable 1-->Enable
- ADC_SCYC = 0x36;
- ClrBit(ADC_CR, ADCIE); //ADC中断使能
- SetBit(ADC_CR, ADCEN); //Enable ADC0
- }
|