i am looking for a 5 volt signal

2002-10-27 Thread David Nicholas Kayal
I'm looking for a 5 volt signal.

I have wires plugged into pins 2 and 25 of the parallel port.

I have written a small program:

#include 
#include 
#include 

int main()
{
  int fd;
  while(1)
{
  ioctl(fd, PPISDATA, 255);
}
}

and have it executing...

I have a multi-meter with the positive lead touching the pin 2 wire and the negative 
lead touching pin 25 wire, but i am not registering any voltage.

=(

I am sad.

I have recompiled my kernel to disable plip and enable ppi.  The following is a snipet 
of my kernel configuration:

# Parallel port
device  ppc0at isa? irq 7
device  ppbus   # Parallel port bus (required)
device  lpt # Printer
#
# 2002 oct 27 - removed plip and added ppi.
#
#device plip# TCP/IP over parallel
device  ppi # Parallel port interface device
#device vpo # Requires scbus and da

any help would be very much appreciated


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: i am looking for a 5 volt signal

2002-10-27 Thread David Nicholas Kayal
Shouldn't the fact that the signal is in a while loop keep the 5 volt
signal going?  Isn't the parallel port being blasted with the
value 255 over and over again?

The serial port will not fulfill what i am ultimately trying to achive. I
am trying to have the parallel port to control 8 relays each turing
on/off based upon which bit i send out to the port.

On Sun, 27 Oct 2002 [EMAIL PROTECTED] wrote:

> try using also the serial port and a logical buffer
>
> the 5 volt signal is very fast and your multimeter is maybe not to fast
>
> > I'm looking for a 5 volt signal.
> >
> > I have wires plugged into pins 2 and 25 of the parallel port.
> >
> > I have written a small program:
> >
> > #include 
> > #include 
> > #include 
> >
> > int main()
> > {
> >   int fd;
> >   while(1)
> > {
> >   ioctl(fd, PPISDATA, 255);
> > }
> > }
> >
> > and have it executing...
> >
> > I have a multi-meter with the positive lead touching the pin 2 wire and
> > the negative lead touching pin 25 wire, but i am not registering any
> > voltage.
> >
> > =(
> >
> > I am sad.
> >
> > I have recompiled my kernel to disable plip and enable ppi.  The
> > following is a snipet of my kernel configuration:
> >
> > # Parallel port
> > device  ppc0at isa? irq 7
> > device  ppbus   # Parallel port bus (required)
> > device  lpt # Printer
> > #
> > # 2002 oct 27 - removed plip and added ppi.
> > #
> > #device plip# TCP/IP over parallel
> > device  ppi # Parallel port interface device
> > #device vpo # Requires scbus and da
> >
> > any help would be very much appreciated
> >
> >
> > To Unsubscribe: send mail to [EMAIL PROTECTED]
> > with "unsubscribe freebsd-hackers" in the body of the message
>
>
>
> -
> "UNIXMEXICO la comunidad *nix en todo México!"
> http://www.unixmexico.org/
>
>
>


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: i am looking for a 5 volt signal

2002-10-27 Thread David Nicholas Kayal
I'm having problems just using 1 bit fromt he parallel port at this time.


On Sun, 27 Oct 2002 [EMAIL PROTECTED] wrote:

> the parallel port then is ok
> now you can use a logical multiplexer
>
> and from the paralel port you can use just 3 bits
>
> take a look to the data sheets ot this multiplexer
>
> http://www.cs.utah.edu/classes/cs3700/handouts/pdf/MM74C150.pdf
>
> the input of the multiplexer will be
>
> 000
> 001
> 010
> 011
> 100
> 101
> 110
> 111
>
> and at the ouput you will have a leched 1 or 0 ( 5volts or 0 volts) the
> ones you can aply to your relays
>
>
> > Shouldn't the fact that the signal is in a while loop keep the 5 volt
> > signal going?  Isn't the parallel port being blasted with the
> > value 255 over and over again?
> >
> > The serial port will not fulfill what i am ultimately trying to achive.
> > I am trying to have the parallel port to control 8 relays each turing
> > on/off based upon which bit i send out to the port.
> >
> > On Sun, 27 Oct 2002 [EMAIL PROTECTED] wrote:
> >
> >> try using also the serial port and a logical buffer
> >>
> >> the 5 volt signal is very fast and your multimeter is maybe not to
> >> fast
> >>
> >> > I'm looking for a 5 volt signal.
> >> >
> >> > I have wires plugged into pins 2 and 25 of the parallel port.
> >> >
> >> > I have written a small program:
> >> >
> >> > #include 
> >> > #include 
> >> > #include 
> >> >
> >> > int main()
> >> > {
> >> >   int fd;
> >> >   while(1)
> >> > {
> >> >   ioctl(fd, PPISDATA, 255);
> >> > }
> >> > }
> >> >
> >> > and have it executing...
> >> >
> >> > I have a multi-meter with the positive lead touching the pin 2 wire
> >> and the negative lead touching pin 25 wire, but i am not registering
> >> any voltage.
> >> >
> >> > =(
> >> >
> >> > I am sad.
> >> >
> >> > I have recompiled my kernel to disable plip and enable ppi.  The
> >> following is a snipet of my kernel configuration:
> >> >
> >> > # Parallel port
> >> > device   ppc0at isa? irq 7
> >> > device   ppbus   # Parallel port bus (required)
> >> > device   lpt # Printer
> >> > #
> >> > # 2002 oct 27 - removed plip and added ppi.
> >> > #
> >> > #device  plip# TCP/IP over parallel
> >> > device   ppi # Parallel port interface device
> >> > #device  vpo # Requires scbus and da
> >> >
> >> > any help would be very much appreciated
> >> >
> >> >
> >> > To Unsubscribe: send mail to [EMAIL PROTECTED]
> >> > with "unsubscribe freebsd-hackers" in the body of the message
> >>
> >>
> >>
> >> -
> >> "UNIXMEXICO la comunidad *nix en todo México!"
> >> http://www.unixmexico.org/
> >>
> >>
> >>
> >
> >
> > To Unsubscribe: send mail to [EMAIL PROTECTED]
> > with "unsubscribe freebsd-hackers" in the body of the message
>
>
>
> -
> "UNIXMEXICO la comunidad *nix en todo México!"
> http://www.unixmexico.org/
>
>
>


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: i am looking for a 5 volt signal

2002-10-27 Thread Matthew Dillon

:
:Shouldn't the fact that the signal is in a while loop keep the 5 volt
:signal going?  Isn't the parallel port being blasted with the
:value 255 over and over again?
:
:The serial port will not fulfill what i am ultimately trying to achive. I
:am trying to have the parallel port to control 8 relays each turing
:on/off based upon which bit i send out to the port.
:
:..
:> try using also the serial port and a logical buffer
:>
:> the 5 volt signal is very fast and your multimeter is maybe not to fast
:>
:> > I'm looking for a 5 volt signal.

Uh guys.  Parallel port digital outputs do not generally have a whole
lot of drive.  I really doubt a parallel port output could drive a 
relay.

And it's probably TTL level equivalents, not CMOS.  Even if you ganged
the output bits together I doubt you would get enough drive out of 
them.

A serial port output (+/-12 but you may see +/-10 or -5 and +12 or other
out-of-spec combinations) is far more likely to be useful in driving
a relay, though again there will not be much drive.  It would be far
better to supply the power you need from another source, like a +5V
power supply.  Or just get a wallwart with DC output and run it through
a linear regulator.  At least then you aren't likely to burn the house
down :-)

-Matt

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: i am looking for a 5 volt signal

2002-10-27 Thread Terry Lambert
Matthew Dillon wrote:
> Uh guys.  Parallel port digital outputs do not generally have a whole
> lot of drive.  I really doubt a parallel port output could drive a
> relay.

Depends on the amperage the relay draws.  8-).

I used to use the paralell port output to drive a pulse dialer and
"off hook" for a modem that didn't have the capability itself (a
300 baud accoustic couple modem).  One of the reasons I laugh when
I see the "war dialer" scene in War Games.

