Collecting data with ADC-212 in ETS mode

 
Post new topic   Reply to topic    Pico Technology Forum Index -> General Software Discussions
Author Message
Style
Guest





PostPosted: Tue Jan 14, 2003 3:10 am    Post subject: Collecting data with ADC-212 in ETS mode Reply with quote

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,

1:
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

2:
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.
Back to top
matthew
Site Admin
Site Admin


Joined: 25 Sep 2002
Posts: 133
Location: Cambridgeshire, UK

PostPosted: Thu Jan 16, 2003 9:27 am    Post subject: ETS in Pseudo-Code Reply with quote

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,
Back to top
yrlin
Guest





PostPosted: Tue Apr 20, 2004 1:52 pm    Post subject: where can I find the document Reply with quote

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
Back to top
markspencer
Site Admin
Site Admin


Joined: 07 May 2003
Posts: 610

PostPosted: Wed Apr 21, 2004 9:16 am    Post subject: Reply with quote

Hi,

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

Code:
#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_channels(A200_CHANNEL_A);
  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... ");

  if(!adc200_run(10001))
    printf("FAILED.\n");
  else
    printf("SUCCESS.\n");

  // 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.
  while(!adc200_ready());

 
  // Okay our device is ready.  Stop it and retrieve the values.
  adc200_set_time_units(A200_FS);
  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]);
    }
 
  adc200_close_unit(PORT);
}


Best regards,
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Pico Technology Forum Index -> General Software Discussions
All times are GMT
Page 1 of 1

 


Pico Technology topic RSS feed 
Powered by phpBB © 2001, 2005 phpBB Group