OpenBCM V1.13 (Linux)

Packet Radio Mailbox

DB0FHN

[JN59NK Nuernberg]

 Login: GUEST





  
PA2AGA > TCPDIG   05.09.96 05:47l 163 Lines 5990 Bytes #-10896 (0) @ EU
BID : TCP_96_181C
Read: DG7DAH GUEST
Subj: TCP-Group Digest 96/181C
Path: DB0AAB<DB0KCP<DB0ZKA<DB0LX<DB0RBS<DB0SEL<DB0ZDF<DB0AIS<DB0NDK<DB0ACH<
      DB0ACC<PI8DRS<PI8DAZ<PI8GCB<PI8WFL<PI8MBQ<PI8VNW
Sent: 960905/0107Z @:PI8VNW.#ZH2.NLD.EU #:61792 [Hoek v Holland] FBB5.15c
From: PA2AGA@PI8VNW.#ZH2.NLD.EU
To  : TCPDIG@EU

Received: from pa2aga by pi1hvh with SMTP
	id AA17010 ; Thu, 05 Sep 96 00:47:03 UTC
Received: from pa2aga by pa2aga (NET/Mac 2.3.61/7.1) with SMTP
	id AA00004162 ; Wed, 04 Sep 96 19:14:43 MET
Received: from pa2aga-10 by pa2aga with SMTP
	id AA00004141 ; Wed, 04 Sep 96 19:08:12 MET
Received: from pa2aga-10 by pa2aga-10 (NET/Mac 2.3.61/7.1) with SMTP
	id AA00005431 ; Wed, 04 Sep 96 19:08:07 MET
Date: Wed, 04 Sep 96 18:11:15 MET
Message-Id: <tcp_96_181C>
From: pa2aga
To: tcp_broadcast@pa2aga-10
Subject: TCP-Group Digest 96/181C
X-BBS-Msg-Type: B

in the PC, and they can even be used as inputs.

To use them as inputs, write 0100 binary to the bottom four bits of
the control register.  This sets the outputs all high, so they are
pulled high by the pullup resistors (typically 4700 ohms).  An
external device can then pull them low, and you can read the pin
states by reading the control register.  Remember to allow for the
inversion on three of the pins.

If you are using this technique, the control register is not strictly
'read/write', because you may not read what you write (or wrote).

4  SAMPLE PROGRAM - DETERMINE WHETHER A PORT IS BIDIRECTIONAL

This program reports for LPT1, LPT2, and LPT3 whether the port exists
and whether it is bidirectional, i.e. setting the bidirectional control
bit causes the port to go into high-impedance (tri-state) mode.  This
program is written for Borland C.  Change outportb() and inportb() to
outp() and inp() for Microsoft C, I think.  I did not have a machine
with a bidirectional port with which to test this program fully, so
please drop me a line if you can confirm that it does or doesn't work.

Save this code to BIDIR.C and compile with:

   bcc -I<include_path> -L<library_path> bidir.c

--------------------------- snip snip snip ---------------------------
#include <dos.h>
#include <process.h>
#include <stdio.h>

/* The following function returns the I/O base address of the nominated
   parallel port.  The input value must be 1 to 3.  If the return value
   is zero, the specified port does not exist. */

unsigned int get_lptport_iobase(unsigned int lptport_num) {
   return *((unsigned int far *)MK_FP(0x40, 6) + lptport_num);
   }

/* Checks whether the port's data register retains data, returns 1 if
   so, 0 if not.  The data register retains data on non-bidirectional
   ports, but on bidirectional ports in high impedance (tri-state)
   mode, the data register will not retain data. */

unsigned int test_retention(unsigned int iobase) {
   outportb(iobase, 0x55);                      /* Write a new value */
   (void) inportb(iobase);                      /* Delay */
   if (inportb(iobase) != 0x55) {
      return 0;                                 /* Did not retain data */
      }
   outportb(iobase, 0xAA);                      /* Write another new value */
   (void) inportb(iobase);                      /* Delay */
   if (inportb(iobase) != 0xAA) {
      return 0;                                 /* Did not retain data */
      }
   return 1;                                    /* Retained data alright */
   }

void report_port_type(unsigned int portnum) {
   unsigned int iobase, oldctrl, oldval;
   iobase = get_lptport_iobase(portnum);
   if (iobase == 0) {
      printf("LPT%d does not exist\n", portnum);
      return;
      }
   oldctrl = inportb(iobase+2);
   outportb(iobase+2, oldctrl & 0xDF);          /* Bidir off */
   (void) inportb(iobase);                      /* Delay */
   oldval = inportb(iobase);                    /* Keep old data */
   if (test_retention(iobase) == 0) {
      printf("LPT%d appears to be faulty!\n", portnum);
      outportb(iobase+2, oldctrl);
      outportb(iobase, oldval);
      return;
      }
   outportb(iobase+2, oldctrl | 0x20);          /* Bidir on */
   printf("LPT%d %s bidirectional\n", portnum,
      (test_retention(iobase)) ? "is not" : "is");
   outportb(iobase+2, oldctrl);                 /* Put it back */
   outportb(iobase, oldval);                    /* Restore data */
   return;
   }

void main(void) {
   unsigned int portnum;
   for (portnum = 1; portnum < 4; ++portnum)
      report_port_type(portnum);
      exit(0);
   }
--------------------------- snip snip snip ---------------------------

5.  FILE TRANSFER PROGRAM CABLES

The parallel-to-parallel cable is used by DRDOS's INTERLNK program.
Apparently Laplink and FastLynx cables are the same.  The pin-to-pin
connection between two male 25-pin D-sub connectors is: 2-15, 3-13,
4-12, 5-10, 6-11, and the reverse: 15-2, 13-3, 12-4, 10-5, and 11-6,
and ground: 25-25.  This requires eleven wires.  If you have spare
wires, link some extra grounds together.  Pins 18 to 25 inclusive are
grounds.  A very long cable may be unreliable, limit it to 10 metres.

6.  DISCLAIMER

In no event shall the author be liable for any damages whatsoever
for any loss relating to this document.  Use it at your own risk!

End of the PC Parallel Port Mini-FAQ.

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

------------------------------

Date: Tue, 3 Sep 1996 10:08:57 +0100 (BST)
From: Alan Cox <alan@cymru.net>
Subject: Parallel Port IP?

> > can do it thru a LapLink cable. But how about xNOS? Especially the
> > DJGPP version of KA9Q?
> 
> You can do this with the PLIP packet driver (from the Crynwr collection).

Make sure you have a modern PLIP driver if you do this. The old PLIP driver
fakes a multicast address as its source address (FD:FD:aa:bb:cc:dd) and
Linux won't talk to it thinking its burbling crap (which it is). 

Alan

------------------------------

End of TCP-Group Digest V96 #181
******************************

You can send your message for this bulletin
to:     tcp-group@pa2aga           on .AMPR.ORG-net
or:     tcpaga@pi8vnw.#zh2.nld.eu  on BBS-net
        ------

NOT TO: pa2aga@pa2aga  or  pa2aga@pi8vnw.#zh2.nld.eu  PLEASE!!

It will get posted automatically within a few days





Read previous mail | Read next mail


 07.07.2026 05:38:13lGo back Go up