home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / sys / atari / st / 16500 < prev    next >
Encoding:
Internet Message Format  |  1992-11-11  |  3.8 KB

  1. Path: sparky!uunet!pipex!demon!cix.compulink.co.uk!andre
  2. Newsgroups: comp.sys.atari.st
  3. From: andre@cix.compulink.co.uk (Cygnus Software Ltd)
  4. Subject: Re: How to handle the RS232 under GFA-Basic?
  5. Reply-To: andre@cix.compulink.co.uk
  6. Date: Wed, 11 Nov 1992 10:25:00 +0000
  7. Message-ID: <memo.743027@cix.compulink.co.uk>
  8. Sender: usenet@gate.demon.co.uk
  9. Lines: 73
  10.  
  11.  
  12. nienaber@sonne.zedat.fu-berlin.de (H. Nienaber) wrote:
  13. >I am writing a pttle rogram wich will read the data from a GOULD 1604-
  14. >Oscilloscope. The serial port is with XBIOS(15,1,0,-1,...) for 9600Bps and
  15. >XON, XOFF configurated. The scope is also set to this parameters. The problem
  16. >is: the serial interface dont stop the incoming data-stream even when i dont
  17. >get the byte stream.
  18. >[stuff deleted]
  19. >If i connect my terminal (CoNnect :-)) to the scope i can pause the incoming
  20. >stream of data with ^S and continue with ^Q.
  21. >In my program i use the INPAUX$-command to get the incoming data. The GFA-Basic
  22. >is a version 3.5(or so) wich was distributed some weeks ago by the german TOS-
  23. >magazine.
  24. >Is there anyone who has experience with the RS232 und GFA or some tips, 
  25. >routines, sources?
  26.  
  27. First, sorry for the delay in replying, I don't know if anyone has already
  28. responded, but here goes:
  29.  
  30. My first tip would be to avoid INPAUX$. I know it's a nice command (I used
  31. to use it a lot too), but it seems to screw up CTS/RTS flow control completely,
  32. and I've no doubt it does the same for XON/XOFF too. I assume it works by
  33. pulling bytes directly from the RS232 buffer, and then adjusting the pointers,
  34. which must confuse the OS in some way - at least, it does with my extended
  35. buffers, anyway.
  36.  
  37. Stick to multiple INP?(1) and INP(1) commands, or their GEMDOS equivalents.
  38. If that still doesn't work, try sending Control-S directly from your program
  39. and see if that stops the data stream correctly.
  40.  
  41. If all else fails, simply extend the buffer size to give you more time
  42. to read the data. Mind you, this is only a solution for bursts of data; if
  43. the scope keeps sending data all the time, you'll only be postponing the
  44. inevitable.
  45.  
  46. To enlarge the RS232 buffer, first use iorec(0) [XBIOS(14,0)] which returns
  47. the address of the current serial I/O table. This is a structure with the
  48. following contents:
  49.  
  50.   LONG  Pointer to the current RS232 buffer in memory
  51.   WORD  Current size of the buffer (in bytes)
  52.   WORD  Head index (in bytes) i.e. pointer to next unread byte of data
  53.   WORD  Tail index (in bytes) i.e. pointer to last byte of data waiting
  54.   WORD  Low watermark (in bytes)
  55.   WORD  High watermark (in bytes)
  56.  
  57. This table is followed in memory by another, identical, one for outgoing
  58. data, but that doesn't usually need to be changed.
  59.  
  60. The High and Low watermarks are used for flow control - when there are
  61. more unread bytes in the buffer than allowed for by the High value, a
  62. 'stop flow' command is issued. The start flow will only be issued when the
  63. buffer has been emptied down to the Low level. A good rule of thumb for
  64. these would be around 75% to 90% of the buffer size for the High value, and
  65. around 50% to 75% for the low value, depending on how quickly your device
  66. responds to XOFF.
  67.  
  68. To change the buffer size, first store the existing values so you can
  69. reset them later, then MALLOC a nice big buffer and store its address
  70. into the first LONG. Don't go beyond about 32k. Next store the buffer size
  71. into the next WORD, and set up the High and Low watermark values
  72. accordiningly. Finally, zero the Head and Tail indexes. It's best to do all
  73. this while there's no data coming in from the RS232 port, otherwise you'll
  74. lose some of it.
  75.  
  76. I hope at least some of the above was helpful.
  77.  
  78. Andre
  79.  
  80. Andre Willey                       |  Email: andre@cix.compulink.co.uk
  81. 7 Oaklands Road, Sutton Coldfield, |         andre@cix.uucp
  82. West Midlands, B74 2TB, England.   |         ...{mcsun}!uknet!cix!andre
  83. Phone: (UK) 021-308-5251           |  "Il est mort, Jean Luc..."
  84.