home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / os / mswindo / programm / misc / 4180 < prev    next >
Encoding:
Text File  |  1992-12-12  |  2.5 KB  |  64 lines

  1. Newsgroups: comp.os.ms-windows.programmer.misc
  2. From: chris@chrism.demon.co.uk (Chris Marriott)
  3. Path: sparky!uunet!pipex!demon!chrism.demon.co.uk!chris
  4. Subject: Re: Windows' Serial Port 
  5. Distribution: world
  6. References: <57000004@hplvec.LVLD.HP.COM>
  7. Organization: None
  8. Reply-To: chris@chrism.demon.co.uk
  9. X-Mailer: Simple NEWS 1.90 (ka9q DIS 1.19)
  10. Lines: 49
  11. Date: Sat, 12 Dec 1992 18:22:57 +0000
  12. Message-ID: <724184577snz@chrism.demon.co.uk>
  13. Sender: usenet@demon.co.uk
  14.  
  15. In article <57000004@hplvec.LVLD.HP.COM> rozum@hplvec.LVLD.HP.COM writes:
  16.  
  17. >I have just resently started programing in the Windows 3.1 environment.
  18. >
  19. >I have been trying to figure out the serial capability using windows.
  20. >
  21. >My questions are as follows:
  22. >
  23. >1) How do I read and write to a serial port?
  24. >
  25.  
  26. It's pretty easy.  Just use the OpenComm, ReadComm, WriteComm, CloseComm
  27. functions for the actual reading and writing, and "BuildCommDCB" and
  28. "SetCommState" if you want to set the port characteristics.
  29.  
  30. If you're using Windows 3.0, you'll need to keep polling the comms port to
  31. see if data has arrived.  In 3.1 it's a lot easier.  Call
  32. "EnableCommNotification" and you'll the be send "WM_COMMNOTIFY" messages
  33. when data arrives, or when a transmission finishes.
  34.  
  35. >2) How fast can Windows received data without data being over-
  36. >   written in the serial's data register?  In other words,
  37. >   does Windows have a serial buffer, if so how fast can the serial
  38. >   data be retrieved?
  39. >
  40.  
  41. With a "standard" serial port card, the practical limit is probably 9600 bps.
  42. With a 16550-based card you can go to 38400 without too many problems.
  43. If you're using Windows-based comms, it's probably sensible to tell the user
  44. (or,better, get your installation program) to set the "COMxBUFFER" parameter
  45. in the WIN.INI file.  Default value is (I think) 128 bytes.  2k or so is a
  46. more sensible value to use.
  47.  
  48. >3) When working with the serial port is there any special
  49. >   consideration that needs to be taken into account?
  50. >
  51.  
  52. I can't think of any.  Obviously, writing comms software is never exactly
  53. easy, but I've found it easier to do in Windows than DOS.
  54.  
  55. Hope this information helps.
  56.  
  57. --------------------------------------------------------------------------
  58. | Chris Marriott                   | chris@chrism.demon.co.uk            |
  59. |                                  | BIX: cmarriott                      |
  60. | (Still awaiting inspiration      | CIX: cmarriott                      |
  61. |  for a witty .sig .... )         | Compuserve: 100113,1140             |
  62. --------------------------------------------------------------------------
  63.  
  64.