CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Jul 1999
    Posts
    4

    Serial Port Communication (NT)

    I'm using VC 6.0++ and Windows NT 4.0. I have to implement a serial
    port communication with the following requirements:

    - Port initialization: baudrate, parity, etc.

    - Writing to port: I have to write strings to the port.

    - Receiving from the port: I have to receive strings from the port.
    Single characters would be ok as well. It has to be done with polling
    and not with messaging, which also should be easier. Is there a buffer I
    can read from? If yes, is it also possible to clear that buffer?

    I want to write my own class with these three methods. It would be great
    if somebody could give me some help, because I'm not that experienced in
    this.

    Thanks a lot
    Daniel


  2. #2
    Join Date
    May 1999
    Location
    Germany, Bayern
    Posts
    15

    Re: Serial Port Communication (NT)

    Hi,

    Do you have to implement a specific protocol?
    I have the same problem, but my communication builds on a protocol (3964R from Siemens), so I prefer to use a tool because then I don't have to care about handshake and all this stuff.



  3. #3
    Join Date
    Jul 1999
    Posts
    8

    Re: Serial Port Communication (NT)

    You can try this:

    http://www.codeguru.com/misc/serialport.shtml

    Hope it helps!


  4. #4
    Join Date
    Jul 1999
    Posts
    4

    Re: Serial Port Communication (NT)

    I don't have to implement a certain protocol. I just have to read strings to the port and to write strings from the port.

    Gruesse nach Deutschland
    Daniel


  5. #5
    Join Date
    May 1999
    Location
    Germany, Bayern
    Posts
    15

    Re: Serial Port Communication (NT)

    Oh,
    If you want to use standard classes, I think I'm not able to tell you anything new that you don't know alreay.

    Good luck!


  6. #6
    Join Date
    Jul 1999
    Posts
    13

    Re: Serial Port Communication (NT)

    1. CreateFile( "COMx", ..... ).
    2. SetupComm( ... )
    3. WaitForCommEvent(...)
    4. ReadFile(...)
    5. CloseHandle(...)
    Any question ? Write to me [email protected] ! I have more own examples.

    Eugene.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured