Test and Measurement Forum

Collecting data with ADC-212 in ETS mode

Post general discussions on using our drivers to write your own software here

Collecting data with ADC-212 in ETS mode

Postby Style » Tue Jan 14, 2003 3:10 am

We are writing to appeal some helps about developing software with ADC-212.
We are developing a software by visual basic and we need to use ADC-212 to analyse some data.
However, we meet some problems with calling functions from the driver.

Here is our problems,

Whatever we have set the trigger or not, the collected data still not stable. It seems that it was never triggered.
We call the function as this: adc200_set_trigger(1, 0, 0, 0, Level ) //Enable = true, source = channel A, direction = raising,delay percent = 0, where the range of "level" is from -2047 to 2047

Since we are measuring the data within a very small time period, we called the function "adc200_set_ets" to meet our requirment.
But, we have a big trouble here. We never get any data after calling that function! It ever returns that the data are still not ready.
We call the function as this: adc200_set_ets(4, 8, 2) //mode = fast

Are we writing it correct?
Please tell us where is the problem.
The manual just explain the function very briefly.
Can you explain us more about step by step how to collect the data in the ETS mode?
A example of how to collect data with ETS mode in visual basic is highly appreciate.

ETS in Pseudo-Code

Postby matthew » Thu Jan 16, 2003 9:27 am

Hello Style,

I believe you have contacted me directly regarding this. Once our software department has got back to me with a step-by-step psuedo-code guide on ETS, I'll post it here for other forum readers to benefit as well.

Kind Regards,
Matt Everett

Pico Software Engineer
User avatar
Advanced User
Advanced User
Posts: 109
Joined: Wed Sep 25, 2002 9:35 am
Location: Cambridgeshire, UK

where can I find the document

Postby yrlin » Tue Apr 20, 2004 1:52 pm

Hello Matthew,

Is the document "step-by-step psuedo-code guide on ETS" ready for us. I have the same problem as style.

Best rgards

Postby markspencer » Wed Apr 21, 2004 9:16 am


Thank you for your request here is an example written by our software department:

Code: Select all
#include <stdio.h>
#include "adc200.h"

#define MAX_SAMPLES 20000
#define PORT        1

void main(void)
  long times[MAX_SAMPLES];
  short chA[MAX_SAMPLES];
  short chB[MAX_SAMPLES];
  unsigned short   channel_mv[A200_MAX_CHANNELS];
  unsigned short ranges [A200_MAX_CHANNELS] = {A200_5V, A200_5V,A200_5V, A200_5V};
  unsigned long   ns;
  unsigned char   is_slow;

  printf("ETS Example.\n\n");
  // Open the unit on 'port'.
  printf("Opening unit... ");

  short ok = adc200_open_unit(PORT);
  ok ? printf("SUCCESS.\n") : printf("FAILED.\n");

  for(int ch = 0; ch < A200_MAX_CHANNELS; ch++)
    channel_mv[ch] = adc200_set_range(ch, ranges [ch]);
    adc200_set_dc(ch, false);

  // Set up the basic ADC properties, these would be the same
  // with or without ETS.
  adc200_set_range(A200_CHANNEL_A, 7);
  adc200_set_time_units (A200_FS);
  adc200_set_oversample (1);    
  adc200_set_timebase (&ns, &is_slow, 0);   
  adc200_set_trigger(true, A200_SOURCE_A, false, 0, 100);

  // Set up ETS.  This call is explained in the help file.
  adc200_set_ets (10, 50, ETS_SLOW);

  // Set up the unit to collect MAX_SAMPLES samples at a time.
  printf("Collecting samples... ");


  // We're putting our faith in the device becoming ready.
  // This is usually bad karma but we're not asking the device
  // to do anything stressful so it should be okay.

  // Okay our device is ready.  Stop it and retrieve the values.
  adc200_get_times_and_values(times, chA, chB, 10001);

  // Print all the results onto the screen.  This could take some time.
  // probably better to pipe the output into a file.
  for(int i = 0; i < 10001; i++)
    printf("%d, %d\n", times[i], chA[i]);

Best regards,

Mark Spencer
User avatar
Site Admin
Site Admin
Posts: 598
Joined: Wed May 07, 2003 9:45 am

Return to General Software Discussions

Who is online

Users browsing this forum: Google [Bot] and 0 guests