This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Compiler/TMS320F28377D: Help me understand the linking file

Part Number: TMS320F28377D
Other Parts Discussed in Thread: C2000WARE

Tool/software: TI C/C++ Compiler

Hi All,

Note: This is going to be a long post, so please hold back and relax before you read

 

I am posting this query in continuation to the problem posted here (e2e.ti.com/support/microcontrollers/c2000/f/171/t/654370), which I feel has went off track a bit. Also this could be useful to many others  if not me.

I am explaining the issue from start (below) :

  • I am working on a code where the main function calls another function 'lorlineshape()' in a loop, until a threshold condition is satisfied.
  • The function 'lorlineshape()' , imports a set of arrays from a predefined '.c' file (HITRAN)
  • This algorithm was working absolutely fine with smaller dataset. I had successfully run this algorithm with arrays (from HITRAN.c file) of size 31 each.
  • With new requirement I need these HITRAN.c file's arrays to be of size 460 each. so the function 'lorlineshape()' imports a bigger data set, and then processes the data. I have to change a few constants as well for the calculations and with change in theory. but that doesnot change the functioning of the 'lorlineshape()' I have checked it explicitly.
  • This is a test program where I have pulled this function out of the loop and just trying to see if the output is correct.
    // INCLUDING FILES
    #include "F28x_Project.h"     // Device Headerfile and Examples Include File
    #include "math.h"
    interrupt void cpu_timer0_isr(void);
    void ConfigureDAC(void);
    void ConfigureADC(void);
    void SetupADCSoftware(void);
    
    void lorlineshape();                           // function for lorentzian line shape calculation created by neetesh
    
    #define CPUFREQ_MHZ         200
    float samplingFreq_hz = 10000;
    float samplingPeriod_us = 0;
    
    #define RESULTS_BUFFER_SIZE 1024    //buffer for storing conversion results (size must be multiple of 16)
    float Aquire[RESULTS_BUFFER_SIZE];
    Uint16 AdcaResults[16];
    
    Uint16 vmin = 10;
    Uint16 vmax = 3200;
    float dacOutput = 0;
    Uint16 resultsIndex = 0;
    Uint16 Index = 0;
    
    Uint16 c = 0;
    Uint16 d = 0;
    
    
    //************Lorentzian lineshape************************//
    float Temp = 25;                  // Temperature celcius
    float p = 1;                   // pressure in bar
    float X_C2H2 = 0.05;              // concentration in %
    float L = 05;                   // path length in cm
    float simulated[912];          //simulted lorentzian
    //*********************************************************//
    
    float slp = 01;
    
    void main(void)
    {
    // Step 1. Initialize System Control:
    // PLL, WatchDog, enable Peripheral Clocks
    // This example function is found in the F2837xD_SysCtrl.c file.
        InitSysCtrl();
    
    // Step 2. Initialize GPIO:
    // This example function is found in the F2837xD_Gpio.c file and
    // illustrates how to set the GPIO to it's default state.
        InitGpio();
    
    // Step 3. Clear all interrupts and initialize PIE vector table:
    // Disable CPU interrupts
        DINT;
    
    // Initialize the PIE control registers to their default state.
    // The default state is all PIE interrupts disabled and flags
    // are cleared.
    // This function is found in the F2837xD_PieCtrl.c file.
        InitPieCtrl();
    
    // Disable CPU interrupts and clear all CPU interrupt flags:
        IER = 0x0000;
        IFR = 0x0000;
        InitPieVectTable();
    
    //configureDAC(DAC_NUM);
        ConfigureDAC();
    
    //Configure the ADCs and power them up
        ConfigureADC();
    
    //Setup the ADCs for software conversions
        SetupADCSoftware();
    
     //  Map Cpu Timer0 interrupt function to the PIE vector table
         EALLOW;
         PieVectTable.TIMER0_INT = &cpu_timer0_isr;
         EDIS;
    
      // Initialize variables start here....................................................//
    
    
        for(resultsIndex = 0; resultsIndex < 1024; resultsIndex++)
        {
            Aquire[resultsIndex] = 0;
        }
        resultsIndex = 0;
    
        for(resultsIndex = 0; resultsIndex < 912; resultsIndex++)
        {
            simulated[resultsIndex] = 0;
        }
        resultsIndex = 0;
    
    
    //....................initialization of variable completed.......................................//
    
    
        samplingPeriod_us = (1000000.0/samplingFreq_hz);
    
      // Initialize Cpu Timers
          InitCpuTimers();
    
     // Configure Cpu Timer0 to interrupt at specified sampling frequency
         ConfigCpuTimer(&CpuTimer0, CPUFREQ_MHZ, samplingPeriod_us);
    
     // SETTING TIMER REGISTERS AND ENABLING INTERRUPT FOR TIMER REGISTER
     // Start Cpu Timer0
         CpuTimer0Regs.TCR.all = 0x4000;
    
     // Enable interrupt
         IER |= M_INT1;
         PieCtrlRegs.PIEIER1.bit.INTx7 = 1;
         EINT;
         ERTM;
    
    
         //testing the lineshape function
         lorlineshape();
    
     // Infinite loop
      while(1)
      {
    
      }
    }
    
    // Writing ISR for timer 0 interrupt
     interrupt void cpu_timer0_isr(void)
           {
                // CpuTimer1Regs.TCR.all = 0x0000; // Start Cpu Timer1 to indicate begin of interrupt
    
                //convert, wait for completion,store results and start conversions immediately via software, ADCA
                AdcaRegs.ADCSOCFRC1.all = 0x0002; // SOC1   % Check the value
    
                while(AdcaRegs.ADCINTFLG.bit.ADCINT1 == 0);//wait for ADCA to complete, then acknowledge flag
                AdcaRegs.ADCINTFLGCLR.bit.ADCINT1 = 1;
    
                AdcaResults[resultsIndex]= AdcaResultRegs.ADCRESULT1;   //store results
                //Aquire[resultsIndex]= AdcaResultRegs.ADCRESULT1;  //store results
                // AdcaResults = AdcaResultRegs.ADCRESULT1;
             if(resultsIndex<8)
                {
                resultsIndex++;
                //CpuTimer1Regs.TCR.all = 0x0030; // Reload Cpu Timer1
                }
             else
                resultsIndex=0;
    
          DacaRegs.DACVALS.all = dacOutput; //dacoutput to pin ADCIN1/pin11 on board
          //slp = (((vmax*1.24121212)-(vmin*1.24121212))/1000);
          //slp = 2;
             if(Index<1000)
             {
                 Index++;
                 dacOutput = dacOutput + slp;
             }
             else
             {
                 Index =0;
                 dacOutput = vmin*(4096/3300);
    
             }
    
       PieCtrlRegs.PIEACK.all = PIEACK_GROUP1; // Acknowledge this interrupt to receive more interrupts from group 1
         }
    
    
    void ConfigureDAC(void)
    {
       EALLOW;
        DacaRegs.DACCTL.bit.DACREFSEL = 1;   // Use ADC references
        DacaRegs.DACCTL.bit.LOADMODE = 0;    // Load on next SYSCLK
        DacaRegs.DACVALS.all = 0x0800;       // Set mid-range
        DacaRegs.DACOUTEN.bit.DACOUTEN = 1;  // Enable DAC
       EDIS;
    }
    
    void ConfigureADC(void)
    {
        EALLOW;
    
        //write configurations
        AdcaRegs.ADCCTL2.bit.PRESCALE = 6;      //set ADCCLK divider to /4
        AdcaRegs.ADCCTL2.bit.RESOLUTION = 0;    // set resolution 12 bit
        AdcaRegs.ADCCTL2.bit.SIGNALMODE =0;     // set single Mode
        AdcaRegs.ADCCTL1.bit.INTPULSEPOS = 1;  //Set pulse positions to late
        AdcaRegs.ADCCTL1.bit.ADCPWDNZ = 1;     //power up the ADCs
        DELAY_US(1000);                        //delay for 1ms to allow ADC time to power up
    
        EDIS;
    }
    
    
    void SetupADCSoftware(void)
    {
        //ADCA
        //Select the channels to convert and end of conversion flag
        EALLOW;
        AdcaRegs.ADCSOC1CTL.bit.CHSEL = 5;  //SOC1 will convert pin A0
        AdcaRegs.ADCSOC1CTL.bit.ACQPS = 99; //sample window is acqps + 1 SYSCLK cycles
        AdcaRegs.ADCINTSEL1N2.bit.INT1SEL = 1; //end of SOC1 will set INT1 flag
        AdcaRegs.ADCINTSEL1N2.bit.INT1E = 1;   //enable INT1 flag
        AdcaRegs.ADCINTFLGCLR.bit.ADCINT1 = 1; //make sure INT1 flag is cleared
        EDIS;
    
    }
    
    //lorentzian function simulation
    
    void lorlineshape(void)
    {
        //Declare required variables
        //HITRAN 2012 parameters v0,ST0,gamma_air,gamma_self,Ep
        extern float v0[460];            //wavenumber
        extern float ST0[460];           //line intensity
        extern float gamma_air[460];     //Air broadening coeff
        extern float gamma_self[460];    //self broadening coeff
        extern float Ep[460];            // lower state energy
        extern float n[460];            //temp. exponent (for lorentzian lineshape)
        extern float delta[460];    //pressure induce frequency shift (for lorentzian lineshape)
    
        float T = 27;
        float T0 = 296;
        float L = 05;
    
        float QT0 = 0;
        float QT = 0;
    
        float x_C2H2 = 0;
        float x_air = 0;  //mole fraction of Air (1-mole fraction of C2H2) (for Lorentzian lineshape)
    
        float v = 0;
        //float a = 0;
        float c1 = 0;
        float c2 = 0;
        float c3 = 0;
        float c4 = 0;
        double c6 = 0;
    
        float ST = 0;
    
        float phi_lor = 0;
        float gamma_airj = 0;
        float gamma_selfj = 0;
        float v0_shift = 0;
        float delta_nu = 0;
    
        float phi_gauss = 0;
        double Doppler_nu = 0;
    
        float phi_voigt[900];       //  voigt function
        float voigt_width = 0;              //  voigt width
    
        float d = 0;                        //  Some more parameters from Yuvan Liue paper for voigt calculations
        float CL = 0;
        float CG = 0;
        float area = 0;
        float Tn = 0;
    
        #define A  -0.83088E1
        #define B  0.14484E1
        #define C  -0.25946E-2
        #define D  0.84612E-5
    
    
        //#define M 26.04; // molecular weight of C2H2
    
        #define z 1.4388     // z = hc/k
    
        Uint16 i = 0;
        Uint16 j = 0;
    
    //==========================End of declarations===================================//
        for(i = 0; i < 900; i++)
        {
            phi_voigt[i] = 0;
        }
    
        T = T + 273; //Convert Celsius into Kelvin
        QT0 = A + (B*T0) + (C *(T0*T0)) + (D * (T0*T0*T0)); //partition sum
        QT = A + (B*T) + (C *(T*T)) + (D * (T*T*T));
        c3 = (QT0/QT)*(T0/T);
    
        //p = 1; //pressure in bar
        x_C2H2 = X_C2H2/100;
        x_air = 1-x_C2H2;
    
    
    
    
        //Calculate voigt lineshape array for each individual linecenters while adding each
        //individual arrays in another array to get a complete profile
        for(j = 0; j<460; j++)
        {
            c1 = (float)(1-exp(-(double)(z*v0[j]/T)));
            c2 = (float)(1-exp(-(double)(z*v0[j]/T0)));
            c4 = (float)(pow((double)(T0/T),(double)n[j])); // c4 = (T0/T).^n
            c6 = (double)z*(double)Ep[j]*(double)((1/T)-(1/T0));
    
            ST = ST0[j]*(c3*c1/c2)*exp(-c6);
    
            //=====================Lorentzian lineshape==============================//
            gamma_airj = gamma_air[j]*c4;
            gamma_selfj = gamma_self[j]*c4;
            delta_nu = 2*p*(gamma_airj*x_air + gamma_selfj*x_C2H2);  //lorentzian Fwhm
            v0_shift = v0[j] + p*delta[j]; // line center shift , delta is shifting coeff
    
            //=====================Gaussian lineshape================================//
            Doppler_nu = (7.1623E-07)*sqrt((double)(T/44.01))*(double)v0[j];    // gaussian fwhm
    
            for(i = 0; i<900; i++)
            {
                v = 2314.556889 + 0.0015806722222222*i;   //900 points
    
                //Dimensionless parameter from Yuvan Liue et al
                d = (delta_nu - Doppler_nu)/(delta_nu + Doppler_nu);
    
                //Weights for voigt calculations from Yuvan Liue et al
                CL = 11.59196 + 19.0083*d - 7.16976*d*d - 5.08992*d*d*d;
                CG = 5.5182 - 19.16575*d + 6.89559*d*d + 5.32796*d*d*d;
    
                //Voigt width from Olivero & Longbothum
                voigt_width = 0.5*(1.0692*delta_nu + sqrt(delta_nu*delta_nu*0.86639 + 4*Doppler_nu*Doppler_nu));
    
                phi_lor = (voigt_width/6.28318531)/(((v-v0_shift)*(v-v0_shift)) + (voigt_width*voigt_width*0.25));
                phi_gauss = (float)(((2/voigt_width)*0.469718639)*exp(-1*(((v-v0[j])/voigt_width)*((v-v0[j])/voigt_width)*2.77258872)));
    
                phi_voigt[i] = CL*phi_lor + CG*phi_gauss;
    
                area = area + 2*phi_voigt[i];
            }
    
            Tn = (v-2314.556889)/1800; // b-a/n
            area = Tn*area;
    
            //Normalise individual lineshapes and add into an array
            for(i = 0; i<900; i++)
            {
                phi_voigt[i] = phi_voigt[i]/area;
                simulated[i] = simulated[i] + ST*p*x_C2H2*phi_voigt[i]*L;
            }
            area = 0;
    
        }
    
        for(i=0;i<900;i++)
        {
            simulated[i] = exp(-1*simulated[i]);
        }
    
    
    }
    
    //end of the program--------------------//
    
    // INCLUDING FILES
    #include "F28x_Project.h"     // Device Headerfile and Examples Include File
    #include "math.h"
    interrupt void cpu_timer0_isr(void);
    void ConfigureDAC(void);
    void ConfigureADC(void);
    void SetupADCSoftware(void);
    
    void lorlineshape();                           // function for lorentzian line shape calculation created by neetesh
    
    #define CPUFREQ_MHZ         200
    float samplingFreq_hz = 10000;
    float samplingPeriod_us = 0;
    
    #define RESULTS_BUFFER_SIZE 1024    //buffer for storing conversion results (size must be multiple of 16)
    float Aquire[RESULTS_BUFFER_SIZE];
    Uint16 AdcaResults[16];
    
    Uint16 vmin = 10;
    Uint16 vmax = 3200;
    float dacOutput = 0;
    Uint16 resultsIndex = 0;
    Uint16 Index = 0;
    
    Uint16 c = 0;
    Uint16 d = 0;
    
    
    //************Lorentzian lineshape************************//
    float Temp = 25;                  // Temperature celcius
    float p = 1;                   // pressure in bar
    float X_C2H2 = 0.05;              // concentration in %
    float L = 05;                   // path length in cm
    float simulated[912];          //simulted lorentzian
    //*********************************************************//
    
    float slp = 01;
    
    void main(void)
    {
    // Step 1. Initialize System Control:
    // PLL, WatchDog, enable Peripheral Clocks
    // This example function is found in the F2837xD_SysCtrl.c file.
        InitSysCtrl();
    
    // Step 2. Initialize GPIO:
    // This example function is found in the F2837xD_Gpio.c file and
    // illustrates how to set the GPIO to it's default state.
        InitGpio();
    
    // Step 3. Clear all interrupts and initialize PIE vector table:
    // Disable CPU interrupts
        DINT;
    
    // Initialize the PIE control registers to their default state.
    // The default state is all PIE interrupts disabled and flags
    // are cleared.
    // This function is found in the F2837xD_PieCtrl.c file.
        InitPieCtrl();
    
    // Disable CPU interrupts and clear all CPU interrupt flags:
        IER = 0x0000;
        IFR = 0x0000;
        InitPieVectTable();
    
    //configureDAC(DAC_NUM);
        ConfigureDAC();
    
    //Configure the ADCs and power them up
        ConfigureADC();
    
    //Setup the ADCs for software conversions
        SetupADCSoftware();
    
     //  Map Cpu Timer0 interrupt function to the PIE vector table
         EALLOW;
         PieVectTable.TIMER0_INT = &cpu_timer0_isr;
         EDIS;
    
      // Initialize variables start here....................................................//
    
    
        for(resultsIndex = 0; resultsIndex < 1024; resultsIndex++)
        {
            Aquire[resultsIndex] = 0;
        }
        resultsIndex = 0;
    
        for(resultsIndex = 0; resultsIndex < 912; resultsIndex++)
        {
            simulated[resultsIndex] = 0;
        }
        resultsIndex = 0;
    
    
    //....................initialization of variable completed.......................................//
    
    
        samplingPeriod_us = (1000000.0/samplingFreq_hz);
    
      // Initialize Cpu Timers
          InitCpuTimers();
    
     // Configure Cpu Timer0 to interrupt at specified sampling frequency
         ConfigCpuTimer(&CpuTimer0, CPUFREQ_MHZ, samplingPeriod_us);
    
     // SETTING TIMER REGISTERS AND ENABLING INTERRUPT FOR TIMER REGISTER
     // Start Cpu Timer0
         CpuTimer0Regs.TCR.all = 0x4000;
    
     // Enable interrupt
         IER |= M_INT1;
         PieCtrlRegs.PIEIER1.bit.INTx7 = 1;
         EINT;
         ERTM;
    
    
         //testing the lineshape function
         lorlineshape();
    
     // Infinite loop
      while(1)
      {
    
      }
    }
    
    // Writing ISR for timer 0 interrupt
     interrupt void cpu_timer0_isr(void)
           {
                // CpuTimer1Regs.TCR.all = 0x0000; // Start Cpu Timer1 to indicate begin of interrupt
    
                //convert, wait for completion,store results and start conversions immediately via software, ADCA
                AdcaRegs.ADCSOCFRC1.all = 0x0002; // SOC1   % Check the value
    
                while(AdcaRegs.ADCINTFLG.bit.ADCINT1 == 0);//wait for ADCA to complete, then acknowledge flag
                AdcaRegs.ADCINTFLGCLR.bit.ADCINT1 = 1;
    
                AdcaResults[resultsIndex]= AdcaResultRegs.ADCRESULT1;   //store results
                //Aquire[resultsIndex]= AdcaResultRegs.ADCRESULT1;  //store results
                // AdcaResults = AdcaResultRegs.ADCRESULT1;
             if(resultsIndex<8)
                {
                resultsIndex++;
                //CpuTimer1Regs.TCR.all = 0x0030; // Reload Cpu Timer1
                }
             else
                resultsIndex=0;
    
          DacaRegs.DACVALS.all = dacOutput; //dacoutput to pin ADCIN1/pin11 on board
          //slp = (((vmax*1.24121212)-(vmin*1.24121212))/1000);
          //slp = 2;
             if(Index<1000)
             {
                 Index++;
                 dacOutput = dacOutput + slp;
             }
             else
             {
                 Index =0;
                 dacOutput = vmin*(4096/3300);
    
             }
    
       PieCtrlRegs.PIEACK.all = PIEACK_GROUP1; // Acknowledge this interrupt to receive more interrupts from group 1
         }
    
    
    void ConfigureDAC(void)
    {
       EALLOW;
        DacaRegs.DACCTL.bit.DACREFSEL = 1;   // Use ADC references
        DacaRegs.DACCTL.bit.LOADMODE = 0;    // Load on next SYSCLK
        DacaRegs.DACVALS.all = 0x0800;       // Set mid-range
        DacaRegs.DACOUTEN.bit.DACOUTEN = 1;  // Enable DAC
       EDIS;
    }
    
    void ConfigureADC(void)
    {
        EALLOW;
    
        //write configurations
        AdcaRegs.ADCCTL2.bit.PRESCALE = 6;      //set ADCCLK divider to /4
        AdcaRegs.ADCCTL2.bit.RESOLUTION = 0;    // set resolution 12 bit
        AdcaRegs.ADCCTL2.bit.SIGNALMODE =0;     // set single Mode
        AdcaRegs.ADCCTL1.bit.INTPULSEPOS = 1;  //Set pulse positions to late
        AdcaRegs.ADCCTL1.bit.ADCPWDNZ = 1;     //power up the ADCs
        DELAY_US(1000);                        //delay for 1ms to allow ADC time to power up
    
        EDIS;
    }
    
    
    void SetupADCSoftware(void)
    {
        //ADCA
        //Select the channels to convert and end of conversion flag
        EALLOW;
        AdcaRegs.ADCSOC1CTL.bit.CHSEL = 5;  //SOC1 will convert pin A0
        AdcaRegs.ADCSOC1CTL.bit.ACQPS = 99; //sample window is acqps + 1 SYSCLK cycles
        AdcaRegs.ADCINTSEL1N2.bit.INT1SEL = 1; //end of SOC1 will set INT1 flag
        AdcaRegs.ADCINTSEL1N2.bit.INT1E = 1;   //enable INT1 flag
        AdcaRegs.ADCINTFLGCLR.bit.ADCINT1 = 1; //make sure INT1 flag is cleared
        EDIS;
    
    }
    
    //lorentzian function simulation
    
    void lorlineshape(void)
    {
        //Declare required variables
        //HITRAN 2012 parameters v0,ST0,gamma_air,gamma_self,Ep
        extern float v0[460];            //wavenumber
        extern float ST0[460];           //line intensity
        extern float gamma_air[460];     //Air broadening coeff
        extern float gamma_self[460];    //self broadening coeff
        extern float Ep[460];            // lower state energy
        extern float n[460];            //temp. exponent (for lorentzian lineshape)
        extern float delta[460];    //pressure induce frequency shift (for lorentzian lineshape)
    
        float T = 27;
        float T0 = 296;
        float L = 05;
    
        float QT0 = 0;
        float QT = 0;
    
        float x_C2H2 = 0;
        float x_air = 0;  //mole fraction of Air (1-mole fraction of C2H2) (for Lorentzian lineshape)
    
        float v = 0;
        //float a = 0;
        float c1 = 0;
        float c2 = 0;
        float c3 = 0;
        float c4 = 0;
        double c6 = 0;
    
        float ST = 0;
    
        float phi_lor = 0;
        float gamma_airj = 0;
        float gamma_selfj = 0;
        float v0_shift = 0;
        float delta_nu = 0;
    
        float phi_gauss = 0;
        double Doppler_nu = 0;
    
        float phi_voigt[900];       //  voigt function
        float voigt_width = 0;              //  voigt width
    
        float d = 0;                        //  Some more parameters from Yuvan Liue paper for voigt calculations
        float CL = 0;
        float CG = 0;
        float area = 0;
        float Tn = 0;
    
        #define A  -0.83088E1
        #define B  0.14484E1
        #define C  -0.25946E-2
        #define D  0.84612E-5
    
    
        //#define M 26.04; // molecular weight of C2H2
    
        #define z 1.4388     // z = hc/k
    
        Uint16 i = 0;
        Uint16 j = 0;
    
    //==========================End of declarations===================================//
        for(i = 0; i < 900; i++)
        {
            phi_voigt[i] = 0;
        }
    
        T = T + 273; //Convert Celsius into Kelvin
        QT0 = A + (B*T0) + (C *(T0*T0)) + (D * (T0*T0*T0)); //partition sum
        QT = A + (B*T) + (C *(T*T)) + (D * (T*T*T));
        c3 = (QT0/QT)*(T0/T);
    
        //p = 1; //pressure in bar
        x_C2H2 = X_C2H2/100;
        x_air = 1-x_C2H2;
    
    
    
    
        //Calculate voigt lineshape array for each individual linecenters while adding each
        //individual arrays in another array to get a complete profile
        for(j = 0; j<460; j++)
        {
            c1 = (float)(1-exp(-(double)(z*v0[j]/T)));
            c2 = (float)(1-exp(-(double)(z*v0[j]/T0)));
            c4 = (float)(pow((double)(T0/T),(double)n[j])); // c4 = (T0/T).^n
            c6 = (double)z*(double)Ep[j]*(double)((1/T)-(1/T0));
    
            ST = ST0[j]*(c3*c1/c2)*exp(-c6);
    
            //=====================Lorentzian lineshape==============================//
            gamma_airj = gamma_air[j]*c4;
            gamma_selfj = gamma_self[j]*c4;
            delta_nu = 2*p*(gamma_airj*x_air + gamma_selfj*x_C2H2);  //lorentzian Fwhm
            v0_shift = v0[j] + p*delta[j]; // line center shift , delta is shifting coeff
    
            //=====================Gaussian lineshape================================//
            Doppler_nu = (7.1623E-07)*sqrt((double)(T/44.01))*(double)v0[j];    // gaussian fwhm
    
            for(i = 0; i<900; i++)
            {
                v = 2314.556889 + 0.0015806722222222*i;   //900 points
    
                //Dimensionless parameter from Yuvan Liue et al
                d = (delta_nu - Doppler_nu)/(delta_nu + Doppler_nu);
    
                //Weights for voigt calculations from Yuvan Liue et al
                CL = 11.59196 + 19.0083*d - 7.16976*d*d - 5.08992*d*d*d;
                CG = 5.5182 - 19.16575*d + 6.89559*d*d + 5.32796*d*d*d;
    
                //Voigt width from Olivero & Longbothum
                voigt_width = 0.5*(1.0692*delta_nu + sqrt(delta_nu*delta_nu*0.86639 + 4*Doppler_nu*Doppler_nu));
    
                phi_lor = (voigt_width/6.28318531)/(((v-v0_shift)*(v-v0_shift)) + (voigt_width*voigt_width*0.25));
                phi_gauss = (float)(((2/voigt_width)*0.469718639)*exp(-1*(((v-v0[j])/voigt_width)*((v-v0[j])/voigt_width)*2.77258872)));
    
                phi_voigt[i] = CL*phi_lor + CG*phi_gauss;
    
                area = area + 2*phi_voigt[i];
            }
    
            Tn = (v-2314.556889)/1800; // b-a/n
            area = Tn*area;
    
            //Normalise individual lineshapes and add into an array
            for(i = 0; i<900; i++)
            {
                phi_voigt[i] = phi_voigt[i]/area;
                simulated[i] = simulated[i] + ST*p*x_C2H2*phi_voigt[i]*L;
            }
            area = 0;
    
        }
    
        for(i=0;i<900;i++)
        {
            simulated[i] = exp(-1*simulated[i]);
        }
    
    
    }
    
    //end of the program--------------------//
    
     you will see ADC and DAC are initialized but they I expect them to not interfere with the functioning here.
  • Here is the HITRAN.c file 
    /* HITRAN.c */
    
    // table section declaration
    // #pragma DATA_SECTION(QuadratureTable,"QuadratureTableSection")
    
    // quadrature look-up table: contains 5 quadrants of sinusoid data points
    // HITRAN for C2H2
    // line center (wavenumber cm-1)
    const float v0[460] = {2314.556889, 2314.565559, 2314.571374, 2314.571685, 2314.574408, 2314.578412, 2314.579849, 2314.584995, 2314.585739, 2314.586922, 2314.588594, 2314.589115, 2314.590525, 2314.592608, 2314.594641, 2314.59616, 2314.604137, 2314.609833, 2314.613928, 2314.613928, 2314.614655, 2314.61699, 2314.618404, 2314.618469, 2314.620158, 2314.625166, 2314.646848, 2314.648153, 2314.657735, 2314.658096, 2314.659406, 2314.66288, 2314.664363, 2314.666922, 2314.672655, 2314.672914, 2314.678129, 2314.681398, 2314.685223, 2314.688335, 2314.691075, 2314.692309, 2314.694834, 2314.694881, 2314.696534, 2314.698054, 2314.705101, 2314.706081, 2314.707129, 2314.715007, 2314.715147, 2314.715257, 2314.715257, 2314.715715, 2314.7357, 2314.736304, 2314.737647, 2314.739934, 2314.742541, 2314.744697, 2314.745142, 2314.746679, 2314.746729, 2314.75171, 2314.760747, 2314.765384, 2314.765417, 2314.767547, 2314.770241, 2314.779925, 2314.782861, 2314.784876, 2314.790934, 2314.791147, 2314.791504, 2314.80162, 2314.802525, 2314.802526, 2314.804833, 2314.807581, 2314.8103, 2314.811991, 2314.812231, 2314.813557, 2314.814962, 2314.816041, 2314.819989, 2314.81999, 2314.827323, 2314.830055, 2314.830078, 2314.830247, 2314.830295, 2314.832541, 2314.83535, 2314.839363, 2314.841044, 2314.850035, 2314.85111, 2314.851418, 2314.852246, 2314.856083, 2314.858131, 2314.861412, 2314.863164, 2314.864389, 2314.875386, 2314.876266, 2314.877752, 2314.884531, 2314.887954, 2314.888846, 2314.888861, 2314.893558, 2314.896936, 2314.897026, 2314.90589, 2314.906854, 2314.90997, 2314.913681, 2314.913841, 2314.913864, 2314.919183, 2314.923044, 2314.926842, 2314.926916, 2314.930712, 2314.930715, 2314.932407, 2314.939075, 2314.941759, 2314.941769, 2314.94469, 2314.949226, 2314.953279, 2314.954121, 2314.965254, 2314.970229, 2314.971931, 2314.973815, 2314.978475, 2314.984126, 2314.987948, 2314.988792, 2314.988798, 2314.992127, 2314.995938, 2314.998632, 2315.000127, 2315.001673, 2315.001932, 2315.00364, 2315.004366, 2315.005415, 2315.007149, 2315.009402, 2315.01405, 2315.023936, 2315.023973, 2315.029947, 2315.029949, 2315.037471, 2315.038357, 2315.042879, 2315.043597, 2315.046896, 2315.050983, 2315.055993, 2315.055993, 2315.06283, 2315.065221, 2315.065223, 2315.068542, 2315.069109, 2315.070163, 2315.070489, 2315.077334, 2315.077632, 2315.07881, 2315.078952, 2315.081992, 2315.084763, 2315.089688, 2315.094462, 2315.094616, 2315.094617, 2315.098339, 2315.0998, 2315.100065, 2315.104794, 2315.112849, 2315.116028, 2315.117167, 2315.118133, 2315.118133, 2315.120365, 2315.121992, 2315.134955, 2315.134955, 2315.13577, 2315.13577, 2315.138377, 2315.139604, 2315.144806, 2315.149886, 2315.149993, 2315.156452, 2315.161662, 2315.166284, 2315.167771, 2315.173412, 2315.177516, 2315.177517, 2315.179933, 2315.180547, 2315.185687, 2315.187331, 2315.188105, 2315.189057, 2315.191377, 2315.19356, 2315.1995, 2315.21013, 2315.211159, 2315.216318, 2315.218424, 2315.221269, 2315.227726, 2315.228335, 2315.230528, 2315.233773, 2315.234003, 2315.235834, 2315.241263, 2315.24394, 2315.243942, 2315.244687, 2315.245834, 2315.246886, 2315.24837, 2315.251081, 2315.251626, 2315.253508, 2315.256597, 2315.258996, 2315.259053, 2315.260026, 2315.260027, 2315.26269, 2315.265118, 2315.268415, 2315.271194, 2315.276736, 2315.281137, 2315.284979, 2315.289683, 2315.290341, 2315.29251, 2315.297229, 2315.301043, 2315.303496, 2315.305605, 2315.312207, 2315.316136, 2315.318633, 2315.321492, 2315.325734, 2315.327954, 2315.331884, 2315.333453, 2315.340786, 2315.343725, 2315.351038, 2315.351759, 2315.354305, 2315.361286, 2315.363147, 2315.366674, 2315.366772, 2315.369467, 2315.371537, 2315.37231, 2315.376416, 2315.376892, 2315.377088, 2315.377427, 2315.381934, 2315.3881, 2315.3898, 2315.393065, 2315.395168, 2315.396788, 2315.399305, 2315.40253, 2315.413617, 2315.417294, 2315.421988, 2315.422925, 2315.42425, 2315.426195, 2315.432665, 2315.435818, 2315.438088, 2315.438487, 2315.441196, 2315.441546, 2315.443577, 2315.448125, 2315.449538, 2315.453857, 2315.454295, 2315.454842, 2315.455305, 2315.458604, 2315.458604, 2315.474832, 2315.475132, 2315.480148, 2315.485399, 2315.485665, 2315.485946, 2315.486457, 2315.501383, 2315.503202, 2315.504812, 2315.52228, 2315.522585, 2315.523727, 2315.537418, 2315.543108, 2315.54733, 2315.549429, 2315.549525, 2315.5564, 2315.557683, 2315.559137, 2315.563117, 2315.570825, 2315.582945, 2315.583968, 2315.587777, 2315.587782, 2315.59181, 2315.59181, 2315.59681, 2315.600082, 2315.600803, 2315.602527, 2315.605769, 2315.606607, 2315.607833, 2315.614575, 2315.614868, 2315.630226, 2315.639227, 2315.639402, 2315.640633, 2315.64202, 2315.643915, 2315.64939, 2315.650544, 2315.650655, 2315.651431, 2315.65401, 2315.657849, 2315.662164, 2315.662166, 2315.665627, 2315.667623, 2315.670739, 2315.670987, 2315.67411, 2315.676684, 2315.67837, 2315.68213, 2315.682196, 2315.68376, 2315.690699, 2315.691565, 2315.699104, 2315.700591, 2315.702506, 2315.703771, 2315.704323, 2315.704614, 2315.704689, 2315.718393, 2315.719774, 2315.723342, 2315.730503, 2315.731951, 2315.735358, 2315.735358, 2315.737127, 2315.739481, 2315.741031, 2315.744131, 2315.747672, 2315.749426, 2315.752541, 2315.754642, 2315.760425, 2315.761125, 2315.763071, 2315.767471, 2315.768916, 2315.779533, 2315.781609, 2315.78192, 2315.78265, 2315.783708, 2315.789107, 2315.789258, 2315.796408, 2315.799055, 2315.799055, 2315.802446, 2315.802945, 2315.805331, 2315.80538, 2315.806559, 2315.807884, 2315.808024, 2315.81149, 2315.813503, 2315.820284, 2315.820783, 2315.824909, 2315.839384, 2315.841122, 2315.848558, 2315.849549, 2315.870594, 2315.874042, 2315.895728, 2315.898129, 2315.898228, 2315.89991, 2315.907643, 2315.909177, 2315.909578, 2315.909832, 2315.910499, 2315.918866, 2315.92079, 2315.922431, 2315.934561, 2315.942937, 2315.943149, 2315.949746, 2315.950001, 2315.95108, 2315.955764, 2315.95853, 2315.95862, 2315.962734, 2315.963882, 2315.964908, 2315.96809, 2315.972921};
    
    
    
    // ST0 = line intensity*N,   (N = 2.479E19)
    const float ST0[460] = {2.66E-08, 1.80E-08, 1.94E-10, 3.25E-10, 5.58E-06, 1.43E-01, 4.39E-08, 5.90E-09, 5.70E-11, 5.56E-06, 1.54E-10, 5.85E-09, 1.39E-07, 1.22E-10, 1.54E-10, 4.22E-09, 1.34E-04, 4.43E-05, 6.17E-06, 6.17E-06, 3.76E-06, 1.71E-10, 2.01E-06, 2.01E-06, 7.01E-08, 8.27E-05, 4.76E-09, 6.86E-09, 1.57E-10, 3.00E-08, 6.74E-09, 3.48E-10, 3.48E-10, 2.33E-06, 2.99E-08, 2.53E-06, 2.49E-10, 4.07E-10, 2.86E-04, 2.39E-06, 5.67E-07, 1.31E-06, 2.28E-06, 2.28E-06, 1.07E-07, 4.11E-10, 2.39E-06, 1.33E-10, 1.31E-06, 1.68E-02, 1.17E-03, 1.41E-10, 1.98E-10, 1.86E-10, 1.27E-10, 2.97E-05, 1.17E-03, 4.04E-07, 1.37E-06, 5.67E-05, 2.81E-05, 8.50E-04, 1.25E-07, 5.30E-08, 4.09E-10, 2.59E-06, 2.59E-06, 9.42E-11, 2.38E-06, 1.19E-04, 1.92E-10, 7.02E-09, 1.26E-10, 1.26E-10, 1.89E-10, 2.86E-06, 1.84E-06, 1.84E-06, 1.07E-04, 2.75E-09, 4.36E-06, 1.38E-05, 1.39E-10, 1.41E-10, 5.29E-06, 2.88E-10, 1.01E-08, 1.01E-08, 1.90E-08, 2.96E-06, 2.96E-06, 2.20E-10, 2.20E-10, 8.94E-10, 2.78E-10, 8.78E-08, 1.38E-05, 3.30E-09, 5.58E-10, 1.41E-08, 1.02E-04, 9.40E-08, 6.58E-10, 1.65E-04, 7.28E-05, 4.39E-09, 9.38E-08, 1.51E-10, 8.93E-07, 5.51E-10, 1.14E-09, 3.39E-06, 3.39E-06, 3.30E-04, 1.77E-10, 5.51E-10, 6.84E-07, 1.18E-08, 1.38E-09, 2.63E-10, 7.07E-08, 2.86E-10, 1.18E-08, 9.82E-10, 2.74E-06, 5.37E-08, 9.77E-09, 6.97E-09, 2.65E-10, 2.18E-07, 3.92E-06, 3.92E-06, 7.91E-11, 1.37E-09, 1.43E-04, 8.31E-09, 9.40E-05, 3.25E-10, 1.47E-06, 1.47E-04, 1.47E-06, 1.90E-08, 3.89E-10, 4.58E-06, 4.58E-06, 1.28E-10, 1.08E-07, 1.29E-10, 1.84E-08, 1.68E-04, 1.84E-08, 3.57E-10, 6.95E-08, 3.81E-06, 2.09E-10, 6.94E-08, 1.94E-06, 8.20E-06, 1.84E-08, 5.44E-06, 5.44E-06, 8.09E-10, 1.09E-05, 3.41E-06, 4.76E-05, 2.29E-10, 1.23E-04, 2.00E-08, 2.00E-08, 3.65E-11, 6.58E-06, 6.58E-06, 3.52E-10, 5.85E-10, 6.03E-09, 1.98E-04, 1.57E-08, 9.81E-07, 7.32E-08, 7.32E-08, 1.68E-10, 3.42E-10, 6.34E-08, 2.11E-10, 8.23E-06, 8.23E-06, 5.96E-08, 5.95E-08, 4.91E-10, 9.20E-02, 3.27E-09, 8.22E-07, 1.30E-10, 1.08E-05, 1.08E-05, 1.67E-04, 1.04E-10, 2.20E-04, 2.20E-04, 1.56E-05, 1.56E-05, 2.93E-05, 8.59E-07, 1.25E-05, 6.64E-06, 5.25E-06, 3.01E-04, 5.23E-06, 1.38E-10, 3.47E-06, 2.40E-04, 5.72E-06, 5.72E-06, 3.21E-06, 1.12E-10, 3.11E-10, 3.11E-10, 1.13E-10, 1.97E+01, 1.07E-01, 4.50E-10, 1.38E-07, 3.96E-04, 5.72E-04, 3.11E-08, 6.42E-09, 3.45E-03, 4.10E-08, 3.45E-03, 1.04E-03, 1.05E-10, 1.05E-10, 3.74E-10, 6.64E-08, 8.48E-09, 8.48E-09, 1.63E-10, 9.30E-08, 1.33E-07, 1.11E-07, 1.61E-10, 3.69E-10, 2.72E-11, 2.29E-10, 1.88E-10, 1.88E-10, 1.81E-10, 1.29E-10, 1.73E-10, 1.58E-08, 1.42E-06, 1.23E-10, 1.75E-10, 2.43E+00, 1.09E-10, 7.73E-10, 1.21E-08, 7.73E-08, 1.28E-06, 3.94E-06, 2.98E-08, 2.56E-09, 1.65E-04, 5.10E-04, 2.98E-08, 9.84E-07, 3.61E-09, 1.60E-03, 3.46E-10, 2.23E-10, 9.96E-09, 4.71E-08, 2.27E-10, 2.76E-10, 9.96E-09, 1.34E-06, 3.69E-02, 5.12E-09, 2.86E-04, 4.73E-10, 5.07E-09, 2.29E-10, 1.33E-06, 1.10E-09, 2.51E-06, 2.70E-10, 7.08E-11, 4.73E-10, 1.07E-10, 1.23E-09, 2.50E-06, 1.07E-10, 5.98E-07, 8.69E-08, 1.33E-05, 7.86E-07, 8.67E-08, 2.89E-08, 7.20E-06, 3.75E-06, 1.22E-09, 1.48E-01, 1.08E-09, 2.76E-06, 4.87E-09, 1.17E-04, 1.33E-05, 1.77E-10, 3.02E-10, 4.78E-09, 1.95E-07, 8.51E-11, 5.33E-09, 1.84E-06, 1.84E-06, 2.78E-10, 8.31E-06, 6.03E-08, 3.54E-05, 6.03E-08, 6.77E-08, 7.62E-09, 1.53E-03, 2.59E-10, 1.78E-10, 1.18E-06, 3.12E-08, 1.11E-10, 1.73E-08, 8.96E-11, 1.66E-08, 1.66E-08, 1.46E-10, 3.14E-08, 9.06E-11, 1.63E-08, 1.16E-03, 3.42E-06, 1.36E-08, 1.16E-03, 7.19E-09, 1.01E-08, 1.78E-08, 1.78E-08, 7.42E-10, 5.15E-11, 1.02E-07, 1.08E-06, 8.52E-07, 1.47E-10, 7.56E-07, 1.79E-10, 8.48E-08, 6.10E-10, 6.91E-08, 6.91E-08, 4.83E-10, 1.65E-06, 1.81E-02, 1.65E-06, 1.62E-04, 1.12E-10, 4.66E-10, 6.25E-06, 1.61E-04, 7.06E-09, 7.06E-09, 4.38E-06, 1.46E-08, 8.76E-11, 8.76E-11, 3.04E-09, 5.53E-08, 5.52E-08, 1.60E-10, 1.60E-10, 3.32E-10, 6.02E-08, 3.63E-10, 2.15E-09, 1.39E-10, 2.76E-10, 3.58E-06, 2.76E-10, 1.37E-10, 1.22E-05, 1.40E-06, 4.92E-06, 1.02E-08, 4.90E-06, 4.07E-10, 5.29E-06, 5.29E-06, 6.79E-08, 2.95E-09, 6.65E-10, 9.88E-08, 3.46E-11, 1.72E-10, 1.31E-08, 3.42E-07, 2.39E-10, 3.82E-09, 2.05E-10, 3.39E-10, 8.39E-09, 3.15E-06, 8.83E-11, 2.27E-10, 1.95E-10, 8.39E-09, 8.84E-11, 2.32E-10, 1.04E-05, 1.18E-10, 1.65E-10, 7.17E-10, 1.36E-07, 2.32E-04, 2.32E-04, 1.97E-10, 4.43E-05, 7.38E-06, 2.36E-08, 1.15E-10, 5.91E-10, 1.59E-10, 3.94E-10, 7.86E-07, 4.21E-08, 4.04E-10, 5.85E-09, 1.08E-09, 4.04E-10, 9.60E-09, 2.97E-10, 5.09E-06, 7.15E-11, 1.00E-08, 1.50E-10, 1.98E-10, 1.66E-06, 1.08E-09, 2.39E-05, 7.53E-09, 7.23E-11, 7.00E-08, 2.95E-08, 8.00E-08, 5.22E-08, 1.63E-10, 6.89E-07, 5.21E-08, 1.53E-01, 2.95E-08, 7.97E-08, 1.73E-07, 7.19E-11, 6.91E-11, 4.83E-10};
    
    // ST0 = line intensity
    /*const float ST0[31] = {
    		5.89E-24, 5.06E-24, 5.36E-24, 8.37E-24, 1.61E-23, 1.97E-23, 2.79E-24, 2.17E-23,
    		9.92E-23, 2.00E-25, 7.21E-24, 3.17E-24, 1.21E-20, 2.49E-23, 2.10E-25, 8.79E-24,
    		1.52E-22, 5.06E-23, 3.97E-24, 1.58E-25, 9.39E-24, 1.77E-23, 1.43E-23, 1.50E-23,
    		4.99E-24, 6.62E-24, 5.99E-24, 2.82E-24, 8.47E-24, 7.78E-23, 1.98E-23
    
    };*/
     // Air broadening coeffcient
    const float gamma_air[460] = {0.0654, 0.0677, 0.0676, 0.0681, 0.0692, 0.0712, 0.0671, 0.0691, 0.0676, 0.0692, 0.0659, 0.0691, 0.0735, 0.0665, 0.0659, 0.0646, 0.0874, 0.0744, 0.0686, 0.0686, 0.0688, 0.0683, 0.0782, 0.0782, 0.062, 0.0794, 0.0652, 0.0675, 0.0626, 0.0747, 0.0675, 0.0679, 0.0679, 0.0677, 0.0747, 0.0614, 0.0664, 0.065, 0.0757, 0.0807, 0.0671, 0.0776, 0.0792, 0.0792, 0.0673, 0.0683, 0.0807, 0.0686, 0.0776, 0.0688, 0.0756, 0.0682, 0.0682, 0.0686, 0.0651, 0.0919, 0.0756, 0.068, 0.0693, 0.0763, 0.0878, 0.0878, 0.0677, 0.0681, 0.0648, 0.0803, 0.0803, 0.0677, 0.074, 0.0733, 0.0669, 0.0817, 0.0663, 0.0663, 0.0669, 0.0715, 0.0747, 0.0747, 0.0815, 0.0684, 0.0723, 0.0707, 0.0643, 0.0643, 0.0662, 0.0644, 0.066, 0.066, 0.0666, 0.0814, 0.0814, 0.0664, 0.0664, 0.067, 0.0684, 0.067, 0.0707, 0.0655, 0.0684, 0.0667, 0.0748, 0.0685, 0.0681, 0.0809, 0.0784, 0.0662, 0.0685, 0.0785, 0.0679, 0.0671, 0.0691, 0.0825, 0.0825, 0.0788, 0.0653, 0.0671, 0.0672, 0.0664, 0.0674, 0.0667, 0.0701, 0.0639, 0.0664, 0.0643, 0.0678, 0.0618, 0.0785, 0.0785, 0.0667, 0.0677, 0.0836, 0.0836, 0.0678, 0.0674, 0.0838, 0.0668, 0.0805, 0.0648, 0.0847, 0.0839, 0.0847, 0.0684, 0.0682, 0.0848, 0.0848, 0.0657, 0.0697, 0.0657, 0.0682, 0.0715, 0.0682, 0.065, 0.0671, 0.0682, 0.0628, 0.0671, 0.0612, 0.0688, 0.0679, 0.0858, 0.0858, 0.0685, 0.0882, 0.0805, 0.0815, 0.0686, 0.0827, 0.0679, 0.0679, 0.0675, 0.0868, 0.0868, 0.0695, 0.0705, 0.0654, 0.086, 0.0676, 0.0677, 0.0691, 0.0691, 0.0675, 0.0646, 0.07, 0.0663, 0.0877, 0.0877, 0.0686, 0.0686, 0.0695, 0.0778, 0.0798, 0.0673, 0.0679, 0.0886, 0.0886, 0.0849, 0.0658, 0.0805, 0.0805, 0.09, 0.09, 0.0869, 0.068, 0.0714, 0.0664, 0.069, 0.0879, 0.069, 0.0671, 0.0687, 0.087, 0.0685, 0.0685, 0.0679, 0.0641, 0.0678, 0.0678, 0.0641, 0.068, 0.0809, 0.0585, 0.0728, 0.0888, 0.0902, 0.071, 0.0849, 0.0859, 0.0615, 0.0859, 0.0955, 0.0662, 0.0662, 0.0682, 0.0874, 0.0659, 0.0659, 0.0668, 0.0874, 0.0621, 0.0676, 0.0668, 0.0687, 0.0668, 0.0642, 0.0663, 0.0663, 0.0681, 0.0681, 0.0685, 0.0665, 0.061, 0.0685, 0.0688, 0.0702, 0.068, 0.0669, 0.0666, 0.067, 0.0788, 0.074, 0.0738, 0.0653, 0.0867, 0.0892, 0.0738, 0.0674, 0.066, 0.0809, 0.0677, 0.0637, 0.0663, 0.068, 0.0666, 0.063, 0.0663, 0.0766, 0.0667, 0.0689, 0.0748, 0.067, 0.0689, 0.0666, 0.0766, 0.0668, 0.0797, 0.0748, 0.0677, 0.067, 0.0655, 0.0673, 0.0797, 0.0655, 0.0693, 0.0684, 0.0703, 0.0678, 0.0684, 0.0673, 0.0687, 0.068, 0.0673, 0.0717, 0.0689, 0.071, 0.0675, 0.0726, 0.0703, 0.0681, 0.0689, 0.0675, 0.0676, 0.0662, 0.0805, 0.0738, 0.0738, 0.0644, 0.0665, 0.067, 0.0871, 0.067, 0.0697, 0.0656, 0.0871, 0.0646, 0.0662, 0.0674, 0.0613, 0.0774, 0.0683, 0.0639, 0.0681, 0.0681, 0.0674, 0.0668, 0.0639, 0.0678, 0.0766, 0.0681, 0.0675, 0.0766, 0.0774, 0.0774, 0.0678, 0.0678, 0.0684, 0.0649, 0.0694, 0.0608, 0.0676, 0.0682, 0.068, 0.0639, 0.0671, 0.0682, 0.0689, 0.0689, 0.0691, 0.0837, 0.0689, 0.0837, 0.071, 0.065, 0.0692, 0.0729, 0.0828, 0.0657, 0.0657, 0.0681, 0.0666, 0.066, 0.066, 0.0642, 0.0685, 0.0685, 0.0662, 0.0662, 0.0692, 0.0697, 0.0632, 0.0651, 0.0667, 0.0677, 0.0795, 0.0677, 0.0667, 0.0709, 0.0675, 0.0688, 0.0664, 0.0688, 0.0681, 0.0684, 0.0684, 0.0668, 0.0658, 0.0668, 0.0675, 0.0639, 0.0635, 0.0663, 0.0678, 0.0683, 0.0788, 0.0644, 0.0681, 0.0662, 0.0685, 0.0653, 0.0646, 0.0665, 0.0662, 0.0653, 0.0642, 0.0667, 0.068, 0.068, 0.0682, 0.0721, 0.0795, 0.0795, 0.0665, 0.0826, 0.089, 0.0611, 0.0684, 0.0702, 0.0684, 0.0694, 0.0606, 0.068, 0.0669, 0.0666, 0.0673, 0.0669, 0.0657, 0.067, 0.0682, 0.0637, 0.0839, 0.066, 0.0684, 0.0676, 0.0673, 0.0876, 0.0645, 0.0637, 0.0925, 0.0731, 0.0682, 0.0669, 0.0675, 0.0678, 0.0669, 0.0778, 0.0731, 0.0682, 0.0675, 0.0645, 0.0655, 0.0698};
    
    //self broadening coeff.
    const float gamma_self[460] = {0.069, 0.079, 0.078, 0.085, 0.093, 0.097, 0.074, 0.092, 0.081, 0.093, 0.07, 0.092, 0.1, 0.071, 0.07, 0.068, 0.117, 0.102, 0.09, 0.09, 0.09, 0.088, 0.105, 0.105, 0.065, 0.106, 0.069, 0.08, 0.066, 0.102, 0.08, 0.083, 0.083, 0.082, 0.102, 0.065, 0.072, 0.068, 0.103, 0.108, 0.076, 0.104, 0.106, 0.106, 0.079, 0.087, 0.108, 0.09, 0.104, 0.091, 0.103, 0.087, 0.087, 0.09, 0.069, 0.124, 0.103, 0.087, 0.093, 0.103, 0.118, 0.118, 0.082, 0.084, 0.068, 0.107, 0.107, 0.082, 0.101, 0.1, 0.074, 0.109, 0.071, 0.071, 0.074, 0.098, 0.102, 0.102, 0.109, 0.088, 0.099, 0.097, 0.067, 0.067, 0.071, 0.067, 0.071, 0.071, 0.072, 0.108, 0.108, 0.072, 0.072, 0.075, 0.089, 0.077, 0.097, 0.069, 0.088, 0.073, 0.102, 0.089, 0.087, 0.108, 0.105, 0.071, 0.089, 0.105, 0.081, 0.075, 0.093, 0.11, 0.11, 0.106, 0.069, 0.075, 0.076, 0.072, 0.08, 0.074, 0.096, 0.067, 0.072, 0.067, 0.083, 0.065, 0.105, 0.105, 0.074, 0.082, 0.111, 0.111, 0.083, 0.08, 0.112, 0.073, 0.108, 0.068, 0.113, 0.111, 0.113, 0.088, 0.087, 0.113, 0.113, 0.07, 0.094, 0.07, 0.086, 0.098, 0.086, 0.068, 0.076, 0.085, 0.066, 0.076, 0.064, 0.09, 0.081, 0.114, 0.114, 0.089, 0.118, 0.107, 0.108, 0.09, 0.11, 0.083, 0.083, 0.079, 0.116, 0.116, 0.094, 0.096, 0.069, 0.115, 0.078, 0.079, 0.093, 0.093, 0.077, 0.068, 0.095, 0.072, 0.117, 0.117, 0.09, 0.09, 0.094, 0.105, 0.107, 0.077, 0.084, 0.119, 0.119, 0.113, 0.07, 0.107, 0.107, 0.121, 0.121, 0.116, 0.083, 0.098, 0.071, 0.092, 0.118, 0.092, 0.075, 0.089, 0.116, 0.089, 0.089, 0.084, 0.067, 0.082, 0.082, 0.067, 0.083, 0.108, 0.063, 0.1, 0.119, 0.121, 0.097, 0.113, 0.114, 0.065, 0.114, 0.13, 0.071, 0.071, 0.086, 0.117, 0.07, 0.07, 0.073, 0.117, 0.065, 0.081, 0.073, 0.091, 0.073, 0.067, 0.072, 0.072, 0.086, 0.086, 0.089, 0.071, 0.064, 0.089, 0.09, 0.095, 0.085, 0.074, 0.073, 0.076, 0.106, 0.101, 0.101, 0.069, 0.116, 0.12, 0.101, 0.078, 0.07, 0.108, 0.082, 0.067, 0.072, 0.083, 0.074, 0.066, 0.072, 0.103, 0.073, 0.092, 0.102, 0.075, 0.092, 0.074, 0.103, 0.075, 0.107, 0.102, 0.079, 0.075, 0.069, 0.079, 0.107, 0.069, 0.093, 0.088, 0.096, 0.08, 0.088, 0.076, 0.089, 0.085, 0.079, 0.098, 0.092, 0.097, 0.079, 0.1, 0.096, 0.086, 0.092, 0.079, 0.081, 0.071, 0.107, 0.101, 0.101, 0.067, 0.072, 0.075, 0.116, 0.075, 0.095, 0.069, 0.116, 0.068, 0.071, 0.079, 0.064, 0.104, 0.087, 0.067, 0.085, 0.085, 0.076, 0.073, 0.067, 0.08, 0.103, 0.084, 0.077, 0.103, 0.104, 0.104, 0.082, 0.082, 0.088, 0.068, 0.093, 0.064, 0.078, 0.087, 0.082, 0.067, 0.078, 0.087, 0.092, 0.092, 0.093, 0.111, 0.092, 0.111, 0.097, 0.068, 0.093, 0.1, 0.11, 0.07, 0.07, 0.086, 0.072, 0.07, 0.07, 0.067, 0.089, 0.089, 0.071, 0.071, 0.093, 0.094, 0.066, 0.068, 0.073, 0.081, 0.106, 0.081, 0.073, 0.097, 0.079, 0.091, 0.072, 0.091, 0.086, 0.088, 0.088, 0.075, 0.07, 0.074, 0.08, 0.067, 0.066, 0.071, 0.085, 0.088, 0.106, 0.067, 0.085, 0.071, 0.088, 0.069, 0.068, 0.073, 0.071, 0.069, 0.067, 0.072, 0.085, 0.085, 0.088, 0.099, 0.106, 0.106, 0.073, 0.11, 0.12, 0.064, 0.088, 0.095, 0.088, 0.094, 0.064, 0.082, 0.074, 0.072, 0.078, 0.074, 0.07, 0.074, 0.087, 0.066, 0.111, 0.071, 0.089, 0.08, 0.078, 0.117, 0.067, 0.066, 0.125, 0.1, 0.087, 0.074, 0.077, 0.079, 0.074, 0.105, 0.1, 0.087, 0.08, 0.068, 0.069, 0.095};
    
    //lower state energy
    const float Ep[460] = {3313.8391, 5017.6738, 6042.7964, 3163.8845, 2308.0605, 186.271, 4712.9653, 2853.9365, 1235.2485, 2308.6814, 4760.8252, 2853.9321, 1353.7441, 6082.9966, 4760.7988, 3009.3945, 1263.8425, 2052.0242, 2310.3225, 2310.3225, 3703.0286, 1050.7097, 1399.0031, 1399.0031, 2154.1006, 1993.5701, 2052.4016, 3155.2571, 2708.5469, 3094.5859, 3155.2483, 4174.9229, 4174.9209, 1209.1936, 3094.7397, 3054.1663, 4643.9229, 5724.4189, 2679.0798, 1958.3853, 1458.7273, 2131.062, 1389.1235, 1389.1235, 1916.5863, 4114.8125, 1958.4802, 2367.8911, 2131.2263, 352.002, 767.9741, 2377.1753, 2377.1753, 2368.6584, 3204.6477, 0, 767.8159, 1596.1239, 2227.7881, 2026.2404, 3008.6704, 2007.9543, 3159.0044, 4763.9683, 3139.5828, 1380.0038, 1380.0038, 1206.6031, 3833.2124, 2894.6177, 4198.2803, 1398.0176, 4308.5337, 4308.5352, 4200.8223, 3838.7932, 2098.8792, 2098.8792, 1975.5542, 1678.4587, 154.2009, 2088.1738, 4662.728, 4658.3726, 2540.1562, 5805.1255, 3752.3252, 3752.3252, 4902.2861, 1371.6439, 1371.6439, 2894.8474, 2894.8469, 4360.2939, 1027.1632, 1973.3499, 2088.5742, 5288.9053, 2415.8596, 3660.8093, 2903.3738, 3322.137, 1658.2191, 2713.9932, 2003.5808, 5212.2046, 3322.636, 2387.4214, 4053.7383, 3975.4548, 2570.9744, 1364.0439, 1364.0439, 2609.3755, 5335.9771, 3972.9099, 1424.8629, 3707.8088, 2470.1768, 2843.9382, 1552.9131, 5803.7959, 3707.6733, 3009.0676, 1181.1644, 2211.4319, 1382.0248, 1382.0247, 2841.9929, 3046.52, 1357.2039, 1357.2039, 1178.691, 2471.3535, 1960.6711, 5057.0952, 1984.0459, 5774.3467, 674.7094, 1386.4797, 674.7313, 3175.9939, 2438.5559, 1351.1237, 1351.1237, 4801.8105, 2770.6604, 4801.7817, 3195.4641, 2853.2878, 3195.4407, 5751.2295, 3313.9832, 3735.1338, 2653.4062, 3313.9961, 3111.7419, 3546.1982, 4995.9834, 1345.8035, 1345.8035, 3963.927, 1380.5728, 2372.2922, 39.2611, 1004.3515, 1967.636, 3197.1816, 3197.1816, 1939.5654, 1341.2433, 1341.2433, 2139.0908, 4038.5361, 2006.9584, 1948.9209, 5051.1162, 4051.2175, 1571.2661, 1571.2642, 6077.7368, 3179.4199, 2868.0254, 4681.8857, 1337.4432, 1337.4432, 2920.0449, 2920.0515, 2139.6013, 1470.1188, 3390.8381, 1391.7325, 1151.512, 1334.403, 1334.403, 1954.3514, 6135.0391, 1365.7964, 1365.7965, 1332.1228, 1332.1228, 1283.6475, 4049.3247, 803.3533, 2497.1599, 2327.9578, 1940.304, 2328.6265, 2735.5176, 3726.1357, 1944.1924, 2332.5234, 2332.5234, 1153.8716, 4710.623, 4203.5532, 4203.5508, 4706.1372, 578.0116, 1386.8291, 4072.0149, 1366.5837, 1937.1591, 1934.8203, 4867.6289, 1273.6547, 677.8777, 2269.512, 677.8545, 1933.2517, 4349.5825, 4349.584, 4140.3467, 669.429, 3793.0403, 3793.0403, 4235.3135, 669.4181, 2952.3447, 3187.6626, 4237.9614, 982.2749, 2298.0486, 5856.8232, 2931.396, 2931.3953, 2401.5278, 2401.5276, 2389.938, 4943.5303, 3178.0359, 2390.7583, 3629.9919, 921.2381, 1125.0663, 4394.5762, 3697.6707, 2003.9279, 2646.1621, 3731.4021, 3107.3701, 5335.9771, 1266.7874, 2077.6367, 3107.5432, 1359.3367, 5255.8848, 2400.2432, 1901.3584, 5857.2573, 3746.1907, 4793.9155, 2878.2937, 2599.014, 3746.0437, 2141.6709, 994.2385, 2875.2158, 2691.6206, 4011.1475, 2875.2107, 2876.2649, 2141.8606, 3025.8643, 1966.7233, 3458.6938, 4051.2175, 4008.4941, 4843.5244, 2499.4321, 1966.8372, 4843.4932, 3476.9836, 3344.7979, 2105.1194, 4085.0811, 3345.3303, 4784.0522, 3569.1978, 1127.3151, 2500.667, 170.0759, 2590.0884, 3855.887, 3185.532, 2909.4944, 2105.5562, 1099.3541, 960.9333, 3185.5227, 3075.2249, 6167.0889, 1405.3678, 2111.821, 2111.821, 3224.8882, 2454.9517, 3347.9385, 3011.7639, 3347.9524, 1570.0634, 1962.269, 2011.0934, 5823.5435, 4720.5762, 1327.6753, 2328.3401, 2396.8921, 3201.0125, 4759.2495, 3222.0454, 3222.019, 6111.1514, 4790.3345, 4754.6318, 5025.5737, 755.8286, 3763.3772, 5085.334, 755.6889, 1391.6066, 1391.6064, 3226.1389, 3226.1389, 3987.9595, 5432.46, 2790.3672, 3236.9551, 4085.0361, 1074.3752, 4080.9568, 5909.3003, 1974.2026, 2439.4937, 1590.6039, 1590.6016, 940.3268, 679.7121, 329.2988, 679.7413, 2870.5774, 3248.7566, 2158.1929, 139.5169, 1392.3757, 3834.4922, 3834.4922, 1101.4951, 2341.9949, 4391.3877, 4391.3896, 3111.3684, 2943.6003, 2943.6077, 2968.6582, 2968.6575, 2158.7439, 2886.9202, 2545.375, 5383.8286, 4273.1001, 4232.9351, 2380.3279, 4232.9326, 4275.856, 817.7256, 1296.7484, 2348.5911, 3735.2673, 2349.3096, 2462.8691, 2355.4634, 2355.4634, 2035.2397, 5300.4668, 4429.585, 3217.0542, 3841.1904, 5911.499, 4986.0791, 1642.5229, 1050.1302, 3400.3757, 5875.125, 4166.6309, 3785.3081, 3752.282, 4885.9668, 5850.397, 2913.3633, 3785.1492, 4885.9331, 3265.9456, 2413.5137, 2426.6169, 2426.6169, 1633.916, 1380.1362, 1373.9261, 1373.9261, 2911.2493, 32.1229, 1378.3, 2387.9163, 2412.7188, 4057.3723, 2413.5942, 920.4556, 3304.9934, 4822.0732, 4047.5962, 5137.2446, 2529.3992, 4044.8328, 1918.3337, 3544.365, 1076.4117, 4808.6069, 1278.7942, 4759.9946, 1026.6187, 1266.5563, 2530.6938, 1279.8604, 3559.2041, 4803.856, 2340.0134, 3120.906, 3368.189, 3382.6296, 4119.6392, 4117.2041, 3382.6443, 1367.4026, 3121.0994, 3368.7556, 3104.6641, 3683.96, 6225.5908, 3035.5212};
    
    //Temperature coeff.
    const float n[460] = {0.69, 0.75, 0.75, 0.76, 0.74, 0.72, 0.73, 0.74, 0.75, 0.74, 0.71, 0.74, 0.69, 0.72, 0.71, 0.68, 0.77, 0.69, 0.75, 0.75, 0.75, 0.76, 0.69, 0.69, 0.66, 0.69, 0.69, 0.75, 0.66, 0.69, 0.75, 0.76, 0.76, 0.76, 0.69, 0.65, 0.72, 0.69, 0.69, 0.7, 0.74, 0.69, 0.69, 0.69, 0.75, 0.76, 0.7, 0.75, 0.69, 0.75, 0.69, 0.76, 0.76, 0.75, 0.69, 0.78, 0.69, 0.76, 0.74, 0.69, 0.77, 0.77, 0.76, 0.76, 0.69, 0.69, 0.69, 0.76, 0.69, 0.7, 0.73, 0.7, 0.72, 0.72, 0.73, 0.71, 0.69, 0.69, 0.7, 0.76, 0.7, 0.72, 0.68, 0.68, 0.71, 0.68, 0.71, 0.71, 0.72, 0.7, 0.7, 0.73, 0.73, 0.74, 0.75, 0.75, 0.72, 0.7, 0.76, 0.73, 0.69, 0.75, 0.76, 0.7, 0.69, 0.71, 0.75, 0.69, 0.75, 0.74, 0.74, 0.71, 0.71, 0.69, 0.69, 0.74, 0.74, 0.72, 0.75, 0.74, 0.73, 0.67, 0.72, 0.68, 0.76, 0.65, 0.69, 0.69, 0.74, 0.76, 0.72, 0.72, 0.76, 0.75, 0.72, 0.73, 0.69, 0.68, 0.74, 0.73, 0.74, 0.76, 0.76, 0.73, 0.73, 0.71, 0.73, 0.71, 0.76, 0.71, 0.76, 0.69, 0.74, 0.76, 0.66, 0.74, 0.65, 0.75, 0.75, 0.74, 0.74, 0.76, 0.78, 0.7, 0.7, 0.75, 0.71, 0.76, 0.76, 0.75, 0.76, 0.76, 0.73, 0.73, 0.7, 0.74, 0.75, 0.75, 0.74, 0.74, 0.75, 0.69, 0.73, 0.72, 0.77, 0.77, 0.75, 0.75, 0.73, 0.69, 0.69, 0.75, 0.76, 0.77, 0.77, 0.73, 0.7, 0.7, 0.7, 0.78, 0.78, 0.76, 0.76, 0.71, 0.71, 0.74, 0.77, 0.74, 0.74, 0.76, 0.76, 0.75, 0.75, 0.76, 0.68, 0.76, 0.76, 0.68, 0.76, 0.7, 0.65, 0.7, 0.77, 0.78, 0.72, 0.74, 0.75, 0.65, 0.75, 0.77, 0.71, 0.71, 0.76, 0.77, 0.71, 0.71, 0.73, 0.77, 0.65, 0.75, 0.73, 0.75, 0.73, 0.68, 0.72, 0.72, 0.76, 0.76, 0.75, 0.72, 0.65, 0.75, 0.75, 0.73, 0.76, 0.74, 0.73, 0.75, 0.69, 0.69, 0.69, 0.69, 0.76, 0.78, 0.69, 0.75, 0.71, 0.7, 0.76, 0.67, 0.72, 0.76, 0.73, 0.66, 0.72, 0.69, 0.73, 0.75, 0.69, 0.74, 0.75, 0.73, 0.69, 0.74, 0.69, 0.69, 0.75, 0.74, 0.7, 0.75, 0.69, 0.7, 0.74, 0.76, 0.73, 0.75, 0.76, 0.74, 0.76, 0.76, 0.75, 0.71, 0.74, 0.72, 0.75, 0.7, 0.73, 0.76, 0.74, 0.75, 0.75, 0.71, 0.7, 0.69, 0.69, 0.69, 0.72, 0.74, 0.76, 0.74, 0.73, 0.7, 0.76, 0.68, 0.72, 0.75, 0.65, 0.69, 0.76, 0.68, 0.76, 0.76, 0.74, 0.73, 0.68, 0.75, 0.69, 0.76, 0.75, 0.69, 0.69, 0.69, 0.76, 0.76, 0.76, 0.69, 0.74, 0.65, 0.75, 0.76, 0.76, 0.67, 0.75, 0.76, 0.74, 0.74, 0.74, 0.73, 0.75, 0.73, 0.72, 0.69, 0.74, 0.7, 0.71, 0.71, 0.71, 0.76, 0.72, 0.71, 0.71, 0.68, 0.76, 0.76, 0.72, 0.72, 0.74, 0.73, 0.66, 0.69, 0.73, 0.75, 0.69, 0.75, 0.73, 0.71, 0.75, 0.75, 0.72, 0.75, 0.76, 0.76, 0.76, 0.74, 0.7, 0.73, 0.75, 0.67, 0.67, 0.71, 0.76, 0.76, 0.69, 0.68, 0.76, 0.72, 0.76, 0.7, 0.68, 0.73, 0.72, 0.7, 0.68, 0.72, 0.76, 0.76, 0.76, 0.7, 0.69, 0.69, 0.73, 0.71, 0.78, 0.65, 0.76, 0.73, 0.76, 0.74, 0.65, 0.76, 0.73, 0.72, 0.75, 0.73, 0.7, 0.73, 0.76, 0.67, 0.73, 0.71, 0.75, 0.75, 0.75, 0.77, 0.68, 0.67, 0.78, 0.7, 0.76, 0.74, 0.75, 0.75, 0.74, 0.69, 0.7, 0.76, 0.75, 0.68, 0.7, 0.73};
    
    //Pressure shift coeff.
    const float delta[460] = {-0.002524, -0.002951, -0.002956, -0.002924, -0.002834, -0.002755, -0.003016, -0.002235, -0.002919, -0.002834, -0.00311, -0.002235, -0.002594, -0.00309, -0.00311, -0.003324, -0.001768, -0.002627, -0.002876, -0.002876, -0.002897, -0.002884, -0.002387, -0.002387, -0.003621, -0.002328, -0.003187, -0.002294, -0.003509, -0.002551, -0.002294, -0.002917, -0.002917, -0.002915, -0.002551, -0.003711, -0.003049, -0.003277, -0.002489, -0.002177, -0.00297, -0.00235, -0.002323, -0.002323, -0.002918, -0.002891, -0.002177, -0.002876, -0.00235, -0.002872, -0.00262, -0.002887, -0.002887, -0.002876, -0.002513, -0.001719, -0.00262, -0.002876, -0.00224, -0.002522, -0.001776, -0.001776, -0.002914, -0.002914, -0.003201, -0.002257, -0.002257, -0.002915, -0.002611, -0.00265, -0.00301, -0.002069, -0.003084, -0.003084, -0.00301, -0.002732, -0.002551, -0.002551, -0.002189, -0.002894, -0.00272, -0.002741, -0.00331, -0.00331, -0.003107, -0.003346, -0.003091, -0.003091, -0.003077, -0.002185, -0.002185, -0.003027, -0.003027, -0.002974, -0.002876, -0.002931, -0.002741, -0.003208, -0.003016, -0.003017, -0.002557, -0.002884, -0.002888, -0.002182, -0.002392, -0.003124, -0.002884, -0.002294, -0.002933, -0.00298, -0.002828, -0.002107, -0.002107, -0.002304, -0.002544, -0.00298, -0.002961, -0.003049, -0.002924, -0.002985, -0.002756, -0.003404, -0.003049, -0.00329, -0.002911, -0.003648, -0.002294, -0.002294, -0.002985, -0.002914, -0.002037, -0.002037, -0.002911, -0.002924, -0.002041, -0.003046, -0.002262, -0.003301, -0.001802, -0.00188, -0.001802, -0.002894, -0.003016, -0.001977, -0.001977, -0.003134, -0.002814, -0.003134, -0.002891, -0.002732, -0.002891, -0.003277, -0.002958, -0.002904, -0.003479, -0.002958, -0.003736, -0.002897, -0.002933, -0.001926, -0.001926, -0.002894, -0.001818, -0.002172, -0.002218, -0.002869, -0.002112, -0.002917, -0.002917, -0.002925, -0.001884, -0.001884, -0.002808, -0.002167, -0.00317, -0.00193, -0.002956, -0.002951, -0.002828, -0.002828, -0.00296, -0.003224, -0.002788, -0.003063, -0.001849, -0.001849, -0.00289, -0.00289, -0.002808, -0.002509, -0.001758, -0.002954, -0.002905, -0.001815, -0.001815, -0.001981, -0.003171, -0.002172, -0.002172, -0.001767, -0.001767, -0.002011, -0.002923, -0.002691, -0.00309, -0.002849, -0.001853, -0.002849, -0.002334, -0.0029, -0.001888, -0.002884, -0.002884, -0.002905, -0.003331, -0.00292, -0.00292, -0.003331, -0.002929, -0.002283, -0.004054, -0.002633, -0.001819, -0.001771, -0.002753, -0.001805, -0.002057, -0.003676, -0.002057, -0.001608, -0.003098, -0.003098, -0.002891, -0.001927, -0.00311, -0.00311, -0.003024, -0.001927, -0.003603, -0.00292, -0.003024, -0.002861, -0.003003, -0.003374, -0.003043, -0.003043, -0.002885, -0.002885, -0.002884, -0.00309, -0.003759, -0.002884, -0.002258, -0.002836, -0.002902, -0.002991, -0.003033, -0.002935, -0.00179, -0.002611, -0.002605, -0.003229, -0.001741, -0.001864, -0.002605, -0.002946, -0.003148, -0.002283, -0.00292, -0.003432, -0.003063, -0.002923, -0.002997, -0.003451, -0.003063, -0.002414, -0.00304, -0.002247, -0.002557, -0.002997, -0.002247, -0.002997, -0.002414, -0.002946, -0.002252, -0.002095, -0.002951, -0.002997, -0.003157, -0.00293, -0.002252, -0.003157, -0.00224, -0.002888, -0.002762, -0.002943, -0.002888, -0.002987, -0.0029, -0.002902, -0.00293, -0.002734, -0.002843, -0.002753, -0.002299, -0.002686, -0.002762, -0.002897, -0.002852, -0.002299, -0.00292, -0.003124, -0.002172, -0.002605, -0.002605, -0.003249, -0.003072, -0.002974, -0.001749, -0.002974, -0.002776, -0.003153, -0.001749, -0.003324, -0.003077, -0.002936, -0.003703, -0.002345, -0.002891, -0.003359, -0.002897, -0.002897, -0.002971, -0.003046, -0.003359, -0.002943, -0.002568, -0.002914, -0.00296, -0.002568, -0.002345, -0.002345, -0.00292, -0.00292, -0.002894, -0.002584, -0.00284, -0.003786, -0.002956, -0.002892, -0.002927, -0.003404, -0.002926, -0.003016, -0.002843, -0.002843, -0.00284, -0.001876, -0.00287, -0.001876, -0.002753, -0.002532, -0.002834, -0.002706, -0.001967, -0.003134, -0.003134, -0.002897, -0.003019, -0.003117, -0.003117, -0.003374, -0.002894, -0.002894, -0.003057, -0.003057, -0.002834, -0.002814, -0.003425, -0.003252, -0.00304, -0.002926, -0.002247, -0.002926, -0.00304, -0.002709, -0.002929, -0.002863, -0.003049, -0.002863, -0.003014, -0.002888, -0.002888, -0.002946, -0.003171, -0.003003, -0.00293, -0.003329, -0.003457, -0.003105, -0.002873, -0.002884, -0.00179, -0.003346, -0.002897, -0.003077, -0.0029, -0.003177, -0.003324, -0.003011, -0.003077, -0.003177, -0.003274, -0.003054, -0.002885, -0.002885, -0.002873, -0.002669, -0.002247, -0.002247, -0.003011, -0.002171, -0.001741, -0.003728, -0.002888, -0.002183, -0.002888, -0.002823, -0.003816, -0.002927, -0.00301, -0.003077, -0.002932, -0.00301, -0.003135, -0.002348, -0.002892, -0.003389, -0.00188, -0.003091, -0.002876, -0.002923, -0.002932, -0.001931, -0.002624, -0.003389, -0.00173, -0.002644, -0.002887, -0.002991, -0.00296, -0.002949, -0.002991, -0.002509, -0.002644, -0.002887, -0.00293, -0.003265, -0.003208, -0.002848};
    

