dileep's yard
 
HOME MYSELF E&C TUTORIAL LINKS
 
 
 
 
 
 
 
 
 


Well, well, well..I finally got to it..my first tutorial that is. The trouble was to find something to write a tutorial on..well..err..frankly I could think of no subject on which I was an expert enough to teach someone. But to keep my promise here is the first one of the lot. I've always been interested in both hardware and software, so my first one contains something of both.

1.Port Programming

  • Parallel port
  • Game port
  • This is more on the lines of a data sheet rather than a tutorial. The programs are the only saving grace. Two sorts of ports on a PC that offer a world of experimentation to the casual electronics buff are the parallel port and the game port. The serial port requires some more programming skill but is not that difficult. First I will describe the easier ones and gradually we may even go inside our computer and have fun with the ISA slot (if there are still any left around).

    i) Parallel port

    The parallel port aka printer port is specified on Windows machines usually as LPT1 or LPT2 while on Linux machines it may be usually either /dev/lp0, /dev/lp1. Whatever the name, on PCs its common base address is 0x378 assuming you have only one printer port. Somewhere I read that the addresses 0x3BC and 0x278 are also allotted for printer ports. If in Windows check System Information to find out the address on your machine. For our purpose I will assume it to be 0x378..since that's the one on my machine ;-)

    The only parallel port that I got to study was the 8255 programmable port. However I could find no relationship between that and the one available on my PC. Frankly, it is the research that followed that has led me to write this. The printer port on your system would more likely be a 25 pin female D-connector. Here is the pin details:

    PINDIRSIGNAL
    1IO STROBE : goes "low" -data read in
    2 - 9IO D0 - D7 : data lines
    10I ACK : approx 5micro s pulse -"low" printer has received data and ready for next
    11 IBUSY : "high" - printer can't receive data
    12I PE : "high" -printer out of paper
    13I SLCT : indicates printer is in selected state
    14O AUTO_FEED_XT : "low"-auto feed of paper after every line printed
    15I ERROR : "low" in paper end,offline or error states
    16O INIT : "low" resets printer controller
    17O SLCT_IN : Data entry to printer possible only when pin "low"
    18 - 25  Ground pins

    A low state corresponds to 0V and high to 5V. According to IBM specifications pins 1,14,16 and 17 (control pins) have open collector drivers pulled to 5V through 4.7k resistors (sink 20 mA, source 0.55 mA, high-level output 5.0 V minus pullup). The others sink 24 mA, source 15 mA, and their high level output is min. 2.4 V. The max. low state volt for both is 0.5 V.

    For each port we need to know three addresses

    BASE+0 : Data Port
      A write on this port latches data on to the pins and a read takes in the last values latched on to the pins

    BASE+1 : Status Word
      Read only.
    B0B1B2B3B4B5B6B7
    ReservedINT statusERRORSLCTPEACKBUSY

    BASE+2 : Control Word
      Write only
    B0B1B2B3B4B5B6B7
    STROBEAUTO_FD_XTINITSLCT_ININT ENABLEExtended Mode DirectionReserved

    Now that we have mentioned the basic hardware interface of the parallel port we can move ahead to making some use of all this info. We will try to write some programs utilizing the port in the next tutorial.
     


     

     
     
     
      Tested on IE 6.0 , Netscape 4.7, Mozilla 1.0 Best on 800x600
      mail me