home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / dcom / modems / 10998 < prev    next >
Encoding:
Text File  |  1992-07-22  |  4.4 KB  |  87 lines

  1. Newsgroups: comp.dcom.modems
  2. Path: sparky!uunet!rde!ksmith!keith
  3. From: keith@ksmith.uucp (Keith Smith)
  4. Subject: Re:  Serial and Parallel interface ??????
  5. Organization: Keith's Computer, Hope Mills, NC
  6. Date: Thu, 23 Jul 92 01:17:59 GMT
  7. Message-ID: <1992Jul23.011759.14499@ksmith.uucp>
  8. References: <zgam_3l.wolfgang@netcom.com> <clemon.08gc@lemsys.UUCP> <1992Jul21.205557.29123@cc.ic.ac.uk>
  9. Lines: 76
  10.  
  11. In article <1992Jul21.205557.29123@cc.ic.ac.uk> cmaae47@cc.ic.ac.uk writes:
  12. >Even mint condition 1981 PCs are able to transfer 250 kbit/s through a serial 
  13. >line, bit serial, analog, via the floppy disk controller. So far I have only
  14. >seen one machine incapable of maintining flow control and timing on floppy
  15. >disk transfers, and that also only in very special conditions.
  16.  
  17. Yup, If it has nothing else to do but concentrate on sending data via
  18. on-board dma, bringing everything else to a grinding halt it can do that
  19. rate FOR A SHORT PERIOD OF TIME.  Simple fact of the matter is The 8250
  20. Serial I/O chip with a 1 in the Divisor Latch Sends at 115K Baud.  The
  21. clock will not allow speeds any faster than this.  PERIOD.  Now assuming
  22. you don't have to READ the data from somewhere else first, and can just
  23. use your 4.77Mhz 8088 to pump data from RAM into the port with out
  24. instructions, You get about 41 clock cycles worth of CPU instructions
  25. per byte you desire to send:
  26.  
  27. 1.8432Mhz / 16 = 115K
  28.  
  29. therefore 4.77 / 1.8432 * 16 = 41.4 cpu cycles / byte at 115K baud
  30.  
  31. >
  32. >It is just that serial (RS232) ports were perceived to be slow and in need of
  33. >very careful processing. Thus the OSes start creaking, sort of like anything
  34. >that tries to shovel tons of coal with an elaborate golden teaspoon.
  35.  
  36. Nothing elaborate about it.  It's simple math.  You can very quickly run
  37. out of available clock cycles.  Especially if you desire to do anything
  38. else, like write the information you are processing to disk.
  39.  
  40. With a little more math and a small bit of reading you can find out that
  41. the AT bus runs at 8Mhz.  Bytes are transferred 1 at a time (as opposed
  42. to 2 at a time to a 16bit controller) to a standard serial card. so:
  43.  
  44. 8 / 1.8432 * 16 = 69.4 Bus cycles / byte
  45. 33 / 1.8432 * 16 = 286 CPU cycles / byte
  46.  
  47. Now my assembly manual says an insb takes about 15 clocks on a 386 so as
  48. long as your 386 doesn't have a whole lot else to do your fine.
  49.  
  50. An 8088 on the other hand has no such instruction.  An in to a register
  51. is 10 clocks, and an out from register to memory indirect is 10 more. 
  52. Then the increment to the indirect register takes 3 more.  That's 23 of
  53. 41 available clock cycles on the venerable PC assuming no additional
  54. wait states on the bus.  So as long as we don't have to turn around and
  55. write it to a disk in there and stay within a 64K segment we are good to
  56. go.  Now we know why the floppy controller uses programmed DMA. 
  57.  
  58. Now for the poor soul who want's to transfer a 1M file from a 8088 XT/PC
  59. let me assure you you will not MAINTAIN anything CLOSE to 100K buad,
  60. even to a floppy disk.  you just don't have the available CPU cycles.
  61.  
  62. Lastly,
  63.  
  64. If you desire to do something else the context switch time for an
  65. interrupt will immediately swamp an 8088.  A simple register push on an
  66. 8088 takes 15 clocks.  Assuming you are pushing 3 registers (AX, DS, DX)
  67. and loading DS,DX You you already have a receive buffer overrun at 115K
  68. before your done setting up for the in.
  69.  
  70. On the 386 pushes take 3 clocks and pusha takes 18.  this gives you
  71. enough time to set everything up and read, and go back to what you were
  72. doing before, with a about half of the cycles to spare.  Unfortunately
  73. this will degrade response on a multi-tasking system, if an interrupt
  74. must be serviced for EVERY CHARACTER.  Also, Nothing on the system can
  75. stall servicing of the interrupt for more than 400 or so clock cycles or
  76. you will overrun the input latch on the 16450/8250.  That is why a '550
  77. chip with a 16 byte FIFO is so desireable.  It doesn't interrupt until a
  78. FIFO level is reached (say 12 chars) so you get about 1200 clock cycles
  79. before you overrun a buffer at 115K, and the amount of time for the
  80. Context switch is is spread over 12-16 characters which can be PIO'd out
  81. with inb fairly rapidly.  Still 115K interrupt driven is gonna really
  82. strain the system.  1200 clocks ain't THAT many instructions. 
  83. -- 
  84. Keith Smith          uunet!ksmith!keith            5719 Archer Rd.
  85. Digital Designs      BBS 1-919-423-4216            Hope Mills, NC 28348-2201
  86. Somewhere in the Styx of North Carolina ...
  87.