Reading from the parallelport (a/d Converter)

Thread Tools Search this Thread
Top Forums Programming Reading from the parallelport (a/d Converter)
# 1  
Old 04-25-2002
Reading from the parallelport (a/d Converter)

Hi all
For my Radio-astronomy project, I`d like to read from the parallel port. Signals are coming from a 8bit analog/digital converter over the parallelport.
I`d like to read the signal (endless) and print them out on the screen. I mean in a diagramm, with 2 axis. (Time,sec. and Voltage, V ). Like ploting. With enough bitrate and the putpixel function, that should be like a sinusfunction. (you know what I mean).
All this in Linux C code. The main problem for me, is to read and work with the signals over the port. The graphic part isn`t a problem , I will do that with the GNU g2 graphics Lib.
Here my code to read from the port and print it out on the screen. (very simple).

# include <asm/io.h> /* outb() und inb() */
# include <stdio.h> /* Standart I/O */
# include <unistd.h> /* ioperm() */

# define DATA 0x378 /*Paraport Adresse*/
# define STATUS DATA+1 /*Status Port*/
# define CONTROL DATA+2 /*Control Port*/

int main (void)


float x;
int h = 0;
if (ioperm(DATA,3,1))

printf("No permission to access the ports \n");
printf("You must be root\n");
exit (1);

for (h=1; h <= 10000 ; ++h )


x = inb(DATA);
printf(" Signal is %f Volts\n");

return (0);

But the code doesn`t work, I get allways 0 Volts , it doesn`t matter if the converter is attacht or not.
What I did wrong ????

Here is the orginal QBASIC sourcecode for the project. If someone can help me to port the code to C , that would be nice. Or explaind me each step of the code. (only the datacode, not the graphical stuff).
Here is the link

please help me , that would be nice.
# 2  
Old 05-07-2002
Re: Reading from the parallelport (a/d Converter)

Is this for a class or just something you are working on for fun-and-profit? Homework questions are often frowned upon.

But I did see a rather simple bug:

Originally posted by fab102

           x = inb(DATA); 
          printf(" Signal is %f Volts\n");

This should really be:

  x= inb(DATA);
  printf(" Signal is %f Volts\n", x);

Give it a try.
Login or Register to Ask a Question

Previous Thread | Next Thread

5 More Discussions You Might Find Interesting

1. UNIX and Linux Applications

Slideshow with ffmpeg converter

Hi, everyone! I'm on a Debian 9.0 GNU/Linux machine. I'm not a very experienced user, but I do my best to learn. So, I have a bunch of images PNG files. I'm trying to make a slideshow with these using the ffmpeg video converter. I also have an audio WAVE stereo file which I'd like to merge... (0 Replies)
Discussion started by: worov
0 Replies

2. HP-UX

Best text to pdf converter for Hp/UX 11.31

Hi, Can anyone tell me the best converter I can use to convert text to pdf for HP/UX 11.31? Thanks, Linda (0 Replies)
Discussion started by: lnemitz
0 Replies

3. Programming

How can I send data to my C converter?

Hello, I have a directory structure of seismic files that are stored within about 1000 different directories. The directory structure is typically no more than two levels deep, and they are organized by station name and disc name. Each disc name folder contains a text file called 'vdaq.txt' that I... (4 Replies)
Discussion started by: ws6transam
4 Replies

4. Solaris

PCL To PDF Converter

Looking for a Unix command / tool that would convert PCL files into PDF files. I've searched the forum and the web and can't find any. Is it even possible? Cheers. (1 Reply)
Discussion started by: KenLynch
1 Replies

5. Programming

need java to c converter

Hello, does anyone know a program able to convert Java sourcecode to C or C++ sourcecode ? Thanks. Regards... JAGDISH (5 Replies)
Discussion started by: jagdish.machhi@
5 Replies
Login or Register to Ask a Question