Parallel data port control.
Parcon is a neat little program that when used with sudo or the like can control the data lines on the parallel port to turn on and off an led or other equipment using proper circuitry. (5 volts only otherwise)
Youtube video
https://www.youtube.com/watch?v=BlCHGiG_CQM
Parallel port.
pin 2 - data line 1 D0 --led--resistor--- pin 18
pin 3 - data line 2 D1 "
pin 4 - data line 3 D2 "
pin 5 - data line 4 D3 "
pin 6 - data line 5 D4 "
pin 7 - data line 6 D5 "
pin 8 - data line 7 D6 "
pin 9 - data line 8 D7 "
pin 18 - ground
To compile:
$ gcc parcon.c -o parcon
To run (l is off and h is on.)
$ sudo parcon 1l 2l 3h 5h 8l
Turns off pins 1,2, and 8. Tuns on pins 3 and 5.
parcon.c
[code]
#include <stdio.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <sys/io.h>
char *binprint( unsigned char x, char *buf )
{
int i;
for( i=0; i<8; i++ )
buf[7-i]=(x&(1<<i))?'1':'0';
buf[8]=0;
return buf;
}
int main( int argc, char *argv[] )
{
char c;
unsigned char val;
char buf[9];
int x;
if( argc<2 )
{
printf(" example usage: parcon 1l 2l 3h 5h 8l\n");
return 2;
}
if( ioperm(888,1,1) )
{
printf("Couldn't get port 888\n");
return 1;
}
val = inb(888);
printf("old = %s\n",binprint(val,buf));
for( x=1; x<argc; x++ )
if( argv[x][1]!='h' )
val &= ~(1<<(argv[x][0]-'1'));
else
val |= 1<<(argv[x][0]-'1');
printf("new = %s\n",binprint(val,buf));
outb(val,888);
return 0;
}
[/code]
How simple it would be to control an rc unit.
Substitute nte123ap for bc547.
Something to look at: http://www.instructables.com/id/No-solder-parallel-port-break-out/ http://www.instructables.com/id/Mini-parallel-port-break-out-cable/ |
Warning the above circuits will not work with a usb parallel interface. The usb requires some kind of latch. Use the circuit below at your own risk as I have not tested it.
Comments
Post a Comment