//------------ADC0_InSeq2------------ // Busy-wait Analog to digital conversion initiates SS2 and // calls the user function provided in the initialization with // the results of the conversion in the parameters. // UserTask2(AIN6, AIN5, AIN4); // Input: none // Output: none // Samples ADC6, ADC5, and ADC4 // 125k max sampling // software trigger, busy-wait sampling void ADC0_InSeq2(void){ uint32_t x, y, z; ADC0_PSSI_R = 0x0004; // 1) initiate SS2 while((ADC0_RIS_R&0x04)==0){};// 2) wait for conversion done x = ADC0_SSFIFO2_R&0xFFF; // 3A) read 12-bit result from AIN6 (PD1) y = ADC0_SSFIFO2_R&0xFFF; // 3B) read 12-bit result from AIN5 (PD2) z = ADC0_SSFIFO2_R&0xFFF; // 3C) read 12-bit result from AIN4 (PD3) UserTask2(x, y, z); // 4) call the user function ADC0_ISC_R = 0x0004; // 5) acknowledge completion }
void ADC0Seq2_Handler(void){ ADC0_ISC_R |= 0x04; // acknowledge ADC sequence 2 completion UserTask2(ADC0_SSFIFO2_R); // 12-bit result pushed out to user task }