12-30-2013 06:38 AM - edited 12-30-2013 06:43 AM
Hi I'm want to use LabView for real-time data acquisition of my servo dc motors. I'm new to LabView, so I'm trying to do the same thing with virtual port. I'm writing some data (a sinusoidal wave) to the virtual port and then read and show it on graph. the writing part works just fine as it can be seen in hyper terminal. but it doesn't read anything. the number of bytes at port is zero. i tried to set the bytes count in visa read manually but it doesn't work. I have attached my code below. any comment is much appreciated. Thanks in advance
Solved! Go to Solution.
12-30-2013 09:13 AM
Are you doing a simple loopback of the serial port? That is the only way you would be reading the sine wave and that has nothing to do with servo motors. What pins do you have connected at the serial port?
Why bother doing a loopback? Assuming you have a USB-RS232 converter, do you think It's broken?
12-30-2013 10:10 AM
my English sucks. what do you mean by loopback?
I have a USB-RS232 converter that works. the problem is the servo motors I'm supposed to work with aren't ready. so I wanted to prepare a code beforehand. in my work I have to read some data like speed, current from servos. I just wanted to do some practice by writing a sine wave and reading it.
what modifications I need to make to my code in order to work properly (with virtual port of course)?
12-30-2013 10:20 AM
@Neo_Ev wrote:
what do you mean by loopback?
You need to connect the TX to the RX on the output of your USB-RS232 adapter. Then you will be able to read what you sent out, creating a loop back into your port (hence the name "loopback").
12-30-2013 10:35 AM
This is just basic knowledge of how serial communication works. In order to do a read without any instrument there, you must loopback (short) the transmit line to the recieve line. For a 9 pin connector, you short pins 2 and 3. If you have not done this, I don't understand where you thought you could do a read from.
In any case, if you have servos that are controllable from RS-232, it is not likely that the serial protocol is even close to what you are doing and a loopback will not tell you much more than the converter is functional. When you have an actual instrument connected, you still have to debug the com parameters (baud, parity, handshaking), cable type (null modem or straight through), and the actual commands you send to the instrument and it's responses.
12-30-2013 10:42 AM
12-30-2013 10:46 AM
@Neo_Ev wrote:
In my code how should I connect pins 2 and 3?
You can't do it in code. You have to do it with the serial bus hardware (the end of the USB-Serial adapter).
12-30-2013 10:48 AM
12-30-2013 10:48 AM - edited 12-30-2013 10:51 AM
Didn't you read the explanation of a loopback in the link I posted? There is no such thing as a virtual bridge. It is an actual physical connection. If you have a special converter that supports this debug mode, then you would need to refer to the api for the converter.