Test and Measurement Forum

ADC100 and Linux

Having problems ? let us know the details here

ADC100 and Linux

Postby Martin » Wed Nov 17, 2004 4:57 pm

Have recently bought ADC100. Using Mandrake 10.1, installed software as per instructions, ran ./a100test, selected port 0, but just get o/p consisting of series of of 0's (chA) and 1's (chB) when using choice C (continuous reading), with voltage of around 1volt applied to BNC channel A. System is dual boot and all works fine under Win98. lsmod shows up parport module ok. Any suggestions?

more details

Postby Martin » Fri Nov 19, 2004 12:05 pm

Hope someone can help. Applying a dc voltage to chA in steps of 0.05V and reading the ADC100 with the program listed below gives strange results. At 0.5V applied, the ADC output value printed by the progarm is 2047 and this value does not alter until the applied voltage reaches 0.7V, at which point the ADC output value printed becomes 1790. Any help much appreciated.

#include <stdio.h>
#include <sys/time.h>
#include <unistd.h>
#include <asm/ioctl.h>

#include "../kernel/pico_lnx.h"

#define MAX_SAMPLES 10000
int file;

int main (int argc, char ** argv)
char line [80];
char dev_name [20];
char ch;
int port;
int value;

printf ("Pico ADC100 example for Linux V1.0\n");

/* file = adc100_open (0); */
sprintf (dev_name, "%s%d", DEVICE_FILE_NAME, 0);
printf("%s \n", dev_name );

file = open (dev_name, 0);
if (file == 0)
printf ("Unable to open port\n");
exit (99);

value = 100;
ioctl (file, IOCTL_PICO_GET_VERSION, &value);
printf("Version %d\n", value);
value = 100;
ioctl (file, IOCTL_PICO_GET_HW_VERSION, &value);
printf("Hardware Version %d\n", value);

value = 100;
ioctl (file, IOCTL_PICO_SET_PRODUCT, &value);

ioctl (file, IOCTL_PICO_SET_SCALE, &value);

/*value = (ADC100_CHANNEL_A << 16) + ADC100_RANGE_20V;*/
printf("%d\n", value);
ioctl (file, IOCTL_PICO_SET_RANGE, &value);
ioctl (file, IOCTL_PICO_SET_RANGE, &value);

ioctl (file, IOCTL_PICO_SET_READ_MODE, &value);

int j;
for (j=0; j<1; j++) {
ioctl (file, IOCTL_PICO_GET_VALUE, &value);
printf(" %d \n", value);


Return to Getting Started

Who is online

Users browsing this forum: No registered users and 0 guests