Home NetLinx Studio

Setting Baud Rate

sonnysonny Junior MemberPosts: 208
Hello...

I am working on a serial protocol and am having trouble setting the baud rate on an internal serial port on an NI3000. I have the SET BAUD command in the [DEFINE_START] section of the main program file. I do a GET BAUD from the "Control Device" utility and it shows 38400 even though I have it set to 4800. I can execute the SET BAUD from "Control Device" and it sets the port up properly.

I assume [DEFINE_START] isn't the place to put this, but putting in a conditional in the mainline seems kind of sloppy.

Any ideas/advice?

Thanks...

Comments

  • FrankieFrankie Junior Member Posts: 71
    Try the TSET BAUD command. There was a problem with the NI series "missing" the SET BAUD command. I think there is a Tech Note on this.

    I would also put the command in the Online Event for the device.
  • sonnysonny Junior Member Posts: 208
    Thanks Frankie...

    I thought I had seen a tech note as well but couldn't find it. I moved the code to a module and added it to the ONLINE event and all appears well.

    Sonny
  • SlavikSlavik Junior Member Posts: 18
    put 'SET BAUD" in online section of device.
    example:

    data_event[device]
    {
    online:
    {
    send_command device,'SET BAUD 9600,N,8,1'
    }
    }:) :)
  • HakanLHakanL Junior Member Posts: 6
    Hi,

    I'm not too familiar with how the NI3000 works internally, but my guess is that the DEFINE_START is executed before the serial ports, etc come online. So basically it sends SET BAUD to the serial port, _then_ starts up the serial port, which probably resets the baud to 38400. This is just my speculation, but looking at the [msg on] messages when I boot my unit it seems like devices come online after a little while.

    /Hakan
  • bogdanbogdan Junior Member Posts: 42
    Hi,
    Yes the best place to SET BAUD and to set RS-232 setup for unit is to have in the online of data_evend like above. The NI-XXXX devices came online after a little.
    Maybe security is more important to start first.
    :):)

    Bogdan
  • sonnysonny Junior Member Posts: 208
    Thanks to all....placing the code in the ONLINE area of the DATA_EVENT works like a charm.

    Sonny
Sign In or Register to comment.