Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Controle stuff from Parallel port

Status
Not open for further replies.

namit

Junior Member level 3
Joined
Apr 1, 2007
Messages
27
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,464
I having few problems with this.

So i have messed around a bit with compiling parallel port programs trying to set ports to 1 and 0. But not quite sure if its working.

1. I put multimeter on one of the top pins and on one of the groud pins and 5.5v are coming out of it. Should this be the case?

2. Then i have the multimerter still on and run the software i have compiled and the voltage does not change. Whats with this?

3. How i expect parallel ports should work is when they are off they should show 0v and when they are on they should show 5v?
 

You should do a search for parallel port control on EDABOARD. This has been discussed threadbare.
You may need separate drivers or access to hardware.
 

Code:
/*
 * example.c: very simple example of port I/O
 *
 * This code does nothing useful, just a port write, a pause,
 * and a port read. Compile with `gcc -O2 -o example example.c',
 * and run as root with `./example'.
 */

#include <stdio.h>
#include <unistd.h>
#include <sys/io.h>
#include <stdlib.h>

#define BASEPORT 0x378 /* lp1 */

int main()
{
  /* Get access to the ports */
  if (ioperm(BASEPORT, 3, 1))
  	{
	 perror("ioperm");
	 exit(1);
	}
  
  /* Set the data signals (D0-7) of the port to all low (0) */
  outb(0, BASEPORT);
  
  /* Sleep for a while (100 ms) */
  usleep(1000000);
  
  /* Read from the status port (BASE+1) and display the result */
  printf("status: %d\n", inb(BASEPORT + 1));

  /* We don't need the ports anymore */
  if (ioperm(BASEPORT, 3, 0))
  	{
	 perror("ioperm");
	 exit(1);
	}

  exit(0);
}

/* end of example.c */
 

What operating system are you running this code on? WinNT, 2000, XP, and Vista require different code.

See the examples on using inpout32.dll from:

**broken link removed**

-Jonathan
 

yes your right.
 

whats the operating system. if you are using any NT based operating system. u will not be able to access the parallel port. NT based operating system does not allow full access to ports except you go throw some dll. which you can learn from this site.

**broken link removed**
have fun
 

Search internet. Lots of articles on using parallel port on Linux.
There are some threads on EDABOARD also, with good info. Search the EDABOARD.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top