#include #include #include #include #include #include #include main() int i,fd, backward=1,data1,y[400]; unsigned char data; struct ppdev_frob_struct frob; /* i am using strobe signal as a RD of ADC */ frob.mask= PARPORT_CONTROL_STROBE; /* opening the device driver */ fd=open("/dev/parport0", O_RDWR); /* claiming the port */ ioctl(fd, PPCLAIM); /* Here i am doing enabling the ADC with strobe signal and reading the data pins of ADC */ /* Observer here i have included on 3 micro second delay in the loop, that means i should get sampling rate in kilo hertz...... but i can only sample at 300 Hz , this means it is taking approximately 3 milli second */ for(i=25;i<=400;i++) { frob.val= PARPORT_CONTROL_STROBE; /* enabling the ADC */ ioctl(fd,PPFCONTROL, &frob); usleep(3) /* changing the direction of data pins */ ioctl(fd, PPDATADIR, &backward); /* reading the data pins */ ioctl(fd, PPRDATA, &data); y[i] = data; /* disabling the ADC */ frob.val = 0; ioctl(fd, PPFCONTROL, &frob); } ioctl(fd, PPRELEASE); close(fd); }