Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial Port buffer is annoying.

Hi, I'm having a hard time dealing with my serial port. When I send a command (for instance, 'Whello', which should display 'hello' on the instrument panel), it doesn't seem to actually send. If I send Whellowoiaydsociahncu4ynriausfaiu(insert at least 80 characters), the display will read "hellowoiayds" (the display is 12 characters wide).

So how in the world do I tell the COM port to send the command without requiring all 80 characters? Note that I can have it send "W1234567890" and press send 8 times, and the command will be sent on the 10th attempt. I assume the buffer is being filled as I send the short command, and only actually sends after it is full. If I don't send something to the buffer within 2 seconds, the buffer is cleared.

Is this a computer problem or programming thing? I've tried turning off FIFO, but it didn't help (maybe I have to reboot to make that setting work?)

Thanks for your help,
-James
0 Kudos
Message 1 of 3
(2,956 Views)
An easy check of your computer and program is to put a loopback on the serial port by shorting Tx to Rx and in your program, do a read immediately after your write. If you read everything you wrote, the problems at the instrument. Does it require a termination character at the end of a write? What programming language are you using and what function to do the write?
0 Kudos
Message 2 of 3
(2,953 Views)
Have you tried to place a \n (linefeed) at the end of your buffer. Many serial instruments that I am familiar with (note that I am NOT an expert on serial instruments) typically use a line buffer for parsing and don't start to parse until they get a complete line (80 characters) or detect the end of input with a carraige return or linefeed (or both). So, you may consider sending "whello\n" or "whello\r\n".

Good luck...
0 Kudos
Message 3 of 3
(2,932 Views)