That said, you damn well better not draw any real current from the
parallel port, if you want to avoid cooking it.  In other words, do
*not* use it to power something external, and if you are using it
for a 1/0 signal to something that wangts to switch a lot of volts
and amps from a real power supply, consider using an SCR, instead.


> 
> And it's probably TTL level equivalents, not CMOS.  Even if you ganged
> the output bits together I doubt you would get enough drive out of
> them.
> 
> A serial port output (+/-12 but you may see +/-10 or -5 and +12 or other
> out-of-spec combinations) is far more likely to be useful in driving
> a relay, though again there will not be much drive.  It would be far
> better to supply the power you need from another source, like a +5V
> power supply.  Or just get a wallwart with DC output and run it through
> a linear regulator.  At least then you aren't likely to burn the house
> down :-)

Get a brick and use an SCR to switch the brick.

-- Terry

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: i am looking for a 5 volt signal

2002-10-27 Thread Wilko Bulte
On Sun, Oct 27, 2002 at 11:19:15AM -0800, Matthew Dillon wrote:
> 
> :
> :Shouldn't the fact that the signal is in a while loop keep the 5 volt
> :signal going?  Isn't the parallel port being blasted with the
> :value 255 over and over again?
> :
> :The serial port will not fulfill what i am ultimately trying to achive. I
> :am trying to have the parallel port to control 8 relays each turing
> :on/off based upon which bit i send out to the port.
> :
> :..
> :> try using also the serial port and a logical buffer
> :>
> :> the 5 volt signal is very fast and your multimeter is maybe not to fast
> :>
> :> > I'm looking for a 5 volt signal.
> 
> Uh guys.  Parallel port digital outputs do not generally have a whole
> lot of drive.  I really doubt a parallel port output could drive a 
> relay.

