#include "common_include.h"
#include "bsp_adc.h"

uint16_t SetConversionTrigger(uint8_t u8AnNumber)
{
    uint16_t result = 0;
    
    switch(u8AnNumber)
    {
        case 0:
                ADC12B0_CHCTRL0_SWTRG = 1;
            break;
        case 1:
                ADC12B0_CHCTRL1_SWTRG = 1;
            break;
        case 2:
                ADC12B0_CHCTRL2_SWTRG = 1;
            break;
        case 3:
                ADC12B0_CHCTRL3_SWTRG = 1;
            break;
        case 4:
                ADC12B0_CHCTRL4_SWTRG = 1;
            break;
        case 5:
                ADC12B0_CHCTRL5_SWTRG = 1;
            break;
        case 6:
                ADC12B0_CHCTRL6_SWTRG = 1;
            break;
        case 7:
                ADC12B0_CHCTRL7_SWTRG = 1;
            break;
        case 8:
                ADC12B0_CHCTRL8_SWTRG = 1;
            break;
        case 9:
                ADC12B0_CHCTRL9_SWTRG = 1;
            break;
        case 10:
                ADC12B0_CHCTRL10_SWTRG = 1;
            break;
        case 11:
                ADC12B0_CHCTRL11_SWTRG = 1;
            break;
        case 12:
                ADC12B0_CHCTRL12_SWTRG = 1;
            break;
        case 13:
                ADC12B0_CHCTRL13_SWTRG = 1;
            break;
        case 14:
                ADC12B0_CHCTRL14_SWTRG = 1;
            break;
        case 15:
                ADC12B0_CHCTRL15_SWTRG = 1;
            break;
        case 16:
                ADC12B0_CHCTRL16_SWTRG = 1;
            break;
        case 17:
                ADC12B0_CHCTRL17_SWTRG = 1;
            break;
        case 18:
                ADC12B0_CHCTRL18_SWTRG = 1;
            break;
        case 19:
                ADC12B0_CHCTRL19_SWTRG = 1;
            break;
        case 20:
                ADC12B0_CHCTRL20_SWTRG = 1;
            break;
        case 21:
                ADC12B0_CHCTRL21_SWTRG = 1;
            break;
        case 22:
                ADC12B0_CHCTRL22_SWTRG = 1;
            break;
        case 23:
                ADC12B0_CHCTRL23_SWTRG = 1;
            break;
        case 24:
                ADC12B0_CHCTRL24_SWTRG = 1;
            break;
        case 25:
                ADC12B0_CHCTRL25_SWTRG = 1;
            break;
        case 26:
                ADC12B0_CHCTRL26_SWTRG = 1;
            break;
        case 27:
                ADC12B0_CHCTRL27_SWTRG = 1;
            break;
        case 28:
                ADC12B0_CHCTRL28_SWTRG = 1;
            break;
        case 29:
                ADC12B0_CHCTRL29_SWTRG = 1;
            break;
        case 30:
                ADC12B0_CHCTRL30_SWTRG = 1;
            break;
        case 31:
                ADC12B0_CHCTRL31_SWTRG = 1;
            break;
        case 32:
                ADC12B0_CHCTRL32_SWTRG = 1;
            break;
        case 33:
                ADC12B0_CHCTRL33_SWTRG = 1;
            break;
        case 34:
                ADC12B0_CHCTRL34_SWTRG = 1;
            break;
        case 35:
                ADC12B0_CHCTRL35_SWTRG = 1;
            break;
        case 36:
                ADC12B0_CHCTRL36_SWTRG = 1;
            break;
        case 37:
                ADC12B0_CHCTRL37_SWTRG = 1;
            break;
        case 38:
                ADC12B0_CHCTRL38_SWTRG = 1;
            break;
        case 39:
                ADC12B0_CHCTRL39_SWTRG = 1;
            break;
        case 40:
                ADC12B0_CHCTRL40_SWTRG = 1;
            break;
        case 41:
                ADC12B0_CHCTRL41_SWTRG = 1;
            break;
        case 42:
                ADC12B0_CHCTRL42_SWTRG = 1;
            break;
        case 43:
                ADC12B0_CHCTRL43_SWTRG = 1;
            break;
        case 44:
                ADC12B0_CHCTRL44_SWTRG = 1;
            break;
        case 45:
                ADC12B0_CHCTRL45_SWTRG = 1;
            break;
        case 46:
                ADC12B0_CHCTRL46_SWTRG = 1;
            break;
        case 47:
                ADC12B0_CHCTRL47_SWTRG = 1;
            break;
        case 48:
                ADC12B0_CHCTRL48_SWTRG = 1;
            break;
        case 49:
                ADC12B0_CHCTRL49_SWTRG = 1;
            break;
        case 50:
                ADC12B0_CHCTRL50_SWTRG = 1;
            break;
        case 51:
                ADC12B0_CHCTRL51_SWTRG = 1;
            break;
        case 52:
                ADC12B0_CHCTRL52_SWTRG = 1;
            break;
        case 53:
                ADC12B0_CHCTRL53_SWTRG = 1;
            break;
        case 54:
                ADC12B0_CHCTRL54_SWTRG = 1;
            break;
        case 55:
                ADC12B0_CHCTRL55_SWTRG = 1;
            break;
        case 56:
                ADC12B0_CHCTRL56_SWTRG = 1;
            break;
        case 57:
                ADC12B0_CHCTRL57_SWTRG = 1;
            break;
        case 58:
                ADC12B0_CHCTRL58_SWTRG = 1;
            break;
        case 59:
                ADC12B0_CHCTRL59_SWTRG = 1;
            break;
        case 60:
                ADC12B0_CHCTRL60_SWTRG = 1;
            break;
        case 61:
                ADC12B0_CHCTRL61_SWTRG = 1;
            break;
        case 62:
                ADC12B0_CHCTRL62_SWTRG = 1;
            break;
        case 63:
                ADC12B0_CHCTRL63_SWTRG = 1;
            break;
        default:break;
    }
    
    return result;
}
_ADSignal GetConversionResult(uint8_t u8AnNumber)
{
    _ADSignal result;
    result.ADonversionState = 0;
    result.ADonversionData  = 0;
    switch(u8AnNumber)
    {
        case 0:
            if(ADC12B0_CDONEIRQ0_CDONEIRQ0 == 1)
            {
                result.ADonversionData  = ADC12B0_CD0;
                result.ADonversionState = 1;
                ADC12B0_CDONEIRQC0_CDONEIRQC0 = 1;
            }
            else
            {
                result.ADonversionState = 0;
                result.ADonversionData  = 0;
            }
            break;
        case 1:
            if(ADC12B0_CDONEIRQ0_CDONEIRQ1 == 1)
            {
                result.ADonversionData  = ADC12B0_CD1;
                result.ADonversionState = 1;
                ADC12B0_CDONEIRQC0_CDONEIRQC1 = 1;
            }
            else
            {
                result.ADonversionState = 0;
                result.ADonversionData  = 0;
            }
            break;
        case 2:
            if(ADC12B0_CDONEIRQ0_CDONEIRQ2 == 1)
            {
                result.ADonversionData  = ADC12B0_CD2;
                result.ADonversionState = 1;
                ADC12B0_CDONEIRQC0_CDONEIRQC2 = 1;
            }
            else
            {
                result.ADonversionState = 0;
                result.ADonversionData  = 0;
            }
            break;
        case 3:
            if(ADC12B0_CDONEIRQ0_CDONEIRQ3 == 1)
            {
                result.ADonversionData  = ADC12B0_CD3;
                result.ADonversionState = 1;
                ADC12B0_CDONEIRQC0_CDONEIRQC3 = 1;
            }
            else
            {
                result.ADonversionState = 0;
                result.ADonversionData  = 0;
            }
            break;
        case 4:
            if(ADC12B0_CDONEIRQ0_CDONEIRQ4 == 1)
            {
                result.ADonversionData  = ADC12B0_CD4;
                result.ADonversionState = 1;
                ADC12B0_CDONEIRQC0_CDONEIRQC4 = 1;
            }
            else
            {
                result.ADonversionState = 0;
                result.ADonversionData  = 0;
            }
            break;
        case 5:
            if(ADC12B0_CDONEIRQ0_CDONEIRQ5 == 1)
            {
                result.ADonversionData  = ADC12B0_CD5;
                result.ADonversionState = 1;
                ADC12B0_CDONEIRQC0_CDONEIRQC5 = 1;
            }
            else
            {
                result.ADonversionState = 0;
                result.ADonversionData  = 0;
            }
            break;
        case 6:
            if(ADC12B0_CDONEIRQ0_CDONEIRQ6 == 1)
            {
                result.ADonversionData  = ADC12B0_CD6;
                result.ADonversionState = 1;
                ADC12B0_CDONEIRQC0_CDONEIRQC6 = 1;
            }
            else
            {
                result.ADonversionState = 0;
                result.ADonversionData  = 0;
            }
            break;
        case 7:
            if(ADC12B0_CDONEIRQ0_CDONEIRQ7 == 1)
            {
                result.ADonversionData  = ADC12B0_CD7;
                result.ADonversionState = 1;
                ADC12B0_CDONEIRQC0_CDONEIRQC7 = 1;
            }
            else
            {
                result.ADonversionState = 0;
                result.ADonversionData  = 0;
            }
            break;
        case 8:
            if(ADC12B0_CDONEIRQ0_CDONEIRQ8 == 1)
            {
                result.ADonversionData  = ADC12B0_CD8;
                result.ADonversionState = 1;
                ADC12B0_CDONEIRQC0_CDONEIRQC8 = 1;
            }
            else
            {
                result.ADonversionState = 0;
                result.ADonversionData  = 0;
            }
            break;
        case 9:
            if(ADC12B0_CDONEIRQ0_CDONEIRQ9 == 1)
            {
                result.ADonversionData  = ADC12B0_CD9;
                result.ADonversionState = 1;
                ADC12B0_CDONEIRQC0_CDONEIRQC9 = 1;
            }
            else
            {
                result.ADonversionState = 0;
                result.ADonversionData  = 0;
            }
            break;
        case 10:
            if(ADC12B0_CDONEIRQ0_CDONEIRQ10 == 1)
            {
                result.ADonversionData  = ADC12B0_CD10;
                result.ADonversionState = 1;
                ADC12B0_CDONEIRQC0_CDONEIRQC10 = 1;
            }
            else
            {
                result.ADonversionState = 0;
                result.ADonversionData  = 0;
            }
            break;
        case 11:
            if(ADC12B0_CDONEIRQ0_CDONEIRQ11 == 1)
            {
                result.ADonversionData  = ADC12B0_CD11;
                result.ADonversionState = 1;
                ADC12B0_CDONEIRQC0_CDONEIRQC11 = 1;
            }
            else
            {
                result.ADonversionState = 0;
                result.ADonversionData  = 0;
            }
            break;
        case 12:
            if(ADC12B0_CDONEIRQ0_CDONEIRQ12 == 1)
            {
                result.ADonversionData  = ADC12B0_CD12;
                result.ADonversionState = 1;
                ADC12B0_CDONEIRQC0_CDONEIRQC12 = 1;
            }
            else
            {
                result.ADonversionState = 0;
                result.ADonversionData  = 0;
            }
            break;
        case 13:
            if(ADC12B0_CDONEIRQ0_CDONEIRQ13 == 1)
            {
                result.ADonversionData  = ADC12B0_CD13;
                result.ADonversionState = 1;
                ADC12B0_CDONEIRQC0_CDONEIRQC13 = 1;
            }
            else
            {
                result.ADonversionState = 0;
                result.ADonversionData  = 0;
            }
            break;
        case 14:
            if(ADC12B0_CDONEIRQ0_CDONEIRQ14 == 1)
            {
                result.ADonversionData  = ADC12B0_CD14;
                result.ADonversionState = 1;
                ADC12B0_CDONEIRQC0_CDONEIRQC14 = 1;
            }
            else
            {
                result.ADonversionState = 0;
                result.ADonversionData  = 0;
            }
            break;
        case 15:
            if(ADC12B0_CDONEIRQ0_CDONEIRQ15 == 1)
            {
                result.ADonversionData  = ADC12B0_CD15;
                result.ADonversionState = 1;
                ADC12B0_CDONEIRQC0_CDONEIRQC15 = 1;
            }
            else
            {
                result.ADonversionState = 0;
                result.ADonversionData  = 0;
            }
            break;
        case 16:
            if(ADC12B0_CDONEIRQ0_CDONEIRQ16 == 1)
            {
                result.ADonversionData  = ADC12B0_CD16;
                result.ADonversionState = 1;
                ADC12B0_CDONEIRQC0_CDONEIRQC16 = 1;
            }
            else
            {
                result.ADonversionState = 0;
                result.ADonversionData  = 0;
            }
            break;
        case 17:
            if(ADC12B0_CDONEIRQ0_CDONEIRQ17 == 1)
            {
                result.ADonversionData  = ADC12B0_CD17;
                result.ADonversionState = 1;
                ADC12B0_CDONEIRQC0_CDONEIRQC17 = 1;
            }
            else
            {
                result.ADonversionState = 0;
                result.ADonversionData  = 0;
            }
            break;
        case 18:
            if(ADC12B0_CDONEIRQ0_CDONEIRQ18 == 1)
            {
                result.ADonversionData  = ADC12B0_CD18;
                result.ADonversionState = 1;
                ADC12B0_CDONEIRQC0_CDONEIRQC18 = 1;
            }
            else
            {
                result.ADonversionState = 0;
                result.ADonversionData  = 0;
            }
            break;
        case 19:
            if(ADC12B0_CDONEIRQ0_CDONEIRQ19 == 1)
            {
                result.ADonversionData  = ADC12B0_CD19;
                result.ADonversionState = 1;
                ADC12B0_CDONEIRQC0_CDONEIRQC19 = 1;
            }
            else
            {
                result.ADonversionState = 0;
                result.ADonversionData  = 0;
            }
            break;
        case 20:
            if(ADC12B0_CDONEIRQ0_CDONEIRQ20 == 1)
            {
                result.ADonversionData  = ADC12B0_CD20;
                result.ADonversionState = 1;
                ADC12B0_CDONEIRQC0_CDONEIRQC20 = 1;
            }
            else
            {
                result.ADonversionState = 0;
                result.ADonversionData  = 0;
            }
            break;
        case 21:
            if(ADC12B0_CDONEIRQ0_CDONEIRQ21 == 1)
            {
                result.ADonversionData  = ADC12B0_CD21;
                result.ADonversionState = 1;
                ADC12B0_CDONEIRQC0_CDONEIRQC21 = 1;
            }
            else
            {
                result.ADonversionState = 0;
                result.ADonversionData  = 0;
            }
            break;
        case 22:
            if(ADC12B0_CDONEIRQ0_CDONEIRQ22 == 1)
            {
                result.ADonversionData  = ADC12B0_CD22;
                result.ADonversionState = 1;
                ADC12B0_CDONEIRQC0_CDONEIRQC22 = 1;
            }
            else
            {
                result.ADonversionState = 0;
                result.ADonversionData  = 0;
            }
            break;
        case 23:
            if(ADC12B0_CDONEIRQ0_CDONEIRQ23 == 1)
            {
                result.ADonversionData  = ADC12B0_CD23;
                result.ADonversionState = 1;
                ADC12B0_CDONEIRQC0_CDONEIRQC23 = 1;
            }
            else
            {
                result.ADonversionState = 0;
                result.ADonversionData  = 0;
            }
            break;
        case 24:
            if(ADC12B0_CDONEIRQ0_CDONEIRQ24 == 1)
            {
                result.ADonversionData  = ADC12B0_CD24;
                result.ADonversionState = 1;
                ADC12B0_CDONEIRQC0_CDONEIRQC24 = 1;
            }
            else
            {
                result.ADonversionState = 0;
                result.ADonversionData  = 0;
            }
            break;
        case 25:
            if(ADC12B0_CDONEIRQ0_CDONEIRQ25 == 1)
            {
                result.ADonversionData  = ADC12B0_CD25;
                result.ADonversionState = 1;
                ADC12B0_CDONEIRQC0_CDONEIRQC25 = 1;
            }
            else
            {
                result.ADonversionState = 0;
                result.ADonversionData  = 0;
            }
            break;
        case 26:
            if(ADC12B0_CDONEIRQ0_CDONEIRQ26 == 1)
            {
                result.ADonversionData  = ADC12B0_CD26;
                result.ADonversionState = 1;
                ADC12B0_CDONEIRQC0_CDONEIRQC26 = 1;
            }
            else
            {
                result.ADonversionState = 0;
                result.ADonversionData  = 0;
            }
            break;
        case 27:
            if(ADC12B0_CDONEIRQ0_CDONEIRQ27 == 1)
            {
                result.ADonversionData  = ADC12B0_CD27;
                result.ADonversionState = 1;
                ADC12B0_CDONEIRQC0_CDONEIRQC27 = 1;
            }
            else
            {
                result.ADonversionState = 0;
                result.ADonversionData  = 0;
            }
            break;
        case 28:
            if(ADC12B0_CDONEIRQ0_CDONEIRQ28 == 1)
            {
                result.ADonversionData  = ADC12B0_CD28;
                result.ADonversionState = 1;
                ADC12B0_CDONEIRQC0_CDONEIRQC28 = 1;
            }
            else
            {
                result.ADonversionState = 0;
                result.ADonversionData  = 0;
            }
            break;
        case 29:
            if(ADC12B0_CDONEIRQ0_CDONEIRQ29 == 1)
            {
                result.ADonversionData  = ADC12B0_CD29;
                result.ADonversionState = 1;
                ADC12B0_CDONEIRQC0_CDONEIRQC29 = 1;
            }
            else
            {
                result.ADonversionState = 0;
                result.ADonversionData  = 0;
            }
            break;
        case 30:
            if(ADC12B0_CDONEIRQ0_CDONEIRQ30 == 1)
            {
                result.ADonversionData  = ADC12B0_CD30;
                result.ADonversionState = 1;
                ADC12B0_CDONEIRQC0_CDONEIRQC30 = 1;
            }
            else
            {
                result.ADonversionState = 0;
                result.ADonversionData  = 0;
            }
            break;
        case 31:
            if(ADC12B0_CDONEIRQ0_CDONEIRQ31 == 1)
            {
                result.ADonversionData  = ADC12B0_CD31;
                result.ADonversionState = 1;
                ADC12B0_CDONEIRQC0_CDONEIRQC31 = 1;
            }
            else
            {
                result.ADonversionState = 0;
                result.ADonversionData  = 0;
            }
            break;
        case 32:
            if(ADC12B0_CDONEIRQ1_CDONEIRQ32 == 1)
            {
                result.ADonversionData  = ADC12B0_CD32;
                result.ADonversionState = 1;
                ADC12B0_CDONEIRQC1_CDONEIRQC32 = 1;
            }
            else
            {
                result.ADonversionState = 0;
                result.ADonversionData  = 0;
            }
            break;
        case 33:
            if(ADC12B0_CDONEIRQ1_CDONEIRQ33 == 1)
            {
                result.ADonversionData  = ADC12B0_CD33;
                result.ADonversionState = 1;
                ADC12B0_CDONEIRQC1_CDONEIRQC33 = 1;
            }
            else
            {
                result.ADonversionState = 0;
                result.ADonversionData  = 0;
            }
            break;
        case 34:
            if(ADC12B0_CDONEIRQ1_CDONEIRQ34 == 1)
            {
                result.ADonversionData  = ADC12B0_CD34;
                result.ADonversionState = 1;
                ADC12B0_CDONEIRQC1_CDONEIRQC34 = 1;
            }
            else
            {
                result.ADonversionState = 0;
                result.ADonversionData  = 0;
            }
            break;
        case 35:
            if(ADC12B0_CDONEIRQ1_CDONEIRQ35 == 1)
            {
                result.ADonversionData  = ADC12B0_CD35;
                result.ADonversionState = 1;
                ADC12B0_CDONEIRQC1_CDONEIRQC35 = 1;
            }
            else
            {
                result.ADonversionState = 0;
                result.ADonversionData  = 0;
            }
            break;
        case 36:
            if(ADC12B0_CDONEIRQ1_CDONEIRQ36 == 1)
            {
                result.ADonversionData  = ADC12B0_CD36;
                result.ADonversionState = 1;
                ADC12B0_CDONEIRQC1_CDONEIRQC36 = 1;
            }
            else
            {
                result.ADonversionState = 0;
                result.ADonversionData  = 0;
            }
            break;
        case 37:
            if(ADC12B0_CDONEIRQ1_CDONEIRQ37 == 1)
            {
                result.ADonversionData  = ADC12B0_CD37;
                result.ADonversionState = 1;
                ADC12B0_CDONEIRQC1_CDONEIRQC37 = 1;
            }
            else
            {
                result.ADonversionState = 0;
                result.ADonversionData  = 0;
            }
            break;
        case 38:
            if(ADC12B0_CDONEIRQ1_CDONEIRQ38 == 1)
            {
                result.ADonversionData  = ADC12B0_CD38;
                result.ADonversionState = 1;
                ADC12B0_CDONEIRQC1_CDONEIRQC38 = 1;
            }
            else
            {
                result.ADonversionState = 0;
                result.ADonversionData  = 0;
            }
            break;
        case 39:
            if(ADC12B0_CDONEIRQ1_CDONEIRQ39 == 1)
            {
                result.ADonversionData  = ADC12B0_CD39;
                result.ADonversionState = 1;
                ADC12B0_CDONEIRQC1_CDONEIRQC39 = 1;
            }
            else
            {
                result.ADonversionState = 0;
                result.ADonversionData  = 0;
            }
            break;
        case 40:
            if(ADC12B0_CDONEIRQ1_CDONEIRQ40 == 1)
            {
                result.ADonversionData  = ADC12B0_CD40;
                result.ADonversionState = 1;
                ADC12B0_CDONEIRQC1_CDONEIRQC40 = 1;
            }
            else
            {
                result.ADonversionState = 0;
                result.ADonversionData  = 0;
            }
            break;
        case 41:
            if(ADC12B0_CDONEIRQ1_CDONEIRQ41 == 1)
            {
                result.ADonversionData  = ADC12B0_CD41;
                result.ADonversionState = 1;
                ADC12B0_CDONEIRQC1_CDONEIRQC41 = 1;
            }
            else
            {
                result.ADonversionState = 0;
                result.ADonversionData  = 0;
            }
            break;
        case 42:
            if(ADC12B0_CDONEIRQ1_CDONEIRQ42 == 1)
            {
                result.ADonversionData  = ADC12B0_CD42;
                result.ADonversionState = 1;
                ADC12B0_CDONEIRQC1_CDONEIRQC42 = 1;
            }
            else
            {
                result.ADonversionState = 0;
                result.ADonversionData  = 0;
            }
            break;
        case 43:
            if(ADC12B0_CDONEIRQ1_CDONEIRQ43 == 1)
            {
                result.ADonversionData  = ADC12B0_CD43;
                result.ADonversionState = 1;
                ADC12B0_CDONEIRQC1_CDONEIRQC43 = 1;
            }
            else
            {
                result.ADonversionState = 0;
                result.ADonversionData  = 0;
            }
            break;
        case 44:
            if(ADC12B0_CDONEIRQ1_CDONEIRQ44 == 1)
            {
                result.ADonversionData  = ADC12B0_CD44;
                result.ADonversionState = 1;
                ADC12B0_CDONEIRQC1_CDONEIRQC44 = 1;
            }
            else
            {
                result.ADonversionState = 0;
                result.ADonversionData  = 0;
            }
            break;
        case 45:
            if(ADC12B0_CDONEIRQ1_CDONEIRQ45 == 1)
            {
                result.ADonversionData  = ADC12B0_CD45;
                result.ADonversionState = 1;
                ADC12B0_CDONEIRQC1_CDONEIRQC45 = 1;
            }
            else
            {
                result.ADonversionState = 0;
                result.ADonversionData  = 0;
            }
            break;
        case 46:
            if(ADC12B0_CDONEIRQ1_CDONEIRQ46 == 1)
            {
                result.ADonversionData  = ADC12B0_CD46;
                result.ADonversionState = 1;
                ADC12B0_CDONEIRQC1_CDONEIRQC46 = 1;
            }
            else
            {
                result.ADonversionState = 0;
                result.ADonversionData  = 0;
            }
            break;
        case 47:
            if(ADC12B0_CDONEIRQ1_CDONEIRQ47 == 1)
            {
                result.ADonversionData  = ADC12B0_CD47;
                result.ADonversionState = 1;
                ADC12B0_CDONEIRQC1_CDONEIRQC47 = 1;
            }
            else
            {
                result.ADonversionState = 0;
                result.ADonversionData  = 0;
            }
            break;
        case 48:
            if(ADC12B0_CDONEIRQ1_CDONEIRQ48 == 1)
            {
                result.ADonversionData  = ADC12B0_CD48;
                result.ADonversionState = 1;
                ADC12B0_CDONEIRQC1_CDONEIRQC48 = 1;
            }
            else
            {
                result.ADonversionState = 0;
                result.ADonversionData  = 0;
            }
            break;
        case 49:
            if(ADC12B0_CDONEIRQ1_CDONEIRQ49 == 1)
            {
                result.ADonversionData  = ADC12B0_CD49;
                result.ADonversionState = 1;
                ADC12B0_CDONEIRQC1_CDONEIRQC49 = 1;
            }
            else
            {
                result.ADonversionState = 0;
                result.ADonversionData  = 0;
            }
            break;
        case 50:
            if(ADC12B0_CDONEIRQ1_CDONEIRQ50 == 1)
            {
                result.ADonversionData  = ADC12B0_CD50;
                result.ADonversionState = 1;
                ADC12B0_CDONEIRQC1_CDONEIRQC50 = 1;
            }
            else
            {
                result.ADonversionState = 0;
                result.ADonversionData  = 0;
            }
            break;
        case 51:
            if(ADC12B0_CDONEIRQ1_CDONEIRQ51 == 1)
            {
                result.ADonversionData  = ADC12B0_CD51;
                result.ADonversionState = 1;
                ADC12B0_CDONEIRQC1_CDONEIRQC51 = 1;
            }
            else
            {
                result.ADonversionState = 0;
                result.ADonversionData  = 0;
            }
            break;
        case 52:
            if(ADC12B0_CDONEIRQ1_CDONEIRQ52 == 1)
            {
                result.ADonversionData  = ADC12B0_CD52;
                result.ADonversionState = 1;
                ADC12B0_CDONEIRQC1_CDONEIRQC52 = 1;
            }
            else
            {
                result.ADonversionState = 0;
                result.ADonversionData  = 0;
            }
            break;
        case 53:
            if(ADC12B0_CDONEIRQ1_CDONEIRQ53 == 1)
            {
                result.ADonversionData  = ADC12B0_CD53;
                result.ADonversionState = 1;
                ADC12B0_CDONEIRQC1_CDONEIRQC53 = 1;
            }
            else
            {
                result.ADonversionState = 0;
                result.ADonversionData  = 0;
            }
            break;
        case 54:
            if(ADC12B0_CDONEIRQ1_CDONEIRQ54 == 1)
            {
                result.ADonversionData  = ADC12B0_CD54;
                result.ADonversionState = 1;
                ADC12B0_CDONEIRQC1_CDONEIRQC54 = 1;
            }
            else
            {
                result.ADonversionState = 0;
                result.ADonversionData  = 0;
            }
            break;
        case 55:
            if(ADC12B0_CDONEIRQ1_CDONEIRQ55 == 1)
            {
                result.ADonversionData  = ADC12B0_CD55;
                result.ADonversionState = 1;
                ADC12B0_CDONEIRQC1_CDONEIRQC55 = 1;
            }
            else
            {
                result.ADonversionState = 0;
                result.ADonversionData  = 0;
            }
            break;
        case 56:
            if(ADC12B0_CDONEIRQ1_CDONEIRQ56 == 1)
            {
                result.ADonversionData  = ADC12B0_CD56;
                result.ADonversionState = 1;
                ADC12B0_CDONEIRQC1_CDONEIRQC56 = 1;
            }
            else
            {
                result.ADonversionState = 0;
                result.ADonversionData  = 0;
            }
            break;
        case 57:
            if(ADC12B0_CDONEIRQ1_CDONEIRQ57 == 1)
            {
                result.ADonversionData  = ADC12B0_CD57;
                result.ADonversionState = 1;
                ADC12B0_CDONEIRQC1_CDONEIRQC57 = 1;
            }
            else
            {
                result.ADonversionState = 0;
                result.ADonversionData  = 0;
            }
            break;
        case 58:
            if(ADC12B0_CDONEIRQ1_CDONEIRQ58 == 1)
            {
                result.ADonversionData  = ADC12B0_CD58;
                result.ADonversionState = 1;
                ADC12B0_CDONEIRQC1_CDONEIRQC58 = 1;
            }
            else
            {
                result.ADonversionState = 0;
                result.ADonversionData  = 0;
            }
            break;
        case 59:
            if(ADC12B0_CDONEIRQ1_CDONEIRQ59 == 1)
            {
                result.ADonversionData  = ADC12B0_CD59;
                result.ADonversionState = 1;
                ADC12B0_CDONEIRQC1_CDONEIRQC59 = 1;
            }
            else
            {
                result.ADonversionState = 0;
                result.ADonversionData  = 0;
            }
            break;
        case 60:
            if(ADC12B0_CDONEIRQ1_CDONEIRQ60 == 1)
            {
                result.ADonversionData  = ADC12B0_CD60;
                result.ADonversionState = 1;
                ADC12B0_CDONEIRQC1_CDONEIRQC60 = 1;
            }
            else
            {
                result.ADonversionState = 0;
                result.ADonversionData  = 0;
            }
            break;
        case 61:
            if(ADC12B0_CDONEIRQ1_CDONEIRQ61 == 1)
            {
                result.ADonversionData  = ADC12B0_CD61;
                result.ADonversionState = 1;
                ADC12B0_CDONEIRQC1_CDONEIRQC61 = 1;
            }
            else
            {
                result.ADonversionState = 0;
                result.ADonversionData  = 0;
            }
            break;
        case 62:
            if(ADC12B0_CDONEIRQ1_CDONEIRQ62 == 1)
            {
                result.ADonversionData  = ADC12B0_CD62;
                result.ADonversionState = 1;
                ADC12B0_CDONEIRQC1_CDONEIRQC62 = 1;
            }
            else
            {
                result.ADonversionState = 0;
                result.ADonversionData  = 0;
            }
            break;
        case 63:
            if(ADC12B0_CDONEIRQ1_CDONEIRQ63 == 1)
            {
                result.ADonversionData  = ADC12B0_CD63;
                result.ADonversionState = 1;
                ADC12B0_CDONEIRQC1_CDONEIRQC63 = 1;
            }
            else
            {
                result.ADonversionState = 0;
                result.ADonversionData  = 0;
            }
            break;
        default:break;
    }
    
    return result;
}



