Home Up

Software Development

กก

Up 

Software libraries for Windows 95/98 or NT 4.0 are very easy to use.  It takes little effort to port your application to FlexCorrelators.  The following is the sample code for using Flex30-OEM.

#include "flex30.h"
#include <iostream.h>
#include <windows.h>
#include <stdio.h>

int main()
{
    int                     i;
    float                 ElapsedTime;
    unsigned short int    tracecnt;
    float                 corr[248];
    float                 trace[512];
    double                 Intensity;
    FILE                 *stream;

    int                     DurationTime;
    cout << "Duration Time: " << endl;
    cin >> DurationTime;

   
    FLEX30             *flex = new FLEX30();

// Test the presence of the correlator
    if(flex->IsCardPresent())
        cout << "The card is present" << endl;
    else
    {
        cout << "The card is not present" << endl;
        return 1;
    }
       

// starts the correlator
    flex->Start();
    ElapsedTime = 0;
//runs for DurationTime seconds
    while( ElapsedTime < DurationTime )
    {
        // Sleep for a second
        Sleep(1000);
        // Hello correlator
        flex->Update(&ElapsedTime, &tracecnt, corr, trace);
        // Calculate the average intensity for channel A
        Intensity = 0;
        for(i = 0; i<tracecnt; i++)
            Intensity += trace[i];
        Intensity /= tracecnt*TIME_FLEX30;
        // Display it
        cout << "Intensity A: " << Intensity << endl;
}

//stops the correlator
    flex->Stop();
    // Display the final correlation function
    stream = fopen("corr.dat","wt");
    for(i = 0; i<248; i++)
        fprintf(stream, "%e,%e\n",flex->m_fpDelayTime[i], corr[i]);
    fclose(stream);   
   
    delete flex;
    return 0;
}

กก

Send mail to Info@correlator.com with questions or comments about this web site.
Copyright ?1998 Correlator.com
Last modified: October 25, 2006