28.12.2013 Views

Serial Programming - upload.wikimedia....

Serial Programming - upload.wikimedia....

Serial Programming - upload.wikimedia....

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Serial</strong> COM Port Memory and I/O Allocation<br />

Master OCW1 ($21)<br />

Bit IRQ Enabled Device Function<br />

2 IRQ2 Slave PIC<br />

1 IRQ1 Keyboard<br />

0 IRQ0 System Timer<br />

Slave OCW1 ($A1)<br />

Bit IRQ Enabled Device Function<br />

7 IRQ15 Reserved<br />

6 IRQ14 Hard Disk Drive<br />

5 IRQ13 Math Co-Processor<br />

4 IRQ12 PS/2 Mouse<br />

3 IRQ11 PCI Devices<br />

2 IRQ10 PCI Devices<br />

1 IRQ9 Redirected IRQ2 Devices<br />

0 IRQ8 Real Time Clock<br />

Assuming that we want to turn on IRQ3 (typical for the serial port COM2), we would use<br />

the following software:<br />

Port[$21] := Port[$21] and $F7; {Clearing bit 3 for enabling IRQ3}<br />

And to turn it off we would use the following software:<br />

Port[$21] := Port[$21] or $08; {Setting bit 3 for disabling IRQ3}<br />

If you are having problems getting anything to work, you can simply send this command in<br />

your software:<br />

Port[$21] := 0;<br />

which will simply enable everything. This may not be a good thing to do, but will have to<br />

be something for you to experiment with depending on what you are working with. Try not<br />

to take short cuts like this as not only is it a sign of a lazy programmer, but it can have<br />

side effects that your computer may behave different than you intended. If you are working<br />

with the computer at this level, the goal is to change as little as possible so you don't cause<br />

damage to any other software you are using.<br />

3.5 <strong>Serial</strong> COM Port Memory and I/O Allocation<br />

Now that we have pushed through the 8259 chip, lets move on to the UART itself. While the<br />

Port I/O addresses for the PICs are fairly standard, it is common for computer manufacturers<br />

to move stuff around for the serial ports themselves. Also, if you have serial port devices<br />

that are part of an add-in card (like an ISA or PCI card in the expansion slots of your<br />

computer), these will usually have different settings than something built into the main<br />

35

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!