home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / alt / lang / basic / 1099 < prev    next >
Encoding:
Text File  |  1993-01-27  |  1.9 KB  |  69 lines

  1. Newsgroups: alt.lang.basic
  2. Path: sparky!uunet!nntp.telebit.com!ronal
  3. From: ronal@telebit.com (Ronal Thompson)
  4. Subject: Re: COM3/4 and 14400 BAUD in Quick Basic?
  5. Message-ID: <C1HC87.8rL@telebit.com>
  6. Sender: news@telebit.com
  7. Nntp-Posting-Host: dolphin
  8. Organization: Telebit Corporation; Sunnyvale, CA, USA
  9. References: <Jan25.233042.68887@yuma.ACNS.ColoState.EDU>
  10. Date: Tue, 26 Jan 1993 21:12:07 GMT
  11. Lines: 56
  12.  
  13. mmb@lamar.ColoState.EDU (Michael Burger) writes:
  14.  
  15. >The subject line says it all.  I need to know if there are any tricks or
  16. >add ons to have QuickBasic recognize COM3 and COM4 plus transmit in 14400
  17. >BAUD.
  18.  
  19.  
  20. This sub program writes DIRECTLY to the uart.
  21.  
  22. sets is the speed you want the uart set to.
  23. setp is the port.
  24. you MUST open the port FIRST (usually at 9600) then call this routine
  25.  
  26.  
  27. The speec that the uart ACTUALLY gets set to is returned in speed(setp)
  28. this allows you to compare what you want to what you got.
  29. (whatta ya mean I can't set the uart to 113.912 baud?!?!)
  30.  
  31.  
  32. SUB BaudSet (sets, setp)
  33.  
  34. SHARED Speed()
  35.  
  36.  
  37.   IF setp = 1 THEN offset = &H3F0
  38.   IF setp = 2 THEN offset = &H2F0
  39.   IF setp = 3 THEN offset = &H3E0
  40.   IF setp = 4 THEN offset = &H2E0
  41.  
  42.   Urate = INT(XTAL / (16 * sets))
  43.   SPEED.LSB = Urate AND &HFF
  44.   IF Urate AND &HFF00 <> 0 THEN
  45.      SPEED.MSB = (Urate AND &HFF00) / 256
  46.   ELSE
  47.      SPEED.MSB = 0
  48.   END IF
  49.  
  50.   a = INP(offset + &HB)               'READ DLAB BYTE
  51.   a = a OR &H80                       'TURN IT ON
  52.   OUT (offset + &HB), a               'WRITE IT
  53.   OUT (offset + &H8), SPEED.LSB       'LOAD LSB
  54.   OUT (offset + &H9), SPEED.MSB       'LOAD MSB
  55.   a = a AND &H7F                      'TURN DLAB OFF
  56.   OUT (offset + &HB), a               'WRITE IT
  57.  
  58.  
  59.   Speed(setp) = INT(XTAL / (16 * Urate))
  60.  
  61.  
  62. END SUB
  63.  
  64.  
  65.  
  66. ronal@telebit.com                These ain't no opinions but my own!
  67. R.THOMPSON65  GEnie                                     
  68. MJWG99A  Prodigy    and remember,  what you think of me is none of my business
  69.