Thread: rs232 with win api

  1. #1
    Registered User
    Join Date
    Dec 2005
    Posts
    6

    rs232 with win api

    hi, ive a problem:
    i want to controll the pins of the rs232.

    Is there any other way to controll the pins of the rs232 without win api?

    My OS is Xp. Or how can do that in C?

    There is a library conio.h with the funktion outp()
    why it isnt work by me??

  2. #2
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    outp() works on older, DOS-based Windows versions, like Windows 95 and 98. It fails all the time on Windows 2000 and XP.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  3. #3
    Registered User
    Join Date
    Dec 2005
    Posts
    6
    ahh ok.

    and is there any way to controll the pins in xp or 2k?
    if yes....which one, and how does it work?

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659

  5. #5
    Registered User
    Join Date
    Dec 2005
    Posts
    6
    wow, this a lil bit hard...

    what ive to do here?
    can anybody give me an sample how to use this in C?

  6. #6
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    You didn't say which compiler you were using.

    > can anybody give me an sample how to use this in C?
    You could try and google for some of those functions to see if there are examples used elsewhere on the web.

  7. #7
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    There is a library conio.h with the funktion outp()
    That might be a hint. But still, tell us what your compiler is.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  8. #8
    Registered User
    Join Date
    Dec 2005
    Posts
    6
    my compiler is gcc (dev-cpp).

    a question: y is it soo hard to controll the rs232?

    conio.h doesnt work with outp().

  9. #9
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    I meant that it might be a hint to your compiler since MSVC doesn't have it.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  10. #10
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    A google search (for "rs232") turned up a lot of hits.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  11. #11
    Registered User
    Join Date
    Dec 2005
    Posts
    6
    aah i ve already done this.....

    but didnt found something which was working...
    Win Api should work...

    but how?

    may i have to link "create file" in my C code ?
    or what?

  12. #12
    Registered User
    Join Date
    Aug 2005
    Posts
    1,267
    the good-old-days of simple MS-DOS rs232 programming are loooong over. Programmers no longer have direct access to the hardware. So now you have to go through appropriate device drivers. In MS-Windows operating system that means using win32 api functions, or using MSComm.dll functions -- I haven't used the MSComm.dll but a lot of programmers do. and programming rs232 on *nix isn't any easier.

  13. #13
    Registered User
    Join Date
    Dec 2005
    Posts
    6
    mmh soo please can u show me how?

    i havent much coding expierence like u. There are many tricks- sure...but i dont know them. Never done this before. I never used any dll files or win api files.

    soo can u please show me how? I only want to controll the outputs of rs232. only the 3 one.

    please i want to learn how it works...

  14. #14
    Registered User CompiledMonkey's Avatar
    Join Date
    Feb 2002
    Location
    Richmond, VA
    Posts
    438
    Quote Originally Posted by alaturka
    please i want to learn how it works...
    You keep saying you want to learn but instead of searching around and finding the answers, you're asking everyone here to do it for you. It doesn't sound like anyone around here has done much of it for themselves, so go figure it out for yourself.

  15. #15
    Registered User
    Join Date
    Aug 2005
    Posts
    1,267
    Here is a description of a comm ActiveX control that you can use in an MFC program. I don't know if you can use ActiveX controls in console or win32 api programs. Its pretty simple stuff with VC++ 6.0 compiler.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. help with this
    By tyrantil in forum C Programming
    Replies: 18
    Last Post: 01-30-2005, 04:53 PM
  2. win api literature
    By DMaxJ in forum Windows Programming
    Replies: 5
    Last Post: 04-30-2004, 03:25 PM
  3. inner workings of win API functions
    By SAMSAM in forum Windows Programming
    Replies: 1
    Last Post: 02-23-2003, 06:17 PM
  4. Win API
    By Marky_Mark in forum Windows Programming
    Replies: 4
    Last Post: 10-23-2001, 12:57 PM
  5. Rich edit control example Win API
    By Echidna in forum Windows Programming
    Replies: 1
    Last Post: 09-17-2001, 02:12 AM