LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial communication problem with VISA

Hi,
    I use the VISA function "Bytes on Port" to read all of them afterwards with the VISA Read function. I have 2 indicators, one before the VISA Read and another afterwards. Why so many time they do not correspond? I thought I could give the parameters of bytes to read directly from the function Bytes on Port. I attach the VI. If somebody has an idea or can post the answer correct it, would be very nice.
Thanks in advance.
0 Kudos
Message 1 of 13
(4,035 Views)
I cannot read your VI because I have LV7.0, but... I would think that the two values should very rarely be the same, because a VISA Read alters this number.
In fact, I expect in many cases to have 0 after a read. Or not?

Paolo
Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 2 of 13
(4,028 Views)
Is it possible to convert a VISA resource name into a string?
0 Kudos
Message 3 of 13
(4,024 Views)
I think it should be better to start a new thread with a new question, because more people could be interested in and could miss it.
Anyway, if you are speaking about a VISA resource name control you can access its text creating a property node.
The relevant property is Text.Text

Paolo
Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 4 of 13
(4,017 Views)
If you do not turn off the terminate read on termination character detected, you can get a different actual bytes read than the bytes available. So, if there's a LF in the available bytes, the VISA read will terminate when detected and you will have unread bytes in the serial buffer.
0 Kudos
Message 5 of 13
(4,012 Views)
In fact I don't have any special termination character. The VI that I've post it it's a part of a bigger one where I'm reading string and concatenating them in a loop. After every VISA Read I compare the concatenated string and look into some input data bytes. I read always until I find the data or until the specified timeout exceeds. On the other hand, I've checked that in this concatenated string I can always see both the SENT command and the RECEIVED command. It seems that always when I have the Bug is because in the concatenated string I cannot see the SENT command. It's very weird...   :o(
0 Kudos
Message 6 of 13
(4,003 Views)
What I'm saying is that if the number of actual bytes read does not equal the number of bytes available, then you have an unexpected termination character in your serial buffer. Instead of using your own VISA property node to set the com port, use the VISA Configure Serial Port and wire a false constant to the Enable Termination Char input. See if that doesn't make your problem go away.
0 Kudos
Message 7 of 13
(4,000 Views)
Another thing that should be noted.  You do not have any delays in any of your loops.  Therefore, the loops will hog all the CPU time and this could cause all kinds of other problems.  Always put some delay in your loop, even 0 mS.  This will allow the CPU time to perform other necessary functions.
Also, instead of using timers to determine the timeout, you can use the attached picture as an example on how to timeout of a loop without having to use timers.  This example is based on milliseconds.  By changing the delay value to 1000, the timeout can be specified in seconds.
 

Message Edited by tbob on 08-23-2005 10:47 AM

- tbob

Inventor of the WORM Global
0 Kudos
Message 8 of 13
(3,981 Views)

Hi Dennis,

    I've found that wshen my application doesn't work it is because a 0xBFFF006B error (framing error). I've checked in the discussions forums and I've read interesting answers to this problem. Everything shows that I must have a mismatching serial configuration, but it is very curious because my communication works very good during some time, I transmit and receive commands without problems and sometime in the middle of the process the data that should be sent it, it is not sent and then appears my framing error (0xBFFF006B). Do you can imagine why? It's even more weird, because if after the VI has given me the error and it has stopped I run the VI again and it works. I can even run it continously and work perfect! Some idea?

thanks

0 Kudos
Message 9 of 13
(3,961 Views)

Hi tbob,

     I've made the modifications you've suggested me in the VI. It stills gives me problem. Please have a look at the Thread, I've post another question. Thanks!!!!

0 Kudos
Message 10 of 13
(3,957 Views)