Get a solid state relay. Parallel ports used to be build with TTL
chips, but these days drive power is probably much less.

> And it's probably TTL level equivalents, not CMOS.  Even if you ganged
> the output bits together I doubt you would get enough drive out of 
> them.

Yup.

-- 
|   / o / /_  _ [EMAIL PROTECTED]
|/|/ / / /(  (_)  Bulte Arnhem, the Netherlands

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: i am looking for a 5 volt signal

2002-10-27 Thread GB Clark
On Sun, 27 Oct 2002 11:19:15 -0800 (PST)
Matthew Dillon <[EMAIL PROTECTED]> wrote:

> 
> :
> :Shouldn't the fact that the signal is in a while loop keep the 5 volt
> :signal going?  Isn't the parallel port being blasted with the
> :value 255 over and over again?
> :
> :The serial port will not fulfill what i am ultimately trying to achive. I
> :am trying to have the parallel port to control 8 relays each turing
> :on/off based upon which bit i send out to the port.
> :
> :..
> :> try using also the serial port and a logical buffer
> :>
> :> the 5 volt signal is very fast and your multimeter is maybe not to fast
> :>
> :> > I'm looking for a 5 volt signal.
> 
> Uh guys.  Parallel port digital outputs do not generally have a whole
> lot of drive.  I really doubt a parallel port output could drive a 
> relay.
> 
> And it's probably TTL level equivalents, not CMOS.  Even if you ganged
> the output bits together I doubt you would get enough drive out of 
> them.
> 
> A serial port output (+/-12 but you may see +/-10 or -5 and +12 or other
> out-of-spec combinations) is far more likely to be useful in driving
> a relay, though again there will not be much drive.  It would be far
> better to supply the power you need from another source, like a +5V
> power supply.  Or just get a wallwart with DC output and run it through
> a linear regulator.  At least then you aren't likely to burn the house
> down :-)
> 
>   -Matt
> 
> To Unsubscribe: send mail to [EMAIL PROTECTED]
> with "unsubscribe freebsd-hackers" in the body of the message
> 
Two things here...

