Name: IRQ Conflicts / Data Transfer on ISA slot modem.Description: A simplified explanation of IRQ Conflicts and Data Transfer on an ISA slot modem. While not strictly a Visual Basic paper this should be helpful for those of you who may be considering programming in this challenging area.
Controls needed: N/A
Level: All
An AT PC has 16 IRQ's and 8 COM ports.
COM Ports 5 through 8 normally require "special" hardware to be able
to gain access to. Multiport I/O cards are the most popular method to
accomplish this, but that's beyond the scope of IRQ conflicts.
The default settings for COM Ports 1 - 4 are:
COM1 IRQ4 03F8
COM2 IRQ3 02F8
COM3 IRQ4 03E8
COM4 IRQ3 02E8
On most PC's COM1 and COM2 are assigned to external Serial Ports on
the computer's motherboard (which connects to a 9 or 25 pin connector
on the rear of the chassis). These COM ports consist of a HEX memory
address and a UART chip to handle binary (1's and 0's) data
transmissions. The IRQ is not part of the COM Port, it is only used
by the COM Port to "talk" to the CPU.
COM3 and COM4 are not physical COM Ports like COM1 and COM2 are.
They are included in the system BIOS to allow communications access
to internal card devices. They do not have a UART chip of their own.
The UART must be supplied by the device using the COM Port.
A UART chip is a sort of "translator" between the CPU and the device
that is assigned to it. There are several different types of UARTs,
the most common of which on "older" AT computers (286, 386, some 486,
and many laptops) is an 8250, and on most newer systems (many 486 and
Pentium) a 16550. The main difference between the 2 is speed.
An 8250 UART is practically limited to 19,200 bps (bits per second),
while a 16550 is capable of 115,200 bps. A 28.8kbps modem (with
compression) is capable of 115,200bps. Modems using V.34/v.42bis
compression and error control can compress data at "UP TO" 4 times.
28,800 x 4 = 115,200
For our example, we'll think of the UART as the counter person at a
hamburger stand. It doesn't matter how fast the cook (CPU) makes your
food, or how fast a customer (modem) can eat it, because the UART can
only hand you the food (bits out) and take your money (bits in) at a
limited speed.
Wait a minute. If a 28.8kbps modem is limited to 115,200 bps, how
does a 33.6kbps modem with a 16550 UART work?
Not all data is compressible. As a matter of fact, with more
graphically dependent communications, most WWW users with a 28.8kbps
modem will seldom achieve more than 28,800 bits per second (3.2k
bytes per second throughput).
28,800 / 9 = 3200 (or 3.2k)
Most graphics don't compress well. Files that are already compressed
(.ZIP etc.) don't compress well. Text compresses well. But only a
tiny amount of all the information on the internet is text.
Wait a minute, there's only 8 bits in a byte, not 9?
True. 8 bits = 1 byte. But almost all modern modem communications
rely on asynchronous data transfer which requires the modem on one
end to also send a "stop bit" to tell the modem on the other end that
it has sent 1 byte of data. One 9th of all the information transmitted
via modem is a "waste" of bandwidth. It does nothing but tell the
modem "I just sent you 8 bits". However, this is necessary due to the
way analog telephone equipment works. Synchronous data transfers
(some mainframes) don't need stop bits, but need to "talk" at exactly
the same speed, or errors will occur.
So, a 33.6kbps modem can still go faster than a 28.8kbps modem because
neither one ever reaches it's full potential. They are usually working
with data that is already compressed, or graphics, neither of which
can achieve 4 to 1 compression. Even text won't "truly" compress with
a 4 to 1 ratio.
See for yourself. ZIP this file using maximum compression. It should
end up between 6 and 7k. Roughly 2 to 1, not 4 to 1. That's because
the file is too small to benefit from compression. Compression
algorythms work better on larger text files, something relatively
uncommon on the internet nowadays.
So, if I have to transport hamburgers from one burger stand to another,
what's my maximum speed?
The slowest link in the chain. Usually the slower of the 2 modems.
Sometimes the UART in one of the computers, if it's an 8250 model and
both modems are faster than 14.4kbps.
Why?
Because the modem has to use telephone (POTS) lines which work on
a set wavelength. They can only send bits in an ON/OFF state. Thats
what binary means. So, for each wave of the electrical signal (analog),
you can send a set number of bits. It's either ON or OFF. This rate
happens to average roughly 3.1 kilohertz, or 3,100 cycles per second.
Now, there's a bunch of complex math that allows 16 bits to "fit" on
an audio waveform. Telephones are for speech, hence the audio formulas
must be used (Nyquist's theory). However, the process of converting
digital to anaolg and putting those bits on the waveform prohibits
you from ever achieving all 16. Due to quantization losses, the math
eventually equates to roughly 33,600 bits per second.
So, unless the telephone companies change the (government regulated)
frequency (KHz) they operate on, analog modems will never be able to
go faster than 33.6kbps.
Well, how do those newfangled 56k modems work then?
#1, they don't work the same way at 56k speeds as a "normal" modem
does. #2 they require VERY good telephone lines that will carry a
signal at almost 4.0kHz (The absolute maximum bandwidth limitation).
16 bits x 4,000 cycles = 64,000 bps (single channel ISDN)
They also don't convert the digital signal when it is received.
Therefore, they don't "lose" bits due to quantization.
They do still lose throughput due to line noise. And most telephone
connections can't quite maintain 4.0 kHz, so you actually end up a
little lower than 64kbps. The good people at US Robotics decided that
an "average" maximum speed would be around 56kbps. So, If your 56k
modem connects lower than that, it's due to line noise or signal loss
(having a telephone connection that cannot reliably transmit at
4.0 kHz). 56k modems (in theory) are capable of 64,000 bits per
second. But then, reality is quite different than theory. Besides,
marketing a product named 64k that NEVER went 64k would make a lot of
people very unhappy.
Enough COM Ports, UARTS, and data rates.
How does the data get from one place to the other?
It has to orginate from the CPU, where a program is running and tells
the modem to send or receive the data. It has to pass it to the UART,
which passes it to a device (modem in this case) that sends it to
another modem that sends it through it's UART and then to the other
computer's CPU.
Outside of the computer, telephone lines carry the signal as described
above. And the modem talks directly to the UART. So that leaves us
with how to get the data from the CPU (cook) to the UART chip (counter
person).
That's what the IRQ accomplishes. The IRQ is the "pathway" the
computer uses to send data to a HEX based memory address (cash
register #) where the UART (worker) can give it to the modem
(customer).
Now, the UART chip obviously doesn't walk over and pick up bits from
the CPU. They travel back and forth on the pathway (bus) that we'll
call a "conveyor belt" for illustration purposes. Each "bus" has it's
own number, or IRQ. (There's actually one serial bus with different
parts to it. For simplicity, we'll say they're separate.)
Now, what would happen if 2 devices were using that pathway (IRQ) and
were available to respond to that data? Don't COM1 and COM3 both use
IRQ4, and COM1 shares IRQ3 with COM3?
By default yes. But until you add another device (customer) that will
ask for more burgers (bits), nothing happens. There's no worker (UART)
to interfere with the data. If you do install more devices, you should
either disable the external serial port that is using the IRQ, or set
the new device to use a different one.
So, what if another device (customer) was installed that used the same
IRQ (conveyor)?
Bad things.
The UART doesn't care if he's been told to do anything or not. He's
such a good worker. If a customer (modem) is in the burger stand
asking for burgers at cash register #3 (COM3) using conveyor belt #4
(IRQ4), and another customer (Mr. Modem, Mr. Sound Card, Mr. Mouse,
Mr. Ethernet card, etc.) is somewhere in the same burger stand
(Computer), asking for burgers (bits) coming down the same conveyor
belt, he'll take the order. That's his job. So, if there's 2 workers
both taking orders from the same conveyor, something has got to give.
Customer at register #3 (internal modem COM3) asks for his 8 burgers
(bits). Customer at register #1 (serial port COM1 with mouse) asking
for 8 burgers. UART (worker) at register 3 goes and gets 8 burgers and
sells them to the customer (modem). UART at COM1 goes and gets 8 bits
and sells them to the mouse. The burgers come down the conveyor 8 at
a time. There's inevitably a mix up, and someone gets the wrong
burgers. After all, the burgers aren't marked, the customer just asked
for the next 8. The only way to tell the burgers apart is by which
conveyor they are on.
Mr. Modem has notices it right away. "This is an ERROR!" he screams
then he leaves, because he knows he can't do business properly.
Mr. Modem makes an annoying "click" sound when he gets angry.
Mr. Mouse eats the wrong burgers and gets sick. He quits responding.
Close the burger stand and reopen it to get Mr. Mouse the right
burgers to eat and he'll be alright until Mr. Modem comes back.
Ok, so 2 devices can't use the same IRQ at the same time. Why can't
they use the same IRQ (conveyor) if only one is asking for burgers?
Sometimes they can. If a manager knows ahead of time (polling device
driver) they can deal with each customer separately (EISA). Or, if the
device is not interrupt driven. (DOS printer drivers often are not
interrupt driven and write directly to the port rather than through an
interrupt.)
But (ISA bus) managers (IRQ controllers) without special training, who
see a customer in line can still respond to that customer even if he's
not doing anything. After he waits long enough, he says "Hey! how
about some service in this joint?" (Idle devices generate Error
interrupts.) So, the management asks what he wants, and he replies
"Nothin' much, I'm just standing here, but I thought you might like
to know that." And he keeps repeating the process over and over.
This is espescially true if that customer is a COM Port (modem).
(ISA bus drivers are NOT open collector.) After all, isn't that what
COM Ports are supposed to do? Communicate? Sometimes the management
does a cash register check, (an error interrupt is triggered) and ends
up talking (exchanging burgers) with the customer.
If the customer is slow enough (less than 14.4kbps) the counter worker
is often fast enough to get the correct burgers before a manager
exchanges burgers from the same conveyor. However, when the customer
(modem) is fast enough to ask for burgers at the same time the manager
is exchanging burgers with another customer, someone usually ends up
eating the wrong food.
Wait a minute... The I/O bus runs at 33MHz. Not 14.4kbps!
Yes the bus speed is faster than 14kbps. It actually has to do with
2 interrupts triggered (high state) at the same time causing a short
on the I/O bus. High speed I/O devices (such as a 14.4kbps and faster
modems) have a much higher incidence of problems, but it is entirely
possible with any device. This part concerns how fast the modem's UART
talks to the I/O bus, not how fast the modem talks to another modem.
Some burger stands will notice the customer and refuse to do business,
because they learned in management school (BIOS) that if 2 different
customers try to order from different cash registers, but use the same
conveyor, there will be trouble. Some of them even put a sign in the
window when they first open the burger stand that reads "Conveyor belt
conflict. Hit F1 to fix it before something bad happens." This burger
stand just wants to stay in business.
What happens is the workers will fight each other for the same
burgers. They get the wrong ones and burgers end up in strange places
as they fall off the conveyor belt. Someone else in the burger stand
could slip on a stray burger and fall down. "That burger wasn't
supposed to be there!" cries Mr. Sound Card. Mr. Sound Card usually
makes strange noises and talks really funny when he eats the wrong
burgers.
Other customers who eat the wrong burgers make different sounds. Mr.
Ethernet eats a LOT of burgers. When he gets sick and falls down, the
sound is usually a big "Crash". I've personally seen Mr. Ethernet get
soooooo ill from eating the wrong burgers that he pukes bigtime all
over the burger stand. He pukes and pukes so much that he gets burger
pieces in all the cookbooks. Now the cook can't read how to fry
burgers anymore. Oh well, just clean out the whole burger stand and
order another set. They were getting kinda dirty anyway. The cookbooks
come on floppy disks (usually labeled "Burgers Plain 6.22") or on a
CDRom labeled either "Burgers 95" or "Burgers NT".
I've also seen devices get so violently ill that the wrong burgers
get delivered to the management school library (CMOS). You can always
tell when this has happened, because management school refuses to let
the burger stand open up. The teachers go on strike in the band room
and play music to pass the time. The song goes: *BEEP*BEEP*BEEP*,
until some of the customers leave the burger stand. Teachers on strike
aren't very musical, but they know how to shut down a burger joint.
So, I guess the moral of the story is:
Keep your conveyor belts working properly,
or you'll have to order new cookbooks!
Note: This text is not perfectly accurate in all descriptions. It is
designed to illustrate IRQ conflicts and data transfer in laymans
terms, while using the basis of actual I/O operations.
Copyright (c) 1997 Russ Ricca
russ@spinward.com
Content of this text may be freely reproduced in it's complete form.
Burgers Plain, Burgers 95, and Burgers NT are trademarks of
MicroBurger Incorporated. Used without permission.