Example #1
0
ECODE DTFUN::ConfigAD( UINT ChanType,
                       UINT ListSize,
                       DBL  Gain,
                       int  ClockSource,
                       DBL  Freq,
                       DWORD BufSize   )
{
    int status;

    ECODE result= 0;
    BufferSize= (int)BufSize;

    result+= SetChanType( ChanType );
    result+= SetChanList( ListSize, Gain );
    Freq= SetClock(ClockSource, Freq );       // ClockSource=0 ... internal, 1=external
    result+= SetWndHandle();
    result+= SetBuffers( BufSize );

    ClockHz= Freq;

    // do we want to output the sample clock onto the user counter pin?
    // (this user counter pin can then be used as an A/D sample clock input for another board
    // and is also used to drive this particular board
    // NOTE that the user counter pin has to be wired externally to the A/D Sample Clock In pin
    if (outputclockonusercounter)
    {
        // set the cascade mode
        status= olDaSetCascadeMode(lphDassCT, OL_CT_SINGLE);
        // set up the clocks and gates
        // use an internal clock
        status= olDaSetClockSource(lphDassCT, OL_CLK_INTERNAL);
        // set the clock frequency
        status= olDaSetClockFrequency(lphDassCT, ClockHz);
        // specify the gate to enable the C/T operation
        status= olDaSetGateType(lphDassCT, OL_GATE_NONE);
        // status= olDaSetGateType(lphDassCT, OL_GATE_HIGH_LEVEL);
        // specify the mode for continuous output
        status= olDaSetCTMode(lphDassCT, OL_CTMODE_RATE);    // as opposed to OL_CTMODE_ONESHOT
        // specify the output pulse type
        status= olDaSetPulseType(lphDassCT, OL_PLS_HIGH2LOW);
        // specify the duty cycle or pulse width
        status= olDaSetPulseWidth(lphDassCT, 100);
        // configure the subsystem
        status= olDaConfig( lphDassCT );
        // if we use a self-generated clock, then pre-start the A/D conversion here
        // start of sampling will be triggered when counter/clock is started
        status= olDaStart( lphDass );
    }

    return( result );
}
Example #2
0
DBL DTFUN::SetClock(int ClockSource, DBL Freq )
{
    ECODE status;

    if(ClockSource == 0)
    {
        status= olDaSetClockSource( lphDass, OL_CLK_INTERNAL );
    }
    else
    {
        status= olDaSetClockSource( lphDass, OL_CLK_EXTERNAL );
    }

    status= olDaSetClockFrequency( lphDass, Freq );

    status= olDaConfig( lphDass );

    status= olDaGetClockFrequency( lphDass, &Freq );

    return( Freq );
}
Example #3
0
void COctopusAOTF::Start( void ) 
{ 
	olDaSetClockFrequency( hdass_9834, 0.25 * freq * outbuffersize );

	olDmAllocBuffer( 0, outbuffersize, &hBuf_DAC );

	if( hBuf_DAC == NULL ) 
	{
		AfxMessageBox(_T("Error Allocating buffer."));
		return;
	}
	
	GenerateSignal();
	
	olDaPutBuffer( hdass_9834, hBuf_DAC );	
	
	olDaConfig( hdass_9834 );
	
	olDaStart( hdass_9834 );

	B.AOTF_running = true;

	m_status_AOTF.SetBitmap( m_bmp_yes );
}