Thread: Com Port Listening

  1. #1
    Registered User
    Join Date
    Jul 2006
    Location
    Rivers, Manitoba
    Posts
    1

    Question Com Port Listening

    What Id like to do is to have a button connected to a com port, have a script running that could listen for the circuit to close (push the button) and launch an external program once it has been.

    What Id like to know, if someone can tell me, is how to go about listening for the circuit to close on the port.

  2. #2
    System Novice siavoshkc's Avatar
    Join Date
    Jan 2006
    Location
    Tehran
    Posts
    1,246
    The device connected to the com port should obey its connection protocol. I think you can not pass any signal to software layer if you just connect a button to com port.
    Learn C++ (C++ Books, C Books, FAQ, Forum Search)
    Code painter latest version on sourceforge DOWNLOAD NOW!
    Download FSB Data Integrity Tester.
    Siavosh K C

  3. #3
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398
    I assume you're running a Windows system...

    It's a bit tricky with Windows, because the operating system tries to insulate you from the hardware. But, you can open the port as a file. Here's an MSDN link to get you started.

    The parallel port would be easier to use. The serial port is going to expect "proper" serial data per the RS-232 protocol... a particular baud rate etc.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. FTP program
    By jakemott in forum Linux Programming
    Replies: 14
    Last Post: 10-06-2008, 01:58 PM
  2. brace-enclosed error
    By jdc18 in forum C++ Programming
    Replies: 53
    Last Post: 05-03-2007, 05:49 PM
  3. How to do port listening in C++?
    By voodoosg in forum Networking/Device Communication
    Replies: 1
    Last Post: 06-07-2006, 12:40 AM
  4. port listening
    By winterflood_j in forum Windows Programming
    Replies: 6
    Last Post: 12-26-2003, 01:38 PM
  5. Replies: 1
    Last Post: 10-03-2002, 09:52 AM