void AdcConversionInit(uint8_t u8PortIndex,uint8_t u8PinNumber,uint8_t u8AnNumber)
{
    // Port initialize
    stc_port_pin_config_t PpcConf = { PortOutputResourceGPIO };
    
    PpcConf.bInputEnable = FALSE;
    PpcConf.bNoiseFilterEnable = FALSE;
    PpcConf.enGpioDirection = PortGpioInput;
    PpcConf.enInputLevel = PortInputLevelCmosA;
    PpcConf.enOutputDrive = PortOutputDriveA;
    PpcConf.enOutputFunction = PortOutputResourceGPIO;
    PpcConf.enPullResistor = PortPullResistorNone;
    PpcConf.enGpioInitOutputLevel = PortGpioLow;
    Port_SetPinConfig(u8PortIndex, u8PinNumber, &PpcConf);
    Port_EnableInput();
    
    //ADC12B0_RT = 120;
    //ADC12B0_ST0 = 36;
    //ADC12B0_ST1 = 36;
    //ADC12B0_ST2 = 36;
    //ADC12B0_ST3 = 36;
    ADC12B0_RT = 12;
    ADC12B0_ST0 = 10;
    ADC12B0_ST1 = 10;
    ADC12B0_ST2 = 10;
    ADC12B0_ST3 = 10;
    ADC12B0_CT = 8;
    ADC12B0_CTRL_RES = 0;
    ADC12B0_CTRL_DBGE = 0;
    ADC12B0_CTRL_ACHMD = 0;
    ADC12B0_CTRL_FSMD = 0;
    ADC12B0_CTRL_PDDMD = 1;
    
    switch(u8AnNumber)
    {
        case 0:
            ADC12B0_CHCTRL0_ANIN = 0;
            ADC12B0_CHCTRL0_TRGTYP = 0;
            ADC12B0_CHCTRL0_CHPRI = 0;
            ADC12B0_CHCTRL0_RSMRST = 1;
            ADC12B0_CHCTRL0_DP = 0;
            ADC12B0_CHCTRL0_SMTIME = 0;
            ADC12B0_CDONEIRQE0_CDONEIRQE0 = 0;
            ADC12B0_GRPIRQE0_GRPIRQE0 = 0;
            break;
        case 1:
                ADC12B0_CHCTRL1_ANIN = 1;
            ADC12B0_CHCTRL1_TRGTYP = 0;
            ADC12B0_CHCTRL1_CHPRI = 0;
            ADC12B0_CHCTRL1_RSMRST = 1;
            ADC12B0_CHCTRL1_DP = 0;
            ADC12B0_CHCTRL1_SMTIME = 0;
            ADC12B0_CDONEIRQE0_CDONEIRQE1 = 0;
            ADC12B0_GRPIRQE0_GRPIRQE1 = 0;
            break;
        case 2:
                ADC12B0_CHCTRL2_ANIN = 2;
            ADC12B0_CHCTRL2_TRGTYP = 0;
            ADC12B0_CHCTRL2_CHPRI = 0;
            ADC12B0_CHCTRL2_RSMRST = 1;
            ADC12B0_CHCTRL2_DP = 0;
            ADC12B0_CHCTRL2_SMTIME = 0;
            ADC12B0_CDONEIRQE0_CDONEIRQE2 = 0;
            ADC12B0_GRPIRQE0_GRPIRQE2 = 0;
            break;
        case 3:
                ADC12B0_CHCTRL3_ANIN = 3;
            ADC12B0_CHCTRL3_TRGTYP = 0;
            ADC12B0_CHCTRL3_CHPRI = 0;
            ADC12B0_CHCTRL3_RSMRST = 1;
            ADC12B0_CHCTRL3_DP = 0;
            ADC12B0_CHCTRL3_SMTIME = 0;
            ADC12B0_CDONEIRQE0_CDONEIRQE3 = 0;
            ADC12B0_GRPIRQE0_GRPIRQE3 = 0;
            break;
        case 4:
                ADC12B0_CHCTRL4_ANIN = 4;
            ADC12B0_CHCTRL4_TRGTYP = 0;
            ADC12B0_CHCTRL4_CHPRI = 0;
            ADC12B0_CHCTRL4_RSMRST = 1;
            ADC12B0_CHCTRL4_DP = 0;
            ADC12B0_CHCTRL4_SMTIME = 0;
            ADC12B0_CDONEIRQE0_CDONEIRQE4 = 0;
            ADC12B0_GRPIRQE0_GRPIRQE4 = 0;
            break;
        case 5:
                ADC12B0_CHCTRL5_ANIN = 5;
            ADC12B0_CHCTRL5_TRGTYP = 0;
            ADC12B0_CHCTRL5_CHPRI = 0;
            ADC12B0_CHCTRL5_RSMRST = 1;
            ADC12B0_CHCTRL5_DP = 0;
            ADC12B0_CHCTRL5_SMTIME = 0;
            ADC12B0_CDONEIRQE0_CDONEIRQE5 = 0;
            ADC12B0_GRPIRQE0_GRPIRQE5 = 0;
            break;
        case 6:
                ADC12B0_CHCTRL6_ANIN = 6;
            ADC12B0_CHCTRL6_TRGTYP = 0;
            ADC12B0_CHCTRL6_CHPRI = 0;
            ADC12B0_CHCTRL6_RSMRST = 1;
            ADC12B0_CHCTRL6_DP = 0;
            ADC12B0_CHCTRL6_SMTIME = 0;
            ADC12B0_CDONEIRQE0_CDONEIRQE6 = 0;
            ADC12B0_GRPIRQE0_GRPIRQE6 = 0;
            break;
        case 7:
                ADC12B0_CHCTRL7_ANIN = 7;
            ADC12B0_CHCTRL7_TRGTYP = 0;
            ADC12B0_CHCTRL7_CHPRI = 0;
            ADC12B0_CHCTRL7_RSMRST = 1;
            ADC12B0_CHCTRL7_DP = 0;
            ADC12B0_CHCTRL7_SMTIME = 0;
            ADC12B0_CDONEIRQE0_CDONEIRQE7 = 0;
            ADC12B0_GRPIRQE0_GRPIRQE7 = 0;
            break;
        case 8:
                ADC12B0_CHCTRL8_ANIN = 8;
            ADC12B0_CHCTRL8_TRGTYP = 0;
            ADC12B0_CHCTRL8_CHPRI = 0;
            ADC12B0_CHCTRL8_RSMRST = 1;
            ADC12B0_CHCTRL8_DP = 0;
            ADC12B0_CHCTRL8_SMTIME = 0;
            ADC12B0_CDONEIRQE0_CDONEIRQE8 = 0;
            ADC12B0_GRPIRQE0_GRPIRQE8 = 0;
            break;
        case 9:
                ADC12B0_CHCTRL9_ANIN = 9;
            ADC12B0_CHCTRL9_TRGTYP = 0;
            ADC12B0_CHCTRL9_CHPRI = 0;
            ADC12B0_CHCTRL9_RSMRST = 1;
            ADC12B0_CHCTRL9_DP = 0;
            ADC12B0_CHCTRL9_SMTIME = 0;
            ADC12B0_CDONEIRQE0_CDONEIRQE9 = 0;
            ADC12B0_GRPIRQE0_GRPIRQE9 = 0;
            break;
        case 10:
                ADC12B0_CHCTRL10_ANIN = 10;
            ADC12B0_CHCTRL10_TRGTYP = 0;
            ADC12B0_CHCTRL10_CHPRI = 0;
            ADC12B0_CHCTRL10_RSMRST = 1;
            ADC12B0_CHCTRL10_DP = 0;
            ADC12B0_CHCTRL10_SMTIME = 0;
            ADC12B0_CDONEIRQE0_CDONEIRQE10 = 0;
            ADC12B0_GRPIRQE0_GRPIRQE10 = 0;
            break;
        case 11:
                ADC12B0_CHCTRL11_ANIN = 11;
            ADC12B0_CHCTRL11_TRGTYP = 0;
            ADC12B0_CHCTRL11_CHPRI = 0;
            ADC12B0_CHCTRL11_RSMRST = 1;
            ADC12B0_CHCTRL11_DP = 0;
            ADC12B0_CHCTRL11_SMTIME = 0;
            ADC12B0_CDONEIRQE0_CDONEIRQE11 = 0;
            ADC12B0_GRPIRQE0_GRPIRQE11 = 0;
            break;
        case 12:
                ADC12B0_CHCTRL12_ANIN = 12;
            ADC12B0_CHCTRL12_TRGTYP = 0;
            ADC12B0_CHCTRL12_CHPRI = 0;
            ADC12B0_CHCTRL12_RSMRST = 1;
            ADC12B0_CHCTRL12_DP = 0;
            ADC12B0_CHCTRL12_SMTIME = 0;
            ADC12B0_CDONEIRQE0_CDONEIRQE12 = 0;
            ADC12B0_GRPIRQE0_GRPIRQE12 = 0;
            break;
        case 13:
                ADC12B0_CHCTRL13_ANIN = 13;
            ADC12B0_CHCTRL13_TRGTYP = 0;
            ADC12B0_CHCTRL13_CHPRI = 0;
            ADC12B0_CHCTRL13_RSMRST = 1;
            ADC12B0_CHCTRL13_DP = 0;
            ADC12B0_CHCTRL13_SMTIME = 0;
            ADC12B0_CDONEIRQE0_CDONEIRQE13 = 0;
            ADC12B0_GRPIRQE0_GRPIRQE13 = 0;
            break;
        case 14:
                ADC12B0_CHCTRL14_ANIN = 14;
            ADC12B0_CHCTRL14_TRGTYP = 0;
            ADC12B0_CHCTRL14_CHPRI = 0;
            ADC12B0_CHCTRL14_RSMRST = 1;
            ADC12B0_CHCTRL14_DP = 0;
            ADC12B0_CHCTRL14_SMTIME = 0;
            ADC12B0_CDONEIRQE0_CDONEIRQE14 = 0;
            ADC12B0_GRPIRQE0_GRPIRQE14 = 0;
            break;
        case 15:
                ADC12B0_CHCTRL15_ANIN = 15;
            ADC12B0_CHCTRL15_TRGTYP = 0;
            ADC12B0_CHCTRL15_CHPRI = 0;
            ADC12B0_CHCTRL15_RSMRST = 1;
            ADC12B0_CHCTRL15_DP = 0;
            ADC12B0_CHCTRL15_SMTIME = 0;
            ADC12B0_CDONEIRQE0_CDONEIRQE15 = 0;
            ADC12B0_GRPIRQE0_GRPIRQE15 = 0;
            break;
        case 16:
                ADC12B0_CHCTRL16_ANIN = 16;
            ADC12B0_CHCTRL16_TRGTYP = 0;
            ADC12B0_CHCTRL16_CHPRI = 0;
            ADC12B0_CHCTRL16_RSMRST = 1;
            ADC12B0_CHCTRL16_DP = 0;
            ADC12B0_CHCTRL16_SMTIME = 0;
            ADC12B0_CDONEIRQE0_CDONEIRQE16 = 0;
            ADC12B0_GRPIRQE0_GRPIRQE16 = 0;
            break;
        case 17:
                ADC12B0_CHCTRL17_ANIN = 17;
            ADC12B0_CHCTRL17_TRGTYP = 0;
            ADC12B0_CHCTRL17_CHPRI = 0;
            ADC12B0_CHCTRL17_RSMRST = 1;
            ADC12B0_CHCTRL17_DP = 0;
            ADC12B0_CHCTRL17_SMTIME = 0;
            ADC12B0_CDONEIRQE0_CDONEIRQE17 = 0;
            ADC12B0_GRPIRQE0_GRPIRQE17 = 0;
            break;
        case 18:
                ADC12B0_CHCTRL18_ANIN = 18;
            ADC12B0_CHCTRL18_TRGTYP = 0;
            ADC12B0_CHCTRL18_CHPRI = 0;
            ADC12B0_CHCTRL18_RSMRST = 1;
            ADC12B0_CHCTRL18_DP = 0;
            ADC12B0_CHCTRL18_SMTIME = 0;
            ADC12B0_CDONEIRQE0_CDONEIRQE18 = 0;
            ADC12B0_GRPIRQE0_GRPIRQE18 = 0;
            break;
        case 19:
                ADC12B0_CHCTRL19_ANIN = 19;
            ADC12B0_CHCTRL19_TRGTYP = 0;
            ADC12B0_CHCTRL19_CHPRI = 0;
            ADC12B0_CHCTRL19_RSMRST = 1;
            ADC12B0_CHCTRL19_DP = 0;
            ADC12B0_CHCTRL19_SMTIME = 0;
            ADC12B0_CDONEIRQE0_CDONEIRQE19 = 0;
            ADC12B0_GRPIRQE0_GRPIRQE19 = 0;
            break;
        case 20:
                ADC12B0_CHCTRL20_ANIN = 20;
            ADC12B0_CHCTRL20_TRGTYP = 0;
            ADC12B0_CHCTRL20_CHPRI = 0;
            ADC12B0_CHCTRL20_RSMRST = 1;
            ADC12B0_CHCTRL20_DP = 0;
            ADC12B0_CHCTRL20_SMTIME = 0;
            ADC12B0_CDONEIRQE0_CDONEIRQE20 = 0;
            ADC12B0_GRPIRQE0_GRPIRQE20 = 0;
            break;
        case 21:
                ADC12B0_CHCTRL21_ANIN = 21;
            ADC12B0_CHCTRL21_TRGTYP = 0;
            ADC12B0_CHCTRL21_CHPRI = 0;
            ADC12B0_CHCTRL21_RSMRST = 1;
            ADC12B0_CHCTRL21_DP = 0;
            ADC12B0_CHCTRL21_SMTIME = 0;
            ADC12B0_CDONEIRQE0_CDONEIRQE21 = 0;
            ADC12B0_GRPIRQE0_GRPIRQE21 = 0;
            break;
        case 22:
                ADC12B0_CHCTRL22_ANIN = 22;
            ADC12B0_CHCTRL22_TRGTYP = 0;
            ADC12B0_CHCTRL22_CHPRI = 0;
            ADC12B0_CHCTRL22_RSMRST = 1;
            ADC12B0_CHCTRL22_DP = 0;
            ADC12B0_CHCTRL22_SMTIME = 0;
            ADC12B0_CDONEIRQE0_CDONEIRQE22 = 0;
            ADC12B0_GRPIRQE0_GRPIRQE22 = 0;
            break;
        case 23:
                ADC12B0_CHCTRL23_ANIN = 23;
            ADC12B0_CHCTRL23_TRGTYP = 0;
            ADC12B0_CHCTRL23_CHPRI = 0;
            ADC12B0_CHCTRL23_RSMRST = 1;
            ADC12B0_CHCTRL23_DP = 0;
            ADC12B0_CHCTRL23_SMTIME = 0;
            ADC12B0_CDONEIRQE0_CDONEIRQE23 = 0;
            ADC12B0_GRPIRQE0_GRPIRQE23 = 0;
            break;
        case 24:
                ADC12B0_CHCTRL24_ANIN = 24;
            ADC12B0_CHCTRL24_TRGTYP = 0;
            ADC12B0_CHCTRL24_CHPRI = 0;
            ADC12B0_CHCTRL24_RSMRST = 1;
            ADC12B0_CHCTRL24_DP = 0;
            ADC12B0_CHCTRL24_SMTIME = 0;
            ADC12B0_CDONEIRQE0_CDONEIRQE24 = 0;
            ADC12B0_GRPIRQE0_GRPIRQE24 = 0;
            break;
        case 25:
                ADC12B0_CHCTRL25_ANIN = 25;
            ADC12B0_CHCTRL25_TRGTYP = 0;
            ADC12B0_CHCTRL25_CHPRI = 0;
            ADC12B0_CHCTRL25_RSMRST = 1;
            ADC12B0_CHCTRL25_DP = 0;
            ADC12B0_CHCTRL25_SMTIME = 0;
            ADC12B0_CDONEIRQE0_CDONEIRQE25 = 0;
            ADC12B0_GRPIRQE0_GRPIRQE25 = 0;
            break;
        case 26:
                ADC12B0_CHCTRL26_ANIN = 26;
            ADC12B0_CHCTRL26_TRGTYP = 0;
            ADC12B0_CHCTRL26_CHPRI = 0;
            ADC12B0_CHCTRL26_RSMRST = 1;
            ADC12B0_CHCTRL26_DP = 0;
            ADC12B0_CHCTRL26_SMTIME = 0;
            ADC12B0_CDONEIRQE0_CDONEIRQE26 = 0;
            ADC12B0_GRPIRQE0_GRPIRQE26 = 0;
            break;
        case 27:
                ADC12B0_CHCTRL27_ANIN = 27;
            ADC12B0_CHCTRL27_TRGTYP = 0;
            ADC12B0_CHCTRL27_CHPRI = 0;
            ADC12B0_CHCTRL27_RSMRST = 1;
            ADC12B0_CHCTRL27_DP = 0;
            ADC12B0_CHCTRL27_SMTIME = 0;
            ADC12B0_CDONEIRQE0_CDONEIRQE27 = 0;
            ADC12B0_GRPIRQE0_GRPIRQE27 = 0;
            break;
        case 28:
                ADC12B0_CHCTRL28_ANIN = 28;
            ADC12B0_CHCTRL28_TRGTYP = 0;
            ADC12B0_CHCTRL28_CHPRI = 0;
            ADC12B0_CHCTRL28_RSMRST = 1;
            ADC12B0_CHCTRL28_DP = 0;
            ADC12B0_CHCTRL28_SMTIME = 0;
            ADC12B0_CDONEIRQE0_CDONEIRQE28 = 0;
            ADC12B0_GRPIRQE0_GRPIRQE28 = 0;
            break;
        case 29:
                ADC12B0_CHCTRL29_ANIN = 29;
            ADC12B0_CHCTRL29_TRGTYP = 0;
            ADC12B0_CHCTRL29_CHPRI = 0;
            ADC12B0_CHCTRL29_RSMRST = 1;
            ADC12B0_CHCTRL29_DP = 0;
            ADC12B0_CHCTRL29_SMTIME = 0;
            ADC12B0_CDONEIRQE0_CDONEIRQE29 = 0;
            ADC12B0_GRPIRQE0_GRPIRQE29 = 0;
            break;
        case 30:
                ADC12B0_CHCTRL30_ANIN = 30;
            ADC12B0_CHCTRL30_TRGTYP = 0;
            ADC12B0_CHCTRL30_CHPRI = 0;
            ADC12B0_CHCTRL30_RSMRST = 1;
            ADC12B0_CHCTRL30_DP = 0;
            ADC12B0_CHCTRL30_SMTIME = 0;
            ADC12B0_CDONEIRQE0_CDONEIRQE30 = 0;
            ADC12B0_GRPIRQE0_GRPIRQE30 = 0;
            break;
        case 31:
                ADC12B0_CHCTRL31_ANIN = 31;
            ADC12B0_CHCTRL31_TRGTYP = 0;
            ADC12B0_CHCTRL31_CHPRI = 0;
            ADC12B0_CHCTRL31_RSMRST = 1;
            ADC12B0_CHCTRL31_DP = 0;
            ADC12B0_CHCTRL31_SMTIME = 0;
            ADC12B0_CDONEIRQE0_CDONEIRQE31 = 0;
            ADC12B0_GRPIRQE0_GRPIRQE31 = 0;
            break;
        case 32:
                ADC12B0_CHCTRL32_ANIN = 32;
            ADC12B0_CHCTRL32_TRGTYP = 0;
            ADC12B0_CHCTRL32_CHPRI = 0;
            ADC12B0_CHCTRL32_RSMRST = 1;
            ADC12B0_CHCTRL32_DP = 0;
            ADC12B0_CHCTRL32_SMTIME = 0;
            ADC12B0_CDONEIRQE1_CDONEIRQE32 = 0;
            ADC12B0_GRPIRQE1_GRPIRQE32 = 0;
            break;
        case 33:
                ADC12B0_CHCTRL33_ANIN = 33;
            ADC12B0_CHCTRL33_TRGTYP = 0;
            ADC12B0_CHCTRL33_CHPRI = 0;
            ADC12B0_CHCTRL33_RSMRST = 1;
            ADC12B0_CHCTRL33_DP = 0;
            ADC12B0_CHCTRL33_SMTIME = 0;
            ADC12B0_CDONEIRQE1_CDONEIRQE33 = 0;
            ADC12B0_GRPIRQE1_GRPIRQE33 = 0;
            break;
        case 34:
                ADC12B0_CHCTRL34_ANIN = 34;
            ADC12B0_CHCTRL34_TRGTYP = 0;
            ADC12B0_CHCTRL34_CHPRI = 0;
            ADC12B0_CHCTRL34_RSMRST = 1;
            ADC12B0_CHCTRL34_DP = 0;
            ADC12B0_CHCTRL34_SMTIME = 0;
            ADC12B0_CDONEIRQE1_CDONEIRQE34 = 0;
            ADC12B0_GRPIRQE1_GRPIRQE34 = 0;
            break;
        case 35:
                ADC12B0_CHCTRL35_ANIN = 35;
            ADC12B0_CHCTRL35_TRGTYP = 0;
            ADC12B0_CHCTRL35_CHPRI = 0;
            ADC12B0_CHCTRL35_RSMRST = 1;
            ADC12B0_CHCTRL35_DP = 0;
            ADC12B0_CHCTRL35_SMTIME = 0;
            ADC12B0_CDONEIRQE1_CDONEIRQE35 = 0;
            ADC12B0_GRPIRQE1_GRPIRQE35 = 0;
            break;
        case 36:
                ADC12B0_CHCTRL36_ANIN = 36;
            ADC12B0_CHCTRL36_TRGTYP = 0;
            ADC12B0_CHCTRL36_CHPRI = 0;
            ADC12B0_CHCTRL36_RSMRST = 1;
            ADC12B0_CHCTRL36_DP = 0;
            ADC12B0_CHCTRL36_SMTIME = 0;
            ADC12B0_CDONEIRQE1_CDONEIRQE36 = 0;
            ADC12B0_GRPIRQE1_GRPIRQE36 = 0;
            break;
        case 37:
                ADC12B0_CHCTRL37_ANIN = 37;
            ADC12B0_CHCTRL37_TRGTYP = 0;
            ADC12B0_CHCTRL37_CHPRI = 0;
            ADC12B0_CHCTRL37_RSMRST = 1;
            ADC12B0_CHCTRL37_DP = 0;
            ADC12B0_CHCTRL37_SMTIME = 0;
            ADC12B0_CDONEIRQE1_CDONEIRQE37 = 0;
            ADC12B0_GRPIRQE1_GRPIRQE37 = 0;
            break;
        case 38:
                ADC12B0_CHCTRL38_ANIN = 38;
            ADC12B0_CHCTRL38_TRGTYP = 0;
            ADC12B0_CHCTRL38_CHPRI = 0;
            ADC12B0_CHCTRL38_RSMRST = 1;
            ADC12B0_CHCTRL38_DP = 0;
            ADC12B0_CHCTRL38_SMTIME = 0;
            ADC12B0_CDONEIRQE1_CDONEIRQE38 = 0;
            ADC12B0_GRPIRQE1_GRPIRQE38 = 0;
            break;
        case 39:
                ADC12B0_CHCTRL39_ANIN = 39;
            ADC12B0_CHCTRL39_TRGTYP = 0;
            ADC12B0_CHCTRL39_CHPRI = 0;
            ADC12B0_CHCTRL39_RSMRST = 1;
            ADC12B0_CHCTRL39_DP = 0;
            ADC12B0_CHCTRL39_SMTIME = 0;
            ADC12B0_CDONEIRQE1_CDONEIRQE39 = 0;
            ADC12B0_GRPIRQE1_GRPIRQE39 = 0;
            break;
        case 40:
                ADC12B0_CHCTRL40_ANIN = 40;
            ADC12B0_CHCTRL40_TRGTYP = 0;
            ADC12B0_CHCTRL40_CHPRI = 0;
            ADC12B0_CHCTRL40_RSMRST = 1;
            ADC12B0_CHCTRL40_DP = 0;
            ADC12B0_CHCTRL40_SMTIME = 0;
            ADC12B0_CDONEIRQE1_CDONEIRQE40 = 0;
            ADC12B0_GRPIRQE1_GRPIRQE40 = 0;
            break;
        case 41:
                ADC12B0_CHCTRL41_ANIN = 41;
            ADC12B0_CHCTRL41_TRGTYP = 0;
            ADC12B0_CHCTRL41_CHPRI = 0;
            ADC12B0_CHCTRL41_RSMRST = 1;
            ADC12B0_CHCTRL41_DP = 0;
            ADC12B0_CHCTRL41_SMTIME = 0;
            ADC12B0_CDONEIRQE1_CDONEIRQE41 = 0;
            ADC12B0_GRPIRQE1_GRPIRQE41 = 0;
            break;
        case 42:
                ADC12B0_CHCTRL42_ANIN = 42;
            ADC12B0_CHCTRL42_TRGTYP = 0;
            ADC12B0_CHCTRL42_CHPRI = 0;
            ADC12B0_CHCTRL42_RSMRST = 1;
            ADC12B0_CHCTRL42_DP = 0;
            ADC12B0_CHCTRL42_SMTIME = 0;
            ADC12B0_CDONEIRQE1_CDONEIRQE42 = 0;
            ADC12B0_GRPIRQE1_GRPIRQE42 = 0;
            break;
        case 43:
                ADC12B0_CHCTRL43_ANIN = 43;
            ADC12B0_CHCTRL43_TRGTYP = 0;
            ADC12B0_CHCTRL43_CHPRI = 0;
            ADC12B0_CHCTRL43_RSMRST = 1;
            ADC12B0_CHCTRL43_DP = 0;
            ADC12B0_CHCTRL43_SMTIME = 0;
            ADC12B0_CDONEIRQE1_CDONEIRQE43 = 0;
            ADC12B0_GRPIRQE1_GRPIRQE43 = 0;
            break;
        case 44:
                ADC12B0_CHCTRL44_ANIN = 44;
            ADC12B0_CHCTRL44_TRGTYP = 0;
            ADC12B0_CHCTRL44_CHPRI = 0;
            ADC12B0_CHCTRL44_RSMRST = 1;
            ADC12B0_CHCTRL44_DP = 0;
            ADC12B0_CHCTRL44_SMTIME = 0;
            ADC12B0_CDONEIRQE1_CDONEIRQE44 = 0;
            ADC12B0_GRPIRQE1_GRPIRQE44 = 0;
            break;
        case 45:
                ADC12B0_CHCTRL45_ANIN = 45;
            ADC12B0_CHCTRL45_TRGTYP = 0;
            ADC12B0_CHCTRL45_CHPRI = 0;
            ADC12B0_CHCTRL45_RSMRST = 1;
            ADC12B0_CHCTRL45_DP = 0;
            ADC12B0_CHCTRL45_SMTIME = 0;
            ADC12B0_CDONEIRQE1_CDONEIRQE45 = 0;
            ADC12B0_GRPIRQE1_GRPIRQE44 = 0;
            break;
        case 46:
                ADC12B0_CHCTRL46_ANIN = 46;
            ADC12B0_CHCTRL46_TRGTYP = 0;
            ADC12B0_CHCTRL46_CHPRI = 0;
            ADC12B0_CHCTRL46_RSMRST = 1;
            ADC12B0_CHCTRL46_DP = 0;
            ADC12B0_CHCTRL46_SMTIME = 0;
            ADC12B0_CDONEIRQE1_CDONEIRQE46 = 0;
            ADC12B0_GRPIRQE1_GRPIRQE46 = 0;
            break;
        case 47:
                ADC12B0_CHCTRL47_ANIN = 47;
            ADC12B0_CHCTRL47_TRGTYP = 0;
            ADC12B0_CHCTRL47_CHPRI = 0;
            ADC12B0_CHCTRL47_RSMRST = 1;
            ADC12B0_CHCTRL47_DP = 0;
            ADC12B0_CHCTRL47_SMTIME = 0;
            ADC12B0_CDONEIRQE1_CDONEIRQE47 = 0;
            ADC12B0_GRPIRQE1_GRPIRQE47 = 0;
            break;
        case 48:
                ADC12B0_CHCTRL48_ANIN = 48;
            ADC12B0_CHCTRL48_TRGTYP = 0;
            ADC12B0_CHCTRL48_CHPRI = 0;
            ADC12B0_CHCTRL48_RSMRST = 1;
            ADC12B0_CHCTRL48_DP = 0;
            ADC12B0_CHCTRL48_SMTIME = 0;
            ADC12B0_CDONEIRQE1_CDONEIRQE48 = 0;
            ADC12B0_GRPIRQE1_GRPIRQE48 = 0;
            break;
        case 49:
                ADC12B0_CHCTRL49_ANIN = 49;
            ADC12B0_CHCTRL49_TRGTYP = 0;
            ADC12B0_CHCTRL49_CHPRI = 0;
            ADC12B0_CHCTRL49_RSMRST = 1;
            ADC12B0_CHCTRL49_DP = 0;
            ADC12B0_CHCTRL49_SMTIME = 0;
            ADC12B0_CDONEIRQE1_CDONEIRQE49 = 0;
            ADC12B0_GRPIRQE1_GRPIRQE49 = 0;
            break;
        case 50:
                ADC12B0_CHCTRL50_ANIN = 50;
            ADC12B0_CHCTRL50_TRGTYP = 0;
            ADC12B0_CHCTRL50_CHPRI = 0;
            ADC12B0_CHCTRL50_RSMRST = 1;
            ADC12B0_CHCTRL50_DP = 0;
            ADC12B0_CHCTRL50_SMTIME = 0;
            ADC12B0_CDONEIRQE1_CDONEIRQE50 = 0;
            ADC12B0_GRPIRQE1_GRPIRQE50 = 0;
            break;
        case 51:
                ADC12B0_CHCTRL51_ANIN = 51;
            ADC12B0_CHCTRL51_TRGTYP = 0;
            ADC12B0_CHCTRL51_CHPRI = 0;
            ADC12B0_CHCTRL51_RSMRST = 1;
            ADC12B0_CHCTRL51_DP = 0;
            ADC12B0_CHCTRL51_SMTIME = 0;
            ADC12B0_CDONEIRQE1_CDONEIRQE51 = 0;
            ADC12B0_GRPIRQE1_GRPIRQE51 = 0;
            break;
        case 52:
                ADC12B0_CHCTRL52_ANIN = 52;
            ADC12B0_CHCTRL52_TRGTYP = 0;
            ADC12B0_CHCTRL52_CHPRI = 0;
            ADC12B0_CHCTRL52_RSMRST = 1;
            ADC12B0_CHCTRL52_DP = 0;
            ADC12B0_CHCTRL52_SMTIME = 0;
            ADC12B0_CDONEIRQE1_CDONEIRQE52 = 0;
            ADC12B0_GRPIRQE1_GRPIRQE52 = 0;
            break;
        case 53:
                ADC12B0_CHCTRL53_ANIN = 53;
            ADC12B0_CHCTRL53_TRGTYP = 0;
            ADC12B0_CHCTRL53_CHPRI = 0;
            ADC12B0_CHCTRL53_RSMRST = 1;
            ADC12B0_CHCTRL53_DP = 0;
            ADC12B0_CHCTRL53_SMTIME = 0;
            ADC12B0_CDONEIRQE1_CDONEIRQE53 = 0;
            ADC12B0_GRPIRQE1_GRPIRQE53 = 0;
            break;
        case 54:
                ADC12B0_CHCTRL54_ANIN = 54;
            ADC12B0_CHCTRL54_TRGTYP = 0;
            ADC12B0_CHCTRL54_CHPRI = 0;
            ADC12B0_CHCTRL54_RSMRST = 1;
            ADC12B0_CHCTRL54_DP = 0;
            ADC12B0_CHCTRL54_SMTIME = 0;
            ADC12B0_CDONEIRQE1_CDONEIRQE54 = 0;
            ADC12B0_GRPIRQE1_GRPIRQE54 = 0;
            break;
        case 55:
                ADC12B0_CHCTRL55_ANIN = 55;
            ADC12B0_CHCTRL55_TRGTYP = 0;
            ADC12B0_CHCTRL55_CHPRI = 0;
            ADC12B0_CHCTRL55_RSMRST = 1;
            ADC12B0_CHCTRL55_DP = 0;
            ADC12B0_CHCTRL55_SMTIME = 0;
            ADC12B0_CDONEIRQE1_CDONEIRQE55 = 0;
            ADC12B0_GRPIRQE1_GRPIRQE55 = 0;
            break;
        case 56:
                ADC12B0_CHCTRL56_ANIN = 56;
            ADC12B0_CHCTRL56_TRGTYP = 0;
            ADC12B0_CHCTRL56_CHPRI = 0;
            ADC12B0_CHCTRL56_RSMRST = 1;
            ADC12B0_CHCTRL56_DP = 0;
            ADC12B0_CHCTRL56_SMTIME = 0;
            ADC12B0_CDONEIRQE1_CDONEIRQE56 = 0;
            ADC12B0_GRPIRQE1_GRPIRQE56 = 0;
            break;
        case 57:
                ADC12B0_CHCTRL57_ANIN = 57;
            ADC12B0_CHCTRL57_TRGTYP = 0;
            ADC12B0_CHCTRL57_CHPRI = 0;
            ADC12B0_CHCTRL57_RSMRST = 1;
            ADC12B0_CHCTRL57_DP = 0;
            ADC12B0_CHCTRL57_SMTIME = 0;
            ADC12B0_CDONEIRQE1_CDONEIRQE57 = 0;
            ADC12B0_GRPIRQE1_GRPIRQE57 = 0;
            break;
        case 58:
                ADC12B0_CHCTRL58_ANIN = 58;
            ADC12B0_CHCTRL58_TRGTYP = 0;
            ADC12B0_CHCTRL58_CHPRI = 0;
            ADC12B0_CHCTRL58_RSMRST = 1;
            ADC12B0_CHCTRL58_DP = 0;
            ADC12B0_CHCTRL58_SMTIME = 0;
            ADC12B0_CDONEIRQE1_CDONEIRQE58 = 0;
            ADC12B0_GRPIRQE1_GRPIRQE58 = 0;
            break;
        case 59:
                ADC12B0_CHCTRL59_ANIN = 59;
            ADC12B0_CHCTRL59_TRGTYP = 0;
            ADC12B0_CHCTRL59_CHPRI = 0;
            ADC12B0_CHCTRL59_RSMRST = 1;
            ADC12B0_CHCTRL59_DP = 0;
            ADC12B0_CHCTRL59_SMTIME = 0;
            ADC12B0_CDONEIRQE1_CDONEIRQE59 = 0;
            ADC12B0_GRPIRQE1_GRPIRQE59 = 0;
            break;
        case 60:
                ADC12B0_CHCTRL60_ANIN = 60;
            ADC12B0_CHCTRL60_TRGTYP = 0;
            ADC12B0_CHCTRL60_CHPRI = 0;
            ADC12B0_CHCTRL60_RSMRST = 1;
            ADC12B0_CHCTRL60_DP = 0;
            ADC12B0_CHCTRL60_SMTIME = 0;
            ADC12B0_CDONEIRQE1_CDONEIRQE60 = 0;
            ADC12B0_GRPIRQE1_GRPIRQE60 = 0;
            break;
        case 61:
                ADC12B0_CHCTRL61_ANIN = 61;
            ADC12B0_CHCTRL61_TRGTYP = 0;
            ADC12B0_CHCTRL61_CHPRI = 0;
            ADC12B0_CHCTRL61_RSMRST = 1;
            ADC12B0_CHCTRL61_DP = 0;
            ADC12B0_CHCTRL61_SMTIME = 0;
            ADC12B0_CDONEIRQE1_CDONEIRQE61 = 0;
            ADC12B0_GRPIRQE1_GRPIRQE61 = 0;
            break;
        case 62:
                ADC12B0_CHCTRL62_ANIN = 62;
            ADC12B0_CHCTRL62_TRGTYP = 0;
            ADC12B0_CHCTRL62_CHPRI = 0;
            ADC12B0_CHCTRL62_RSMRST = 1;
            ADC12B0_CHCTRL62_DP = 0;
            ADC12B0_CHCTRL62_SMTIME = 0;
            ADC12B0_CDONEIRQE1_CDONEIRQE62 = 0;
            ADC12B0_GRPIRQE1_GRPIRQE62 = 0;
            break;
        case 63:
                ADC12B0_CHCTRL63_ANIN = 63;
            ADC12B0_CHCTRL63_TRGTYP = 0;
            ADC12B0_CHCTRL63_CHPRI = 0;
            ADC12B0_CHCTRL63_RSMRST = 1;
            ADC12B0_CHCTRL63_DP = 0;
            ADC12B0_CHCTRL63_SMTIME = 0;
            ADC12B0_CDONEIRQE1_CDONEIRQE63 = 0;
            ADC12B0_GRPIRQE1_GRPIRQE63 = 0;
            break;
        default:break;
    }
}

