CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: analog outputs?

  1. #1
    Join Date
    Jun 1999
    Location
    North Germany
    Posts
    306

    analog outputs?

    Hello

    I shall write a Program that shall communicate with an external device which has analog input values. It has a connector with 5 pins and depending on which pin is active it is doing something. I was thinking about using the RS232 connection and connection each RS232 PIN with the Pin from the device and then just activate each pin as I need it. Is this possible? If not which other way can I choose?

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: analog outputs?

    I have no idea how to connect an "analog input" device with the digital IO one (RS232).

    However, if you have some problems/questions in Visual C++ programming, I (and other guys here) will try to help you!
    Victor Nijegorodov

  3. #3
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,824

    Re: analog outputs?

    What input values does the external device use? You say it has a 5-pin connector and 'does something' depending upon which pin is active. This doesn't sound like analogue input but digital input? With RS232, there are 4 pins which can be used to signal an external device - DCR, DSR, RI and CTS - which together with ground make a 5 pin connection. See https://en.wikipedia.org/wiki/Serial_port#Pinouts for info regarding RS232 pins for the different connectors. You also don't say what voltage range the external device needs. RS232 standard states that the voltage levels can be up to +/- 15v (see https://en.wikipedia.org/wiki/RS-232). So if your external device isn't rated for these voltage levels then you will need an intervening driver circuit to convert the (upto) +/- 15v to the required voltage level (0 - 5v??). Assuming you can sort out the hardware interfacing correctly, then you'll either need a 3rd party RS232 library or use the WIN32() functions direct. See https://msdn.microsoft.com/en-us/lib...(v=vs.85).aspx
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  4. #4
    Join Date
    Feb 2017
    Posts
    677

    Re: analog outputs?

    Quote Originally Posted by Grit View Post
    communicate with an external device
    The best approach must be to contact the manufacturer of the device for information about how it is supposed to be connected and used with a computer.

    Just connecting the ports electrically with wires and pray for good luck almost certainly will blow one of the ports or both.
    Last edited by wolle; May 1st, 2017 at 07:43 AM.

  5. #5
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,620

    Re: analog outputs?

    RS232 is a serial interface. And LPT interface fits much better with the task. PCI-to-LPT periferal card will help in case your motherboard does not have LPT port.
    Best regards,
    Igor

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