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!
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: