04-25-2002
1,
0
Join Date: Apr 2002
Last Activity: 25 April 2002, 11:09 AM EDT
Posts: 1
Thanks Given: 0
Thanked 0 Times in 0 Posts
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
privat.eure.de/mora/balkonrt.htm
please help me , that would be nice.
Thanks