Xref: utzoo comp.sys.ibm.pc:35670 comp.arch:11613 Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!gem.mps.ohio-state.edu!ginosko!uunet!munnari.oz.au!csc!ccadfa!usage!troy@mr_plod.cbme.unsw.oz From: troy@mr_plod.cbme.unsw.oz (Troy Rollo) Newsgroups: comp.sys.ibm.pc,comp.arch Subject: Re: programming the com port Message-ID: <446@usage.csd.unsw.oz> Date: 3 Oct 89 01:51:23 GMT References: <927@eutrc3.urc.tue.nl> Sender: news@usage.csd.unsw.oz Reply-To: troy@mr_plod.cbme.unsw.oz Lines: 64 From article <927@eutrc3.urc.tue.nl>, by wsdwgk@eutrc3.urc.tue.nl (g.v.kooij): wsdwgk> Hello wsdwgk> I want to program the 8250 in a PC clone to communicate with a MIDI device, wsdwgk> which uses the standard MIDI baudrate of 31250 baud. Unfortunately, my docs wsdwgk> say that you can only program it for 9600 (and slower), 19200 and 38400. wsdwgk> Is it possible to do what I want ? Or should I buy additional hardware ?? Yes - you need to know a little about the operation of the UART chip in the COM ports. Firstly, we all know about the documentation for the serial ports - how INT 14H can initialise/operate both COM ports. Don't you believe it. It simply doesn't work. No explaination, no reason, nothing. It just doesn't work. In fact, as far as I know, no IBM communications software uses INT 14H to communicate with the COM ports. So you will need to get a full data sheet for the 8250 and use that. In particular, you will be interested in ports 3f8 and 3f9 when DLAB is 1. These are the baud rate divisor bytes. The procedure to store a value into these is: IN al, 3fbh OR al, 80h OUT 3fbh, al MOV al, low_byte OUT 3f8h, al MOV al, high_byte OUT 3f9h, al IN al, 3fbh AND al, 7fh OUT 3fbh, al The clock rate for the UART is 1.8432 MHz, implying that the value for the divisor should be 589, or 2 (high), 77 (low). I have a sneaking suspicion that this needs to be divided by 16... or perhaps even multiplied by 16..... try all of those and see. Now the problem with INT14? Well, I have had a guess as to what the problem is, but I haven't been able to test it. At boot time, COM interrupts are disabled, and from memory (when I traced INT14), it set up the serial port to use interrupts, which were simply being masked off by the PIC. You should be able to enable them with the following: cli mov al, 13h out 20h, al mov al, 8 out 21h, al mov al, 9 out 21h, al mov al, 0a4h out 21h, al sti Briefly, this reconfigures the PIC to let the normal interrupts (disk, keyboard and real time clock) through, as well as the two serial interrupts. If you have a hard disk, you will need to change 0a4h to 084h, which enables everything except for the printer, and the unused interrupt. Note that this disables the second PIC on an AT or better. If you are using interrupts from devices connected to this, you will need to go through a slightly longer procedure, which I don't have. ___________________________________________________________ troy@mr_plod.cbme.unsw.oz.au Make our greenies useful! The Resident Fascist Put them in the army!