Observation: Please check the post at Jan 24, 2018 9:05 AM in this post e2e.ti.com/support/microcontrollers/c2000/f/171/t/654370

I assume that when the program goes into function 'lorlineshape()' then the program is not getting enough memory from the sectors created in the default linking files. and thus there are garbage results.

 

My Question:

Can anyone tell when the main function calls 'lorlineshape()' then the variables which are initialized/declared in this function acquire which space in the memory?

and when the program comes out of the function then this space is released or not? and since I am calling this function in the loop in original program, then does the function acuire new space each time the function is called?  how does this work? is there a documentation to read or someone to explain.

 

Thank for the patient to read till the end.

Thanks in advance for any help you provide

Regards,

  • Rohan,

    Local variables go on the stack. Those variables which are extern in 'lorlineshape()' are not contributing to stack usage since they are, I think, const arrays in HITRAN.c, but I see the array 'phi_voigt' of length 960 floats which is probably blowing most of the stack on it's own. How much space do you have allocated for the stack?

    Regards,

    Richard
  • Right now I am using the default linking files of C2000Ware_1_00_03_00 file

    The stack allocated in 2837xD_FLASH_lnk_cpu1.cmd is

    ....................................................................................................................................................

    Regards,

  • Rohan,

    So, RAMM1 is 0x400 (1024) 16-bit words in length, yet 'phi_voigt' consumes 900 32-bit words. Can 'phi_voigt' be a global? Otherwise you're going to have to allocate more memory to the stack by moving it to different RAM block(s).

    Regards,

    Richard
  • Hey Richard,

    I am trying this program on a different system (My Laptop isn't available right now) and i am getting this error while building

    Also I am adding the Linking file here

    MEMORY
    {
    PAGE 0 :  /* Program Memory */
              /* Memory (RAM/FLASH) blocks can be moved to PAGE1 for data allocation */
              /* BEGIN is used for the "boot to Flash" bootloader mode   */
    
       BEGIN           	: origin = 0x080000, length = 0x000002
       RAMM0           	: origin = 0x000122, length = 0x0002DE
       RAMD0           	: origin = 0x00B000, length = 0x000800
       RAMLS0          	: origin = 0x008000, length = 0x000800
       RAMLS1          	: origin = 0x008800, length = 0x000800
       RAMLS2      		: origin = 0x009000, length = 0x000800
       RAMLS3      		: origin = 0x009800, length = 0x000800
       RAMLS4      		: origin = 0x00A000, length = 0x000800
       RAMGS14          : origin = 0x01A000, length = 0x001000     /* Only Available on F28379D, F28377D, F28375D devices. Remove line on other devices. */
       RAMGS15          : origin = 0x01B000, length = 0x001000     /* Only Available on F28379D, F28377D, F28375D devices. Remove line on other devices. */
       RESET           	: origin = 0x3FFFC0, length = 0x000002
    
       /* Flash sectors */
       FLASHA           : origin = 0x080002, length = 0x001FFE	/* on-chip Flash */
       FLASHB           : origin = 0x082000, length = 0x002000	/* on-chip Flash */
       FLASHC           : origin = 0x084000, length = 0x002000	/* on-chip Flash */
       FLASHD           : origin = 0x086000, length = 0x002000	/* on-chip Flash */
       FLASHE           : origin = 0x088000, length = 0x008000	/* on-chip Flash */
       FLASHF           : origin = 0x090000, length = 0x008000	/* on-chip Flash */
       FLASHG           : origin = 0x098000, length = 0x008000	/* on-chip Flash */
       FLASHH           : origin = 0x0A0000, length = 0x008000	/* on-chip Flash */
       FLASHI           : origin = 0x0A8000, length = 0x008000	/* on-chip Flash */
       FLASHJ           : origin = 0x0B0000, length = 0x008000	/* on-chip Flash */
       FLASHK           : origin = 0x0B8000, length = 0x002000	/* on-chip Flash */
       FLASHL           : origin = 0x0BA000, length = 0x002000	/* on-chip Flash */
       FLASHM           : origin = 0x0BC000, length = 0x002000	/* on-chip Flash */
       FLASHN           : origin = 0x0BE000, length = 0x002000	/* on-chip Flash */
    
    PAGE 1 : /* Data Memory */
             /* Memory (RAM/FLASH) blocks can be moved to PAGE0 for program allocation */
    
       BOOT_RSVD       : origin = 0x000002, length = 0x000120     /* Part of M0, BOOT rom will use this for stack */
       RAMM1           : origin = 0x000400, length = 0x000400     /* on-chip RAM block M1 */
       RAMD1           : origin = 0x00B800, length = 0x000800
    
       RAMLS5      : origin = 0x00A800, length = 0x000800
    
       RAMGS0      : origin = 0x00C000, length = 0x001000
       RAMGS1      : origin = 0x00D000, length = 0x001000
       RAMGS2      : origin = 0x00E000, length = 0x001000
       RAMGS3      : origin = 0x00F000, length = 0x001000
       RAMGS4      : origin = 0x010000, length = 0x001000
       RAMGS5      : origin = 0x011000, length = 0x001000
       RAMGS6      : origin = 0x012000, length = 0x001000
       RAMGS7      : origin = 0x013000, length = 0x001000
       RAMGS8      : origin = 0x014000, length = 0x001000
       RAMGS9      : origin = 0x015000, length = 0x001000
       RAMGS10     : origin = 0x016000, length = 0x001000
       RAMGS11     : origin = 0x017000, length = 0x001000
       RAMGS12     : origin = 0x018000, length = 0x001000     /* Only Available on F28379D, F28377D, F28375D devices. Remove line on other devices. */
       RAMGS13     : origin = 0x019000, length = 0x001000     /* Only Available on F28379D, F28377D, F28375D devices. Remove line on other devices. */
    
       CPU2TOCPU1RAM   : origin = 0x03F800, length = 0x000400
       CPU1TOCPU2RAM   : origin = 0x03FC00, length = 0x000400
    }
    
    SECTIONS
    {
       /* Allocate program areas: */
       .cinit              : > FLASHB      PAGE = 0, ALIGN(4)
       .pinit              : > FLASHB,     PAGE = 0, ALIGN(4)
       .text               : >> FLASHB | FLASHC | FLASHD | FLASHE      PAGE = 0, ALIGN(4)
       codestart           : > BEGIN       PAGE = 0, ALIGN(4)
    
       /* Allocate uninitalized data sections: */
       .stack              : > RAMM1        PAGE = 1
       .ebss               : >> RAMLS5 | RAMGS0 | RAMGS1         PAGE = 1
       .esysmem            : > RAMLS5       PAGE = 1
       .cio                : > RAMLS5     PAGE = 1
       
       /* Initalized sections go in Flash */
       .econst             : >> FLASHF | FLASHG | FLASHH      PAGE = 0, ALIGN(4)
       .switch             : > FLASHB      PAGE = 0, ALIGN(4)
    
       .reset              : > RESET,     PAGE = 0, TYPE = DSECT /* not used, */
    
       Filter_RegsFile     : > RAMGS0,	   PAGE = 1
    
       SHARERAMGS0		: > RAMGS0,		PAGE = 1
       SHARERAMGS1		: > RAMGS1,		PAGE = 1
       ramgs0           : > RAMGS0,     PAGE = 1
       ramgs1           : > RAMGS1,     PAGE = 1
    
    #ifdef __TI_COMPILER_VERSION__
    	#if __TI_COMPILER_VERSION__ >= 15009000
    	.TI.ramfunc : {} LOAD = FLASHD,
    						 RUN = RAMLS0 | RAMLS1 | RAMLS2 |RAMLS3,
                             LOAD_START(_RamfuncsLoadStart),
                             LOAD_SIZE(_RamfuncsLoadSize),
                             LOAD_END(_RamfuncsLoadEnd),
                             RUN_START(_RamfuncsRunStart),
                             RUN_SIZE(_RamfuncsRunSize),
                             RUN_END(_RamfuncsRunEnd),
    						 PAGE = 0, ALIGN(4)
    	#else
       ramfuncs            : LOAD = FLASHD,
                             RUN = RAMLS0 | RAMLS1 | RAMLS2 |RAMLS3,
                             LOAD_START(_RamfuncsLoadStart),
                             LOAD_SIZE(_RamfuncsLoadSize),
                             LOAD_END(_RamfuncsLoadEnd),
                             RUN_START(_RamfuncsRunStart),
                             RUN_SIZE(_RamfuncsRunSize),
                             RUN_END(_RamfuncsRunEnd),
                             PAGE = 0, ALIGN(4)    
        #endif
    #endif
    
       /* The following section definitions are required when using the IPC API Drivers */
        GROUP : > CPU1TOCPU2RAM, PAGE = 1
        {
            PUTBUFFER
            PUTWRITEIDX
            GETREADIDX
        }
    
        GROUP : > CPU2TOCPU1RAM, PAGE = 1
        {
            GETBUFFER :    TYPE = DSECT
            GETWRITEIDX :  TYPE = DSECT
            PUTREADIDX :   TYPE = DSECT
        }
    
       /* The following section definition are for SDFM examples */
       Filter1_RegsFile : > RAMGS1,	PAGE = 1, fill=0x1111
       Filter2_RegsFile : > RAMGS2,	PAGE = 1, fill=0x2222
       Filter3_RegsFile : > RAMGS3,	PAGE = 1, fill=0x3333
       Filter4_RegsFile : > RAMGS4,	PAGE = 1, fill=0x4444
       Difference_RegsFile : >RAMGS5, 	PAGE = 1, fill=0x3333
    }
    
    /*
    //===========================================================================
    // End of file.
    //===========================================================================
    */
    

  • Rohan,

    The 'program will not fit...' error message is saying your .ebss section, which is used for global variables, is too large to fit into the memory you have allocated for it.  You're going to need to find a larger memory block.  This example does not seem to make much use of GS memory, so you could do something like this:

    .ebss               : >> RAMLS5 | RAMGS0 | RAMGS1 | RAMGS2 | RAMGS3 | RAMGS4        PAGE = 1

    I don't know why you're getting the undefined symbol errors unless you have removed some code from the example?

    Regards,

    Richard
  • Hey Richard,

    I have tried doing what you have just suggested with all the RAMGS upto 12.

    The program still shows the same error with all those RAM GS listed in Console.

    Nothing is deleted actually.

    If you See, the main.c file shared before has multiple programs.. so just kept one of it and removed others.

    Regards

  • Hey Richard,

    It worked now

    I alloted more chunk to the stack and brought back the phivoigt[] in lorlineshape.

     .stack              : > RAMGS2      PAGE = 1
    //instead of RAMM1

    By this it is working though I am confused because if this much memory extra was sufficient for it to work then what you have suggested earlier should also work

    .ebss               : >> RAMLS5 | RAMGS0 | RAMGS1 | RAMGS2 | RAMGS3 | RAMGS4        PAGE = 1

    I guess .ebss Cannot go beyond certain limits : 0x16cf as shown in the screenshot of Console I have shared in earlier posts

    Regards

  • Rohan,

    Glad to know it is working. Increasing the stack implies it was the number of local variables which caused the problem.

    If you haven't already done so, please make sure you have your project linker properties set up to generate a .map file. That will tell you in detail what sections are being linked where and how large they are.

    Regards,

    Richard
  • Thanks Richard for the continuous help yesterday...

    Richard Poley said:

    If you haven't already done so, please make sure you have your project linker properties set up to generate a .map file. That will tell you in detail what sections are being linked where and how large they are.

    I have never done that. Could you tell me what do you mean by this or is there any documentation for this.

    Regards,

  • Rohan,

    You are very welcome.

    You can set the "-map_file" linker properties from CCS by right-clicking on the project in the explorer window, then selecting "Properties -> CCS Build -> C2000 Linker -> Basic Options".  The linker will generate a text file with the ".map" extension which you can open in any text editor.  The file contains a listing of memory usage and symbol placement which I find very useful.  This and other features of the linker are documented in Chapter 8 of the Assembly Language Tools Guide, here:

    http://www.ti.com/lit/ug/spru513p/spru513p.pdf

    Regards,

    Richard