One, most multimeters do not have the senistivity to monitor a pulse like this, they 
will just
see 0 volts.  You really need a scope or a probe to see this.

Second, you'll can't drive an analog relay off of Pport without a latch or something.  
A transistor
setup would work just fine.

Check out http://www.circuitcellar.com/ for stuff that would work...

GB

-- 
GB Clark II | Roaming FreeBSD Admin
[EMAIL PROTECTED] | General Geek 
   CTHULU for President - Why choose the lesser of two evils?

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: i am looking for a 5 volt signal

2002-10-27 Thread Matthew Dillon

:
:Matthew Dillon wrote:
:> Uh guys.  Parallel port digital outputs do not generally have a whole
:> lot of drive.  I really doubt a parallel port output could drive a
:> relay.
:
:Depends on the amperage the relay draws.  8-).
:
:I used to use the paralell port output to drive a pulse dialer and
:"off hook" for a modem that didn't have the capability itself (a
:300 baud accoustic couple modem).  One of the reasons I laugh when
:I see the "war dialer" scene in War Games.
:
:That said, you damn well better not draw any real current from the
:parallel port, if you want to avoid cooking it.  In other words, do
:*not* use it to power something external, and if you are using it
:for a 1/0 signal to something that wangts to switch a lot of volts
:and amps from a real power supply, consider using an SCR, instead.
:
:-- Terry

Huh. I would have expected you to use the current loop on the
phone line to power the dialer.  There's a significant amount
of power available there, though you would have to isolate the
circuit since the common mode could be upwards of one or two
hundred volts.

In anycase, I can only concur on the danger of ganging the parallel
power output bits.  A single chip is driving those outputs and is
almost certainly not rated to deal with a maximal current draw from
all of them at once for long periods of time.  It could fry.  Though
if it's a TTL output there isn't much current there anyway (TTL can
sink a lot of current but it can't source it, the equivalent
resistance to VCC is fairly high). 

Serial port pins are a much better bet.  Serial port outputs can handle
shorts far better then parallel port outputs and since the voltages
are higher you can draw a good chunk of current out of them.  Use diodes
to rectify the serial port outputs (be sure to orient them properly,
BAR side is positive.  Flip the orientation for the negative supply).


-o--o positive supply to circuit
 |  (bar)   |  (around +10V)
DIODE DIODE
 |  |
 serial-pin serial-pin
 |  |
DIODE DIODE (OPTIONAL IF YOU NEED A NEGATIVE
 |  (bar)   |   SUPPLY)
-o--o negative supply to circuit
  (around -10V)


Then:

positive supply to circuit -[LINREG] +5V to circuit

Use a 100uF (or more), a 10uF, and 0.1uF capacitor on the input
side of the regulator and a 0.1uF capacitor on the output side of
the regulator.  The 0.1's should be as close to the linear regulator
as possible.  i.e.:

---supplyo-oo[LINREG]--o +5V supply
 | ||   5V |
 CAP  CAP  CAPCAP
 | ||  |
 gnd  gnd  gndgnd
 100   10   0.1   0.1

You can gang the serial outputs (by wire-dioding them together).
The driver chips are far better able to handle that sort of thing,
and since the output is +12V (well, usually +9 to +12) you can pull
more current before it drops down to < 5V, so you can power
5V circuitry from it (up to a point).  I expect you can get at least
20mA @ 5V out of ganged serial port outputs, possibly more.

