Sponsored Content
Top Forums Programming Reading from the parallelport (a/d Converter) Post 20369 by fab102 on Thursday 25th of April 2002 08:25:43 AM
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
privat.eure.de/mora/balkonrt.htm

please help me , that would be nice.
Thanks
 

5 More Discussions You Might Find Interesting

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

2. 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

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. 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

5. 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
OUTB(2) 						     Linux Programmer's Manual							   OUTB(2)

NAME
outb, outw, outl, outsb, outsw, outsl, inb, inw, inl, insb, insw, insl, outb_p, outw_p, outl_p, inb_p, inw_p, inl_p - port I/O SYNOPSIS
#include <sys/io.h> unsigned char inb(unsigned short int port); unsigned char inb_p(unsigned short int port); unsigned short int inw(unsigned short int port); unsigned short int inw_p(unsigned short int port); unsigned int inl(unsigned short int port); unsigned int inl_p(unsigned short int port); void outb(unsigned char value, unsigned short int port); void outb_p(unsigned char value, unsigned short int port); void outw(unsigned short int value, unsigned short int port); void outw_p(unsigned short int value, unsigned short int port); void outl(unsigned int value, unsigned short int port); void outl_p(unsigned int value, unsigned short int port); void insb(unsigned short int port, void *addr, unsigned long int count); void insw(unsigned short int port, void *addr, unsigned long int count); void insl(unsigned short int port, void *addr, unsigned long int count); void outsb(unsigned short int port, const void *addr, unsigned long int count); void outsw(unsigned short int port, const void *addr, unsigned long int count); void outsl(unsigned short int port, const void *addr, unsigned long int count); DESCRIPTION
This family of functions is used to do low-level port input and output. The out* functions do port output, the in* functions do port input; the b-suffix functions are byte-width and the w-suffix functions word-width; the _p-suffix functions pause until the I/O completes. They are primarily designed for internal kernel use, but can be used from user space. You must compile with -O or -O2 or similar. The functions are defined as inline macros, and will not be substituted in without optimiza- tion enabled, causing unresolved references at link time. You use ioperm(2) or alternatively iopl(2) to tell the kernel to allow the user space application to access the I/O ports in question. Failure to do this will cause the application to receive a segmentation fault. CONFORMING TO
outb() and friends are hardware-specific. The value argument is passed first and the port argument is passed second, which is the opposite order from most DOS implementations. SEE ALSO
ioperm(2), iopl(2) COLOPHON
This page is part of release 3.53 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. Linux 2012-12-31 OUTB(2)
All times are GMT -4. The time now is 09:51 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy