Home AMX User Forum AMXForums Archive Threads Tips and Tricks
Options

NI receiving commands from serial port

How can I setup a serial port on a NI controller to listen for a string command from an external source, say a PC?

For example, the command sent would be ' SEND_STRING PROJECTOR, "':POWR1',$0D" '

Thanks, dsmith

Comments

  • Options
    GregGGregG Posts: 251
    If I understand what you mean, then the easiest way is to use the telnet connection from the PC to NI.

    But if that is not possible for some reason, then you could listen on a serial port in your code, and then have the NI master telnet into itself and relay the command. Just set a static IP in the master (even if it isn't plugged into any network) so you know where to IP_CLIENT_OPEN() into.

    Back at the inception of netlinx before all the commands were even documented, we didn't know there was a send_command 0, 'CLOCK ....' to set the time, so I wrote a little module that would pull time from a server and then telnet into the master from itself and do a 'set time ...'.

    It worked just fine, but felt a little like writing self modifying code. (which is also fun if you can manage it)
  • Options
    arifarif Posts: 2
    DHCP

    why, when I am right clicking NI-700 connection via DHCP always fail? whereas before I used the DVX-3100 via DHCP successfully. HELP ME
  • Options
    travtrav Posts: 188
    Are you lost?
    arif wrote: »
    why, when I am right clicking NI-700 connection via DHCP always fail? whereas before I used the DVX-3100 via DHCP successfully. HELP ME

    I think... wait.... am I a Chinese philosopher... or a butterfly....

    "Wheels have been set in motion, and they have their own pace, to which we are...condemned. Each move is dictated by the previous one - that is the meaning of order. If we start being arbitrary it'll just be a shambles: at least, let us hope so. Because if we happened, just happened to discover, or even suspect, that our spontaneity was part of their order, we'd know that we were lost. A Chinaman of the T'ang Dynasty - and, by which definition, a philosopher - dreamed he was a butterfly, and from that moment he was never quite sure that he was not a butterfly dreaming it was a Chinese philosopher. Envy him; his two-fold security."

    After that brief tour past Tom Stoppard, I would hazard to suggest, even though it appears you are lost in the forums some where, that you check your master connection settings in Netlinx studio, and make sure you have changed your current connection settings from what ever you were using when connecting to the DVX to what ever new IP the NI-700 has been given by your DHCP server.

    You can serial in to the NI and check it's IP with the 'show device' command, it will show device 00000 with an IP address listed with it.

    I hope you find your way out soon.... other wise you may be stuck here waiting.....

    V: We can't.
    E: Why not?
    V: We're waiting for Godot.
    E: (despairingly). Ah! (Pause.) You're sure it was here?
    V: What?
    E: That we were to wait.
    V: He said by the tree. (They look at the tree.) Do you see any others?
    E: What is it?
    V: I don't know. A willow.
    E: Where are the leaves?
    V: It must be dead.
    E: No more weeping.
    V: Or perhaps it's not the season.
    E: Looks to me more like a bush.
    V: A shrub.
    E: A bush.
    V: A—. What are you insinuating? That we've come to the wrong place?
    E: He should be here.
    V: He didn't say for sure he'd come.
    E: And if he doesn't come?
    V: We'll come back tomorrow.
    E: And then the day after tomorrow.
    V: Possibly.
    E: And so on.
  • Options
    AuserAuser Posts: 506
    So not much work on then Trav?
  • Options
    travtrav Posts: 188
    Now with 150% more non-sequiters

    I just felt I needed to inject some whimsy into this thread.
  • Options
    ericmedleyericmedley Posts: 4,177
    /me nods approvingly...
Sign In or Register to comment.