You could use an SCR but linear regulators are far, far better
(a little 3-pin TO92 package linear regulator).  And linear regulators
have overcurrent protection as well (for themselves, not for whatever
is powering them).  It's fairly difficult to blow one up.

-Matt
Matthew Dillon 
<[EMAIL PROTECTED]>


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: i am looking for a 5 volt signal

2002-10-27 Thread Terry Lambert
Matthew Dillon wrote:
> Huh. I would have expected you to use the current loop on the
> phone line to power the dialer.  There's a significant amount
> of power available there, though you would have to isolate the
> circuit since the common mode could be upwards of one or two
> hundred volts.

Telephone is 24 volts DC, which generally falls off to 18v at the
customer permises.  Ring is AC line voltage, to support mechanical
ringers (e.g. 120v AC between ring, 24v DC between tip and ring).  I
worked as a lineman on private phone systems starting around age 14.
8-).


> You could use an SCR but linear regulators are far, far better
> (a little 3-pin TO92 package linear regulator).  And linear regulators
> have overcurrent protection as well (for themselves, not for whatever
> is powering them).  It's fairly difficult to blow one up.

My SCR suggestion was based on the idea that you wanted to switch
lots of volts/amps using Vcc chip levels to do it.  THere are actually
two threads here now: doing that, and lighting up a small number of
LEDs (mention hardware projects, and the EE hobbiest wannabes come
out of teh woodwork to ask for circuits... 8-)).

Here is a good beginning parallel port project site:

LED:http://www.free-hosting.lt/stech/lights/lights.htm
Relay:  http://www.armory.com/~rstevew/Public/Tutor/SolidStateRelaysDIY.txt

Or a kit you can buy, with schematics:

http://www.u-net.com/epr/electron/issue2/feat0302.htm

Or more serious prebuilt stuff:

http://www.lptek.com/io.htm

And here is a wider selection, that has parallel port and serial
port projects:

http://ourworld.compuserve.com/homepages/Bill_Bowden/

...and I'm disclaiming any responsibility, if you cook something
with any of this...

-- Terry

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: i am looking for a 5 volt signal

2002-10-27 Thread soralx
> In anycase, I can only concur on the danger of ganging the parallel
> power output bits.  A single chip is driving those outputs and is
> almost certainly not rated to deal with a maximal current draw from
> all of them at once for long periods of time.  It could fry.
The output signals don't go straight from the chip - do they?
I've seen few KOhms resistors on most boards for each output pin.

27.10.2002; 19:32:00
[SorAlx]  http://cydem.zp.ua/

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: i am looking for a 5 volt signal

2002-10-28 Thread Joe Sunday
On Sun, Oct 27, 2002 at 09:12:33AM -0800, David Nicholas Kayal wrote:

> I'm looking for a 5 volt signal.
> 
> I have wires plugged into pins 2 and 25 of the parallel port.
> 
> I have written a small program:
> 
> #include 
> #include 
> #include 
> 
> int main()
> {
>   int fd;
>   while(1)
> {
>   ioctl(fd, PPISDATA, 255);
> }
> }

PPISDATA actually takes an int* argument. (The man page may be a tad
confusing here.)

Try
int main() {
int fd;
int d = 255;
fd = open( "/dev/ppi0", O_RDWR );

ioctl( fd, PPISDATA, &d );

return 0;
}

The port should hold the last value you send to it, there's no need
to continually refresh it.

--Joe

-- 
Joe Sunday <[EMAIL PROTECTED]>  http://www.csh.rit.edu/~sunday/
Computer Science House, Rochester Inst. Of Technology

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: i am looking for a 5 volt signal

