Home AMX User Forum AMX General Discussion
Options

COM port enhanced options

Hi there.

I have a DateQ QFM device. I need to control it directly via RS-232, bypassing Musicall matrix.
For this to be done, i have to set enhanced COM port options such as RTS/DTR control, Xon/Xoff chars and so on.

I've made small C++ program able to control QFM via RS-232.
The COM port options I've set:

tDCB.BaudRate = 9600;
tDCB.fRtsControl = RTS_CONTROL_DISABLE;
tDCB.fDtrControl = DTR_CONTROL_HANDSHAKE;
tDCB.StopBits = ONESTOPBIT;
tDCB.Parity = NOPARITY;
tDCB.ByteSize = 8;
tDCB.EofChar = char(136);
tDCB.ErrorChar = 0;
tDCB.EvtChar = 0;
tDCB.XonChar = 17;
tDCB.XoffChar = 19;
tDCB.XonLim = 256;
tDCB.XoffLim = 256;

tCOMMTIMEOUTS.ReadIntervalTimeout = 50;
tCOMMTIMEOUTS.ReadTotalTimeoutMultiplier = 5;
tCOMMTIMEOUTS.ReadTotalTimeoutConstant = 300;
tCOMMTIMEOUTS.WriteTotalTimeoutMultiplier = 15;
tCOMMTIMEOUTS.WriteTotalTimeoutConstant = 10;

The question is: does Netlinx allow to set at least some of these options _for Netlinx Device (~ NI-700) COM port_ or not?

Thanks in advance.

PS: Sorry for my poor english.

Comments

  • Options
    yuriyuri Posts: 861
    you can use the 'SET BAUD' commando.

    SET BAUD <baudrate> <parity> <databits> <stopbits> <485 enable/disable>

    you can also use HSON/HSOFF to enable/disable hardware handshaking (RTS/CTS) and enable/disable software handshaking

    is that enough?
  • Options
    FovFov Posts: 26
    Thaks for your reply :)
    I'll try that today.
  • Options
    FovFov Posts: 26
    Problem is solved. Thanks, yuri.

    I've made the following to get it done:

    SEND_COMMAND DATA.DEVICE, 'SET BAUD 9600, N, 8, 1'
    SEND_COMMAND DATA.DEVICE, 'HSON'
    SEND_COMMAND DATA.DEVICE, 'XON'

    Another question:

    I have to count sum of two bytes and take the low byte of resulting word. In C++ it can be done easily:

    Res_Byte = LOBYTE(MSB+LSB);

    How can I do the same thing in NetLinx?
Sign In or Register to comment.