LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Desperate questios on RS232 Communication

Hallo all expert,

The attachment is a vi which is expected to write/read data to/from COM1 of my machine. For verification, I simply short circuited pin 2 and 3 of the RS232 port. However there are some questions following my experiment:
1. In the chart the label of x-axis can not be restored to be 0 to 100, it automatically increases without limits. I wish it start from 0 instead resuming a time instant;
2. In the "read string" field the display is not updated during my typing characters in "string to write", although I have enabled "Update Value while Typing";
3. The display in the chart doesn't correspond to what I have typed. Should I need more functions in order to show up the data?

My final purpose is to use this interface to communicate a pic chip which I programed to realize A/D conversion. At begin, a value is ought to be sent to the chip where the value is compared and if it is "1"f, then the conversion is initiated, and the value is read in the chart and could be also saved a excel file for documentation.
I'm wondering how to input value "1", instead string "1". I successfully type "Ctrl-A" in HyperTerminal, but have no idea which function is due to be used to realize the corresponding conversion.
0 Kudos
Message 1 of 21
(4,063 Views)
Have I clearly explained my problems? Why is there no comments from you? Please!
0 Kudos
Message 2 of 21
(4,046 Views)
I forget to mention that the version of my LV is 8.0. Error-1073807339 comes to pass frequently. I think it relates to "byte count" of the Read block. For the purpose of measuring continuously-varying signal, how could I get around this issue?

Thanks a lot in advance, win2s

Message Edited by win2suse on 04-19-2007 06:49 AM

Download All
0 Kudos
Message 3 of 21
(4,045 Views)

There are several ways to send a hex 01 with the VISA Write, and all have been explained numerous times onn the forum. One wya is to simply right click on your string control/constant and select Hex Display. You can right click and select '\' Code Display and enter \01. You can have a numeric control and use the Byte Array to String. You can have a numeric control and use the Typecast function to convert to a string.

Your error can be due to the device not sending any data back, hence the VISA Read times out waiting for non-existant data. If you sometimes get data and are unsure of the length, you need to use VISA Bytes at Serial Port wired to the byte count input of VISA Read. This has also been discussed numerous times on the forum.

Message Edited by Dennis Knutson on 04-19-2007 06:15 AM

0 Kudos
Message 4 of 21
(4,032 Views)
Thanks a bunch for your reply.

Your analysis is right. Upon adding the VISA Bytes at Serial Port, the error is killed.
However new problem comes off, that is, in the "read string" field the reading doesn't
correspond to what I have typed. Both of "String to write" and "read string" are set with
"Update Value while typing". The characters in the "read string" seem to stem from some
previous inputs, instead of current ones. What could be the reason for that? The attachment
is a snapshot of the front panel during running.

As for the value input, in the cases of "Hex Display" as well as "\ Codes Display" they
are not allowed to enable "Update Value while typing". On that note, I have to use some
extra functions for conversion.

Another question on the figures in your post, how do you get the diagram exported? using
"Alt-Print"? or there is built-in functionality in LabVIEW.

win2s
0 Kudos
Message 5 of 21
(4,023 Views)
You do realize that you are sending the entire string, each iteration, don't you? It's just not sending the last thing you typed. That is not how Update Value When Typing works. It just appends new characters without having to use the enter key.
0 Kudos
Message 6 of 21
(4,003 Views)
Acctually no matter whether return is striked or not, the reading from my "read string" remains the same as you see "*IDN123". I have checked its property which is enabled, normal display, update value while typing.

Furthermore, at the outset, the program pauses for a long while, then continuously reads and displays in the chart. It seems that the General Error Handler pause it at the beginning, but why? It would be appreciable, if you could give me more tips on them.

win2s
0 Kudos
Message 7 of 21
(3,982 Views)
The latest version of my labview program is attached for correction.
Is there workspace or similar thing from labview? Maybe I could examine it thru checking the data out there.
win2s

Message Edited by win2suse on 04-19-2007 12:51 PM

0 Kudos
Message 8 of 21
(3,980 Views)
In the picture you posted above the Bytes Read indicator shows 64 but only 7 or 8 characters are visible. If some end of line or other non-printable characters are in the datastream you will not be seeing them in that indicator. Make the indicator larger or enable '\' Codes Display to see all the data which was read.

Do you know how many characters the remote device will send? Is there a termination character or some way to identify the last character in a particular response? If you have knowledge of the datastream characteristics, you may be able to do a better job of capturing the data.

Also put the VISA Close and the error handler outside the loop. You may want to configure the loop termination logic to stop the loop on an error as well as when the button is pushed.

Lynn
0 Kudos
Message 9 of 21
(3,969 Views)
Per the image of the running VI, what is the instrument supposed to respond to when you send 909019....? The way you have written this, that is what was sent - not just the last thing you typed and it's being sent constantly. I'm really not sure what you are trying to do. Does the instrument require a specific command to be sent in order to get some results back or does it constant return data without a read command being issued? If you just want to get result after typing something, then you would be better off using an event structure. Using the Update Value While Typing and the mechanical action of your front panel Booleans doesn't seem appropriate.
 
Provdie a bit more information about what exactly you are trying to do with the instrument and what it requires to send data.
 
p.s. You should clean up you VI a little. The VISA Initialize Serail Port should be on the left side of the while loop so that the resource name and error wires don't have to go backwards/hidden. You should also place the VISA Close and error dialog on the outside of the loop. this means wiring the resource and error wires out the right side of the while loop.
0 Kudos
Message 10 of 21
(3,965 Views)