2002-10-29 Thread Bernd Walter
On Mon, Oct 28, 2002 at 08:56:35AM -0500, Joe Sunday wrote:
> On Sun, Oct 27, 2002 at 09:12:33AM -0800, David Nicholas Kayal wrote:
> 
> > I'm looking for a 5 volt signal.
> > 
> > I have wires plugged into pins 2 and 25 of the parallel port.
> > 
> > I have written a small program:
> > 
> > #include 
> > #include 
> > #include 
> > 
> > int main()
> > {
> >   int fd;
> >   while(1)
> > {
> >   ioctl(fd, PPISDATA, 255);
> > }
> > }
> 
> PPISDATA actually takes an int* argument. (The man page may be a tad
> confusing here.)

No it takes an u_int8_t* exactly as written in the manpage.
Using an int doesn't work in all cases.
I have no idea what part of the manpage is confusing.

> Try
> int main() {
> int fd;
> int d = 255;
u_int8_t d = 255;

> fd = open( "/dev/ppi0", O_RDWR );
> 
> ioctl( fd, PPISDATA, &d );
> 
> return 0;
> }

-- 
B.Walter  COSMO-Project http://www.cosmo-project.de
[EMAIL PROTECTED] Usergroup   [EMAIL PROTECTED]


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: i am looking for a 5 volt signal

2002-10-29 Thread Joe Sunday
On Tue, Oct 29, 2002 at 05:08:45PM +0100, Bernd Walter wrote:

> On Mon, Oct 28, 2002 at 08:56:35AM -0500, Joe Sunday wrote:
> > On Sun, Oct 27, 2002 at 09:12:33AM -0800, David Nicholas Kayal wrote:
> > 
> > > I'm looking for a 5 volt signal.
> > > 
> > > I have wires plugged into pins 2 and 25 of the parallel port.
> > > 
> > > I have written a small program:
> > > 
> > > #include 
> > > #include 
> > > #include 
> > > 
> > > int main()
> > > {
> > >   int fd;
> > >   while(1)
> > > {
> > >   ioctl(fd, PPISDATA, 255);
> > > }
> > > }
> > 
> > PPISDATA actually takes an int* argument. (The man page may be a tad
> > confusing here.)
> 
> No it takes an u_int8_t* exactly as written in the manpage.
> Using an int doesn't work in all cases.
> I have no idea what part of the manpage is confusing.
> 
> > Try
> > int main() {
> > int fd;
> > int d = 255;
> u_int8_t d = 255;
> 
> > fd = open( "/dev/ppi0", O_RDWR );
> > 
> > ioctl( fd, PPISDATA, &d );
> > 
> > return 0;
> > }

My bad. Yeah, it takes a u_int8_t* argument, not an int* (Serves me right for
doing it off the top of my head instead of looking at my code). However, 
the original poster had it simply taking some integer value  rather than 
a pointer.

The man page says this:
 Each command takes a single u_int8_t argument, transferring one 
   byte of data.

Which, to me at first glance, can read as a u_int8_t argument, rather
than a u_int8_t* argument if you're new to using ioctls.  The example 
further down the man page has it properly taking an pointer.

--Joe

-- 
Joe Sunday <[EMAIL PROTECTED]>  http://www.csh.rit.edu/~sunday/
Computer Science House, Rochester Inst. Of Technology

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: i am looking for a 5 volt signal

2002-10-29 Thread Matthew Dillon

:The output signals don't go straight from the chip - do they?
:I've seen few KOhms resistors on most boards for each output pin.
:
:27.10.2002; 19:32:00
:[SorAlx]  http://cydem.zp.ua/

It depends on the chip.  Most modern serial driver chips have series
resistors on the outputs, inside the chip, and do not need any external
current limiting (which is what the resistor does in effect).  Parallel
port chips typically do not have output resistors and instead depend
on beefy TTL output stages, and a good motherboard manufacturer will put
series resistors on those pins.  All modern chips have diode protection
on their outputs but you can still zap them (static shock it to death).
Serial pins tend to be far, far more robust then parallel port pins
due to having to go through level converters to get the right voltages
on outputs and to be able to handle +/-12V on inputs.  For example,
most serial driver chips can handle up to +/-25V on their inputs before
they blow up.  Try putting even +12V on a parallel port pin and you
will likely fry the chip, even with an external series resistor, and
an external series resistor alone will not stop a big static shock,
only a Zener diode is fast enough to do that.  An external series
resistor is there strictly for current limiting purposes.

