function y = LI7200agc(x,opt)

%bit12, head detect, 1=LI-7200  -->a(1)
%bit11, Toutlet, 1=ok           -->a(2)
%bit10, Tintlet, 1=ok           -->a(3)
%bit9, Aux_input, 1=ok          -->a(4)
%bit8, DeltaPressure, 1=ok      -->a(5)
%bit7, Chopper, 1=ok            -->a(6)
%bit6, Detector, 1=ok           -->a(7)
%bit5, PLL, 1=ok                -->a(8)
%bit4, Sync, 1=ok               -->a(9)
%bit3 to 0, AGC*6.25+6.25       -->a(10:13)
switch opt
    case 'fulldiagnostic'
        a=dec2bin(x); %Convert decimal to binary number in string
        head_detect=str2num(a(:,1));
        Toutlet=str2num(a(:,2));
        Tinlet=str2num(a(:,3));
        Aux_input=str2num(a(:,4));
        DeltaPressure=str2num(a(:,5));
        Chopper=str2num(a(:,6));
        Detector=str2num(a(:,7));
        PLL=str2num(a(:,8));
        Sync=str2num(a(:,9));
        AGC=bin2dec(a(:,10:13))*6.25+6.25;
        y=[head_detect Toutlet Tinlet Aux_input DeltaPressure Chopper Detector PLL Sync AGC];
    case 'AGConly'
         a=dec2bin(x); %Convert decimal to binary number in string
         AGC=bin2dec(a)*6.25+6.25;
         y=AGC;
end     

