Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Parallel port circuit ground

Status
Not open for further replies.

SimonW

New Member
Your patience is appreciated

Dear Sirs,

After some tinkering about I am able to switch on LED's on my parallel port via a c program.. However...

If I run the following program:

#include <stdio.h>
#include <dos.h>
#include <stdlib.h>

int main(void)
{

outportb(0x378, 'A');
}

compile it then run the leds change accordingly, then change the character and compile it works
tedious!!
********************************
If I run the following program:

#include <stdio.h>
#include <dos.h>
#include <stdlib.h>
#include <iostream.h>

int main(void)
{
int val;
start: cin >> val;
outportb(0x378,val);
goto start;
}

It compiles correctly, but when I press a key for the val variable, the whole PC shutsdown!!


I think it is something to do with the common ground of the external PSU and the Parallel port ground.

Circuit configuration..

external PSU +5v connected to 8 resistors which power 8 leds, the LED grounds are connected to a ULN2803A.
The eight data pins connected to the inputs of the ULN2803A

The ground of the PSU and the parallel port connected together and to the ground of the ULN2803.

Cheers!
 
Last edited:
I think it is something to do with the common ground of the external PSU and the Parallel port ground.
I would think it has more to do with your code because the first code sample works fine. Does the PC crash if you run this:

int main(void)
{
int val;
start: cin >> val;
goto start;
}
 
When you say "shutdown"? Does it do a shutdown, lock up, reboot?

Is there a getc or getchar in the C you have?
 
CPU was overheating

Dear All,

kchriste - yes this works fine

cyb0rg777 - The parallel port is locked out from normal programming in XP
I use Userport which allows the programmer access.

I was doing a virus scan of my hard drive when it just turned off, after opening the computer up I noticed the 'CPU overheat' LED was on.

Thanks for all your replies, such a simple cause!

Cheers
 
Mind you a modern XP system could be so busy that even with direct parallel access the timeing may not be good enough.
 
What operating system are you using?

It'll probably work under Windows 9x but it certainly won't work under XP.
 
Hero, it does, if you install the userio driver. Like I said though, the actualy application time contention issue will occur if the system isn't very very idle.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top