04-13-2018 03:45 AM
Bonjour,
Je viens vers vous car je n'arrive pas à solutionner mon problème tout seul.
En cours de code j'ai eu un problème concernant le VISA READ: error timeout. Je vais donc regarder sur les différents forums s'il n'y a pas déjà de réponse à ce sujet.
Je tombe sur un topic résolu concernant ce problème: l'error timeout est résolue avec un "bytes at serial port" et une fonction attendre pour donner du temps au visa read lors de la lecture.
Mais il persiste un "warning":
" La mise en garde 1073676294 s'est produite à VISA Read dans lecture Temperature.vi
Raisons possibles :
VISA: (Hex 0x3FFF0006) Le nombre d'octets transférés est égal au décompte d'entrée attendu. Davantage de données sont peut-être disponibles."
Ce warning "bloque" l'écriture dans mon buffer. Cette commande fonctionne sous NI MAX, je ne comprends donc pas pourquoi elle ne marche pas dans mon programme Labview.
Tout conseil est le bienvenu 🙂
Le vi est en pj
Solved! Go to Solution.
04-13-2018 03:51 AM - edited 04-13-2018 03:55 AM
Hi Lablasc,
don't use BytesAtPort here. (In ~99% of all cases you don't need BytesAtPort!)
There are race conditions in your code:
- you read the BytesAtPort count just after you write to the COM port: there will be no data in the receive buffer yet…
- you have a wait function in parallel to the VISARead: that is nonsense!
- Your message string seems wrong to me: why do you send "\s" and "\n"? Make the display style indicator of the string constant visible: your string is in "normal display" mode!
- Why do you clear the COM port after reading?
- our VISA warning is just a warning: there might be more data in the receive buffer…
See this:
- string constant changed to "\-display"
- no BytesAtPort, just read the response using a large "bytes to read" value
- from your command string I guess the device will answer with a message containing a LF char at the end…
04-13-2018 04:07 AM
First of all thank you for your fast answer !
The wait function was for let time to READ VISA to do its reading.
Should I put it before the READ VISA ?
About the message string, I wanted to put the same message that in NI MAX because I was like "if it works in ni max, it must work in labview"
The string message, (the control) must have the \n at the end to work.
Then, I clear the COM port at the end because I have learned but maybe it's not the same case, that, in daqmx, you have to clear the task before to close it.
And last point, yes it's just a warning, but the problem is that i don't have the measures in my the receive buffer whereas it works with this control in ni max.
Thank a lot for your help and please, be forgiving with my english 😉 !
04-13-2018 04:14 AM
Hi Lablasc,
The wait function was for let time to READ VISA to do its reading. Should I put it before the READ VISA ?
The wait should be before the Read.
BUT: you don't need an additional wait function here as VISARead will wait on its own!
I wanted to put the same message that in NI MAX because I was like "if it works in ni max, it must work in labview" The string message, (the control) must have the \n at the end to work.
That's all true.
BUT: you didn't notice about the string display mode!
Switch to "\-display" as I did in my snippet!
I clear the COM port at the end because I have learned but maybe it's not the same case, that, in daqmx, you have to clear the task before to close it.
In both cases you can close the reference without clearing any buffers first: the driver will handle the cleanup anyway!
the problem is that i don't have the measures in my the receive buffer whereas it works with this control in ni max.
Because of your wrong string - see suggestion above!
04-13-2018 04:15 AM
Thank you for your little program.
I have tried it but unfortunately, there is, this time, an error timeout.
Are you sure that we don't need to "slow down" the reading of the VISA READ ?
I don't want to be boring, I just try to understand 🙂
04-13-2018 04:21 AM
I have changed the display mode of my string and it works ! Now I have the measures in my buffer. But unfortunately, still the timeout error.
Do you have any idea on this problem ?
Thanks again ! 😉
04-13-2018 04:21 AM - edited 04-13-2018 04:28 AM
Hi Lablasc,
VISARead will wait for 10s (by default), that should be enough time to have your device send an answer…
Which answer do you expect? (Which TermChar is used by your device?)
Did you make sure you use the string constant in "\-display"-mode as I did?
But unfortunately, still the timeout error.
A timeout error despite you receive data?
Did you use SerialPortInit as I did in my snippet?
04-13-2018 04:43 AM
Yes, I have followed your advice 🙂
You can see what I have done in the files under this message.
04-13-2018 04:49 AM
Hi Lablasc,
please attach images directly to the forum instead of hiding them in some obscure Office files…
- You don't need to open the COM port before calling SerialPortInit.
- You still didn't make the display mode indicator visible as I suggested.
- You still don't tell which answer string you do expect…
- You still don't say which TermChar is used by your device…
04-13-2018 05:04 AM
Sorry for that.
I will follow your advice next time.
The second picture was here to show you if I have done the good action to change the display mode indicator of the string. But, it wasn't.
The answer wanted is like that "22.64,46.7".
The first term is the temperature and the second is humidity.
I want only the first one but the control to display only the temperature doesn't work, it displays a wrong temperature,not the temperature displays on the instrument. ( I hope it's clear 🙂 ).
And to be honest, I don't understand the last question.
Can you explain me in another way please ?
Thank a lot.