LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial Communication

I have been writing this VI for a while now, and I cannot get my instruments connected by Serial cables to comminicate. In the string output, I get blank data. I managed to get data once, but even that was nonsensical and I cannot replicate the results. I have performed loopback tests and hyperterminal tests to test the card I am communicating with and the serial cables. They are all fine. The only other potential problem I can see is that I wrote something horribly wrong. Aside from  commands, which you would likely be unable to confirm, let me know if I totally screwed this up.

Thanks,
Cole.
----------------------------------------------------------------------------------------------------------------------------------------------------
I've got a sneaking suspicion that Jesus might have been made of bread. Why else did they have to put him in a warm cave and wait three days for him to rise?

Damnant quadnon intelligunt - They condemn what they do not understand.
0 Kudos
Message 1 of 96
(4,998 Views)
I think you need to add a visa close after each read command. Look in Visa Advanced in the block diagram.
0 Kudos
Message 2 of 96
(4,947 Views)

The first thing you should do is clean up the wiring and programming in the diagram. You've got a bunch of hidden wires and that just makes things more difficult to debug. The program in general is pretty confusing and is overly complex. Even if you had serial coms up and working, I don't think it would work correctly. Second thing is to try a single VI that will read/write to a single instrument. Third thing is to actually wire up the error in/error out clusters on the VISA functions to see what, if any errors might be happening. The fourth thing is to verify that the instrument actaully expects a carriage return and not a line feed as a terminator. The fifth thing is that you do not connect the return count output of VISA Write to the byte count input of VISA Read. The return count is the number of bytes that you've actually written and VISA Read wants to know the number of bytes that you expect to read. If you don't know the number of bytes to read, you can put in a small wait and then do a VISA Bytes at Serial Port to get exactly how many bytes are in the serial buffer.

Try one of the shipping examples like Basic Serial Write and Read and see if you can get that to work.

Message 3 of 96
(4,945 Views)
I tested some of the theories posted earlier in this thread. The VISA Closes didn't help, but I shall leave them there anyway because they seem important. I cleaned up the wiring so I could write easier, so that is good. When I tried putting a single instrument on one VI, I still got nothing. Testing the error clusters, I got a timeout error, which could mean any number of things. I would like to find out how to test the required time for most of the intsruments so that I can try them at that time. In MAX I still get timeout errors as well, which isn't surprising. Changing the closing points from \r to \n also does nothing. The VISA Bytes at Serial Port test will not give me a number either.
----------------------------------------------------------------------------------------------------------------------------------------------------
I've got a sneaking suspicion that Jesus might have been made of bread. Why else did they have to put him in a warm cave and wait three days for him to rise?

Damnant quadnon intelligunt - They condemn what they do not understand.
0 Kudos
Message 4 of 96
(4,914 Views)
I just want to verify that you've used Hyperterminal to actually talk to the instrument at Com13 or Com14. Could you post a screen shot (no bmp please) of a session?
0 Kudos
Message 5 of 96
(4,911 Views)
WOW, Smiley Surprised
As for the closes, you need one when your done with all the communications on that port.  If you try to reestablish communication on that port later it very well may be locked up unitl you not only close the VI but close LabView all together. 
 
One big suggestion is to make sure the end of line character is correct when you send something.  Carriage return or line feed, however just typing this in with slash codes is not enough if your not in "\ Codes display" mode in your string control or constant.  If you type them in normal mode and then switch it will cause a "\\" and if you leave it as a normal mode then it just doesnt work.   Look into this and make sure your sending the data your instruments expect. 
 
Also are the default settings (9600baud, 8, 0, 1, no flow control) correct for your instrument?  Just curious since your sticking with the default settings. 
 
Hope this provides some insight.
-Dave
0 Kudos
Message 6 of 96
(4,907 Views)
Yes, I have used hyperterminal to test that the card works. I did a loopback test to make sure it worked. I performed the same loopback ttest in Labview. I assume that the settings (Baud rate, Parity, etc) are correct, but I do not know how to test this. I have only done Labview for about a year, and since nobody here knows anything about it, I had to teach myself. Hence the extreme messiness and complication. I believe that I had some other questions in the previous post, but I fail to remember them.
----------------------------------------------------------------------------------------------------------------------------------------------------
I've got a sneaking suspicion that Jesus might have been made of bread. Why else did they have to put him in a warm cave and wait three days for him to rise?

Damnant quadnon intelligunt - They condemn what they do not understand.
0 Kudos
Message 7 of 96
(4,903 Views)
Oh, right. Yes, I did put in the end of line feeds and carriage return feeds in in the \Codes Display Mode. So that is not hte problem.
 
Thanks.
----------------------------------------------------------------------------------------------------------------------------------------------------
I've got a sneaking suspicion that Jesus might have been made of bread. Why else did they have to put him in a warm cave and wait three days for him to rise?

Damnant quadnon intelligunt - They condemn what they do not understand.
0 Kudos
Message 8 of 96
(4,902 Views)
A loopback test is not enough and in fact tells you very little. With a loopback test, all that you are verifying is that the serial card works. You have to also connect your cable to the instrument to verify that the cable and serial settings are correct for the instrument. If Hyperterminal does not work with the instrument, then you have something wrong with either. The only way to know the correct serial settings is to get that information from the instrument user manual.
Message 9 of 96
(4,897 Views)
So how do I figure out what settings I need to use to communicate with an instrument? Is it in the manual? If it is, I can't find it. And  Dave, thanks for letting me know about the VISA Closes. I don't plan on the program ending for a long time. It is reading data about a sputtering system, so a few hours. I also need to figure out how to confirm whether the commands I am using are a) get me correct data and b) work with my device. I actually called Omega about the Temperature Controller, so I assume the command they gave me is correct for that, but I still can't get it to give me any data. Also, how do I figure out the bytes I need to read from the instrument?
----------------------------------------------------------------------------------------------------------------------------------------------------
I've got a sneaking suspicion that Jesus might have been made of bread. Why else did they have to put him in a warm cave and wait three days for him to rise?

Damnant quadnon intelligunt - They condemn what they do not understand.
0 Kudos
Message 10 of 96
(4,225 Views)