void BSP_ADC_Init(uint8_t u8PortIndex,uint8_t u8PinNumber,uint8_t u8AnNumber)
{
    AdcConversionInit(u8PortIndex,u8PinNumber,u8AnNumber);
}


/*-------------------------------------------------------------------------
* Function Name  : ADC_Wakup_Init
* Description    :
* Input          :
* Output         : None
* Return         : None
* onther         :
--------------------------------------------------------------------------*/
void ADC_Wakup_Init(void)
{
    stc_port_pin_config_t stc_port_pin_config1_10= { .enOutputFunction      = PortOutputResourceGPIO,
        .enOutputDrive         = PortOutputDriveA,
        .enPullResistor        = PortPullResistorNone,
        .enInputLevel          = PortInputLevelCmosA,
        .bInputEnable          = TRUE,
        .bNoiseFilterEnable    = FALSE,
        .enGpioDirection       = PortGpioInput,
    .enGpioInitOutputLevel = PortGpioLow};
    Port_SetPinConfig( 1, 10, &stc_port_pin_config1_10 );
    
    stc_eic_config_t      stcEicConfig;
    // EIC Configuration
    stcEicConfig.enRequestEvent               = EicRisingEdge;          // Detect rising edge
    stcEicConfig.bInputNoiseFilterEnable      = TRUE;                   // Enable the noise filter
    stcEicConfig.bDmaRequestEnable            = FALSE;                  // Disable the DMA request
    stcEicConfig.pfnCallback                  = &ADC_Wakup_CallBack;    // using interrupts
    
    Port_SelectInputPort( &RIC.unRESIN268, PortInputPortA );
    
    Eic_Init((stc_eic00_t *) &EIC00, 17, &stcEicConfig);
    
    Eic_Enable((stc_eic00_t *) &EIC00, 17);
    
    Port_EnableInput();
}

/*-------------------------------------------------------------------------
* Function Name  : ADC_Wakup_CallBack
* Description    :
* Input          :
* Output         : None
* Return         : None
* onther         :
--------------------------------------------------------------------------*/
static void ADC_Wakup_CallBack(uint8_t channel)
{
    Eic_Disable((stc_eic00_t *) &EIC00, 17);
}