home / pics / datasheets / corrections / ISA Bus Pinouts / hackaday.com entry / linuxgazette.net entry /
Abstract: Parallel port is the most popular choice for interfacing. The 8 data output lines and sometimes the CONTROL and STATUS ports of the parallel port, used to feed data into the computer, are not sufficient for some complex projects. Some projects require more data I/O lines. This project shows how to get 32 general purpose I/O lines by interfacing the ISA Bus. Though PCI bus can be a candidate for interfacing experiments, its greater speed and feature rich nature poses great complexity in terms of hardware and software to beginners. So this project can be a stepping stone to those thinking of ultimately getting to PCI Bus for interfacing experiments. This project can also be useful for those thinking of making Digital Oscilloscope using PC, A/D and D/A converters, Microcontroller programmer, etc.
Before going into the details of the full project of interfacing the ISA Bus, we have to get familiar with some details given below:
We have considered X(n) as the side that contains components in any standard ISA cards. Similarly, Y(n) is the side that contains the solder. It is very important for you to be clear of the above convention. You will damage your motherboard if you connect just the other way.
The description for most commonly used pins are given below:
* these pins will not be used in this project
Before going into the details of full project lets explain the part that handles the four 8-Bit output lines only. The addresses in the range 0x338 to 0x33B was not used by any devices for input output operations in our computer.
The three 74LS138 ICs handle the address decoding part. We have connected the address lines in a way such that there is short pulse (CLOCK) in the wires (represented by green wire) whenever the address lines contains the address in the range 0x338 to 0x33B and port output (IOW) is requested.
Whenever the 74LS374 get a CLOCK PULSE it latches-in the 8-Bit data present in the data bus. 74LS245 is a 3-STATE Octal Bus Transreceiver. It reduces DC loading on the data bus and allows isolation of data bus when required.
To know that I/O port address are available for use in this project we examine the contents of ioports in the /proc directoryof our linux system.
[root@thelinuxmaniac~]# cat /proc/ioports
0000-001f: dma1
0020-0021: pic1
0040-0043: timer0
.......................
.......................
01f0-01f7: ide0
0378-037a : parport0
037b-037f : parport0
03c0-03df : vga+
.......................
.......................
It is clear from the above output that the addresses 0x238-0x23B and 0x338-0x33B are not being used by any device. Usually this is the case in most computers. However, if this address is occupied by some device, then you have to change the wiring of address lines to three 74LS138 IC (used for address decoding).We describe the address decoding technique here briefly so that you can setup unique address for I/O device we are trying to build according to the non-used address available in your computer.
We use 74LS138, 3-to-8 multiplexer for address decoding. Suppose we want to assign the addresses 0x338-0x33B for four 8-Bit output lines and 0x238-0x23B for four 8-Bit input lines.The binary equivalent of these addresses are:
| Address | ||||||||||||||||
| 0x338 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 |
| 0x339 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 1 |
| 0x33A | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 1 | 1 | 0 | 1 | 0 |
| 0x33B | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 1 | 1 | 0 | 1 | 1 |
| 0x238 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 |
| 0x239 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 1 |
| 0x23A | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 1 | 0 |
| 0x23B | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 1 | 1 |
| Address Lines | A15 | A14 | A13 | A12 | A11 | A10 | A9 | A8 | A7 | A6 | A5 | A4 | A3 | A2 | A1 | A0 |
We observe that address lines A8A1A0 only change in case of all the eight addresses. The whole process of connecting wires to 74LS138 IC is like solving a puzzle. Connect the remaining wires ( A15A14A13A12A11A10A9A7A6A5A4A3A2) to two 74LS138 such that they finally give low output when these lines have the address bits that partially match our addresses (except A8A1A0 ).Now we connect the remaining lines (A8A1A0 A2) to the third 74LS138.All the 8 outputs of this IC is used to select the 74LS374 latches corresponding to input and output addresses after it is NORed with IOR and IOW using 74LS02 to distinguish between memory IO and port IO addressing.
| 74LS138 Truth Table | ||||||||||||
| G1 | G2 | C | B | A | Y0 | Y1 | Y2 | Y3 | Y4 | Y5 | Y6 | Y7 |
| X | H | X | X | X | H | H | H | H | H | H | H | H |
| L | X | X | X | X | H | H | H | H | H | H | H | H |
| H | L | L | L | L | L | H | H | H | H | H | H | H |
| H | L | L | L | H | H | L | H | H | H | H | H | H |
| H | L | L | H | L | H | H | L | H | H | H | H | H |
| H | L | L | H | H | H | H | H | L | H | H | H | H |
| H | L | H | L | L | H | H | H | H | L | H | H | H |
| H | L | H | L | H | H | H | H | H | H | L | H | H |
| H | L | H | H | L | H | H | H | H | H | H | L | H |
| H | L | H | H | H | H | H | H | H | H | H | H | L |
| Refer to datasheet of 74LS138 for details | ||||||||||||
Now we are ready to describe the functioning of the complete circuit that will give us 32 general purpose I/O lines.
The three 74LS138 IC are used for address decoding along with the two 74LS02(2 input NOR gate). Whenever a match is found in the address lines, the respective output line, Y(x) of the third 74LS138 IC (connected to the two 74LS02 IC), gets LOW. These lines along with IOW (and IOR) are connected to the NOR gates (74LS02), which gives HIGH only when the two inputs go LOW simultaneously.
Hence,the output is high only when:
Remember,if we do not consider the second case, our device will conflict with the memory IO operations in the addresses 0x238-0x23B and 0x338-0x33B.
We can see in the circuit diagram that the output lines of NOR gates are connected to the CLOCK pins of 74LS374 latch (represented by green wires).So whenever the above two cases match simultaneously, CLOCK pulse is sent to the respective latch and the data in the data bus is latched-in which appears in the output lines.
isa.c illustrates the some simple coding methods to control and test the I/O lines of the device created in this project.
if(ioperm(OUTPUT_PORT,LENGTH+1,1))
{
...
}
if(ioperm(INPUT_PORT,LENGTH+1,1))
{
...
}
outb(data,port); data = inb(port);
ioperm() gets the permission to access the specified ports from the kernel. outb() and inb() functions defined in sys/io.h helps us write and read to specified port.
It is not easy to get something work by just reading an article like this. At some point you will need to debug your hardware.These debugging techniques will help you(as it has helped us a lot) to find the problem in your work.You will need a multimeter, some LEDs. Remember,what we learned while debugging is that LEDs are the best way to debug hardware of this nature when you don't have sophisticated debugging instruments. Some important techniques we discovered while debugging are:
while(1){
outb(0x80,0x338);
}There are lots of other debugging techniques which you will probably discover by yourself when you get into problems.Try to ensure that the wiring at the connector that gets into the ISA slot is correct.We checked every part of the device(every IC,all those jumper wires,etc) and after debugging for about one week we found that IOW and IOR wires were connected to some other pins of the ISA slot.So, recheck the wiring.We fortunately did not mistake the 12V pin for a 5V pin ;)
We are not responsible for any loss or damage caused by this article.The probability of frying up your motherboard is more than 100% if you work on this project without using your mind.Keep your eyes open and mind alert while doing the wiring and connecting the ICs and verify all the VCC and GND connection everytime you switch on your computer after connecting this device to ISA slot.YOU HAVE BEEN WARNED :). Fortunately the motherboard used for this experiment is still alive and the experiment was a huge success.
Send in your comments and suggestions to:
TLM , 
BAD , 
P2P
ERR: This address bus can address 1MB (2^20=1024bytes) OK : This address bus can address 1MB (2^20=1024 Kbytes)
"One thing all of you do not describe on your well laid out site is the board for your project. Jameco used to sell a breadboard mounted on an ISA bus card. Also one of the locations on the site returns a 403 error message from this browser. Incidentally that's the location for datasheets."
TLM replied:"..... we are from a place where you don't find ready made project boards and enjoy other such luxuary tools.We assembled the whole project by connecting(interlocking) two standard bread boards (which worked quite well).For the connector, we found a ISA expansion slot from a OLD Compaq computer in which we soldered(it took 1 day) all the required pins with jumper wires to get the required data and address lines. Thank you for pointing the "403 error".I corrected it to point to the datasheets of the respective IC at texas instruments website. "
"... It seems to me that with all the output control lines of the input
374's tied to ground, the data bus between the 374's and the 245 would be a
mess of intefering signals from the output of each 374. To help explain myself
better, I have highlighted the area I was talking about on your diagram at
this url:
When I said 'data bus' I meant line A0 - A7 (the thick black
line) that connect all the 374's used for input to the 245.Note that I mean
the lines A0 - A7 in the highlighted area only.The 374's and 245 I refer to
are only the ones that are either partially or completely inside the red box I
have drawn.
The OC' line (pin 1) on each 374 is connected to ground, which
enables the outputs of each 374 all the time and it also keeps it's outputs in
the state that they were when the last clock pulse was recieved, even when the
clock line is LOW because this is how the 374 works according to the
datasheet.With every 374's output enabled, any bits that are HIGH on any 374
connected to A0 - A7 would be grounded or interfered with by the 3 other 374's
that are connected to A0 - A7 too.
E.g:
If A0 on the 374 at address
0x238 was set HIGH and the 3 other 374's (0x239, 0x23A, 0x23B) that are
connected to it through A0 had their outputs set LOW, they would make A0 go
LOW.
This is because each 374 that has an output that is LOW is actually
connecting the output to ground through it's internal circuits. The way to
resolve this problem is to use the OC' line to enable the 374's output onto A0
- A7 only when it is needed. As you probably already know, if we make the OC'
line (pin 1) of a 374 HIGH, it's outputs will go into a high impedance state
which would basically have the effect of disconnecting the outputs of the 374
from lines A0 - A7.
If we connect the clock line that goes to each 374 to
an inverter too and then connect the output of the inverter to the 374's OC'
pin, only the 374 that is currently being read from will have it's output
enabled and therefore the other 374's will not be able to interfere with the
data on line A0 - A7"
Yes, you are right. You can connect an inverter's(whose input comes from
the clock line) output to the OC' pins of 374 latches to prevent the possible
interference. I didn't not know that LOW output of 374 IC lines are actually
connected to ground through it's internal circuits. I have learnt a new (and
very important) thing about 374 ICs today.
I will update my circuit to
implement the idea suggested by you.
Last Updated: 03 August, 2006