-Matt
Matthew Dillon 
<[EMAIL PROTECTED]>

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: i am looking for a 5 volt signal

2002-10-29 Thread soralx
> :The output signals don't go straight from the chip - do they?
> :I've seen few KOhms resistors on most boards for each output pin.
> An external series resistor is there strictly for current
> limiting purposes.
Yep, that's why I asked if manufacturers usually put external
resistors.
I tried to short all the wires together and on the ground :)
from an old ISA paraller port controller card - it didn't blow up.
So the message to the author of this thread: check for resistors
on your mboard, if it's the old one, in series with the outputs,
so that you can be sure that you won't kill the controller
during experiments...

28.10.2002; 18:05:15
[SorAlx]  http://cydem.zp.ua/

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: i am looking for a 5 volt signal

2002-11-04 Thread Andre Albsmeier
On Sun, 27-Oct-2002 at 09:12:33 -0800, David Nicholas Kayal wrote:
> I'm looking for a 5 volt signal.
> 
> I have wires plugged into pins 2 and 25 of the parallel port.
> 
> I have written a small program:
> 
> #include 
> #include 
> #include 
> 
> int main()
> {
>   int fd;
>   while(1)
> {
>   ioctl(fd, PPISDATA, 255);
> }
> }
> 

I had at least one machine where I had to drive the STROBE signal
to actually get the data appear on the bus. The program attached
below did the trick. It does a little bit more so here is a quick
explanation:

I wanted to physically push the RESET button of another machine
(running Windoze, btw. :-)). To make things a bit more robust
I used all 8 lines of data which are attached to a HC 688 (iirc)
whose second 8 bit input is hardwired to the value 0x5A. Its
output drives an optocoupler whose output is connected to the
RESET connector of the Windoze box. The power was supplied by
all output capable lines of the parallel port (8 data, strobe,
some control lines) which are all connected via diodes and a
resistor to a capacitor. The program first drives the 8 databits
high to charge the capacitor for 5 seconds. It then puts the
0x5A word on the wire for one second. This is when the HC 688's
output goes high and drives the optocoupler to reset the windoze
box.

If you look at the program you'll find that every dataoutput
is surrounded by the apprpropriate STROBE action.

Hth,

-Andre

#include 
#include 
#include 
#include 
#include 
#include 
#include 

int Fd;

void send( u_int8_t byte )
{
  u_int8_t  myc, tmp;

  printf( "Sending %02X\n", byte );

  if( ioctl( Fd, PPIGCTRL, &myc ) == -1 )   // save old control
err( EX_IOERR, "save control" );

  myc &= ~STROBE & ~PCD;// strobe high
  tmp = myc;
  if( ioctl( Fd, PPISCTRL, &tmp )== -1 )
err( EX_IOERR, "set control" );

  if( ioctl( Fd, PPISDATA, &byte ) == 1 )   // set my code
err( EX_IOERR, "set data" );

  tmp = myc | STROBE;   // strobe low
  if( ioctl( Fd, PPISCTRL, &tmp )== -1 )
err( EX_IOERR, "set control" );

  tmp = myc;
  if( ioctl( Fd, PPISCTRL, &tmp )== -1 )// strobe high
err( EX_IOERR, "set control" );
}

int main( int argc, const char* argv[] )
{
  if( (Fd = open( "/dev/ppi0", O_RDWR)) <= 0 )
err( EX_IOERR, "open /dev/ppi0" );
  
  send( 0xFF ); // charge C
  sleep( 5 );

  send( 0x5A ); // send code
  sleep( 1 );
  send( 0xFF ); // disable code

  return( 0 );
}