Download Choose what sample depth you would likekeeping in mind
Transcript
printf( "Generating PWM Waveforms on 16 and 17.\n");
GeneratePWMWaveformQX( 0, 1000, 50 );
GeneratePWMWaveformQX( 1, 20000, 25 );
printf( "Generating Digital Waveform on D2 thru D7.\n");
LoadDigitalWaveformQX( 128, samplebuffer );
GenerateDigitalWaveformQX( 0xFC, 1, 1, 0, 0, 0, 0, 3000000);
printf( "Reading Edge Counts and Frequencies.\n");
DisableCountsQX();
ClearCountsQX();
EnableCountsQX();
Sleep(100);
unsigned long ec0, ec1, ec2, ec3, f4, f5, f6, f7;
GetFrequencyAndCountsQX( &ec0, &ec1, &ec2, &ec3, &f4, &f5, &f6, &f7
printf("Edge Counts 0: %ld\n", ec0);
printf("Edge Counts 1: %ld\n", ec1);
printf("Edge Counts 2: %ld\n", ec2);
printf("Edge Counts 3: %ld\n", ec3);
printf("Frequency 4: %ld\n", f4);
printf("Frequency 5: %ld\n", f5);
printf("Frequency 6: %ld\n", f6);
printf("Frequency 7: %ld\n", f7);
);
printf( "Setting Logic Threshold.\n");
SetLogicThresholdQX( 1.5 );
printf( "Starting a Capture.\n");
// Setup the Trigger Specification
SetTriggersQX( false, false, false, false, false, false, // No trigger,
false, false, false, false, false, false, false, false, 0,
1, 1.0, 3.0, 1.5, 0xFFFF, 0x0000, 0xFFFF,
// Trigger
false, false, false, false, false, false, false, false, 0,
1, 1.0, 3.0, 1.5, 0xFFFF, 0x0000, 0xFFFF);
// Trigger
trigger always
false, 1, false,
X Event
false, 1, false,
Y Event
// Start the capture
unsigned long SampleBufferSize = 4*1024*1024;
// 4 Million
unsigned char TriggerPosition = 50; // 50 percent (trigger in the middle)
float SampleRate = 100000000; // 100Msps
unsigned long ChannelMaskA = 0xFFFFFFFF; // Sample all channels (D0-15, CH1 and CH2)
unsigned long ChannelMaskB = 0xFFFFFFFF; // Sample all channels (D16-23, CH3 and CH4)
StartCaptureQX(SampleBufferSize, TriggerPosition, SampleRate, ChannelMaskA, ChannelMaskB,
0, 0 );
// Monitor the status of the capture in progress
unsigned char Full;
unsigned char Triggered;
unsigned char Running = 1;
while( Running )
{
CaptureStatusQX( &Full, &Triggered, &Running );
printf("CaptureStatus Full:%d Triggered:%d Running:%d\n", Full, Triggered,Running );
Sleep(10);
}
//TriggerNowRX(); // To trigger now and store data to the end of the buffer
//StopCaptureRX(); // To stop capture in progress and discard the data
// Now that the capture completed, properly end the capture and get the data
__int64 ActualNumberOfSamples;
__int64 TriggerSamplePosition;
// Completes the capture and transfers all of the stored data to the PC
EndCaptureQX( &ActualNumberOfSamples, &TriggerSamplePosition);
printf("Number Of Samples:%I64d Trigger Sample Position:%I64d
ActualNumberOfSamples, TriggerSamplePosition );
\n",
// Now access samples captured using SampleDigitalData() and AnalogSampleVoltage()
for (int x = 100; x < 12000; x+=100)
printf("Sample %2d Digital= %08X CH1=%0.2f CH2=%0.2f CH3=%0.2f CH4=%0.2f\n", x,
SampleDigitalData(x), AnalogSampleVoltage( 1, x ), AnalogSampleVoltage( 2, x ),
AnalogSampleVoltage( 3, x ), AnalogSampleVoltage( 4, x ));
USBee QX User’s Manual
209