LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW hang in Serial communication !!

Solved!
Go to solution
Highlighted
Right click on the error out of the VISA Read and select Create Indicator. Or, place an error indicator on the front panel and wire out to the error out of the read.

A termination character is normally a carriage return or line feed. A hex A would be correct.

Sending 6 bytes randomly means your read is asynchronous so you have no idea of the order of the bytes you read.
0 Kudos
Message 11 of 28
(522 Views)
Highlighted

I wouldn't use a termination character.  Since you are sending binary data, it is just as likely that the termination character could show up in your data bytes.  Why are you reading 6 bytes and only using the last 3?

 

I would set the protocol with your device so that you Write a command and then receive a response rather than just continually looking for responses.  That is where you risk getting inaccurater responses because you happened to open the the serial port in the middle of an unsolicited message being sent.

 

You probably could and should use a marker byte to help identify where a packet of data might end.  Add a 7th byte.  Make sure that the byte shows up where you expect it.  If you don't, then you know you have a misaligned packet of data.  If you do, it doesn't guarantee everything is perfect because it is a chance that byte shows up as part of the data, but it helps prevent some communication errors.  You could also use some sort of checksum to help determine your packet of data is correct.

0 Kudos
Message 12 of 28
(516 Views)
Highlighted
I should have Breen clearer. Send ascii if you use a termination character. I agree that sending a request for data should work better with binary.
0 Kudos
Message 13 of 28
(509 Views)
Highlighted

I will sent 27 byte Data to VI in future and use This bytes seperately. for example First three byte will use for check system and other 24 byte will use for graph. each 3 byte shows in one Graph. it was a review of future Design. because of this situation, I must take 3 byte and show it in a Graph.

Data send from MCU to LabVIEW continueslly, and in this step, LabVIEW interface doesn't an Data to MCU.

in meanwhile I must say again that LabVIEW read Data accurate in few moment but crash in continue alothough MCU send Data but LabVIEW doesn't read any data. when I stop LabVIEW VI, and run it in continueslly mode VISA don't work and I should restart every thing like MCU, LabVIEw and other stuff.

0 Kudos
Message 14 of 28
(496 Views)
Highlighted

if I use LabVIEW with ascii code and control character is better than sendig hex and using of byte as port ?

0 Kudos
Message 15 of 28
(478 Views)
Highlighted

@ajapyy wrote:

if I use LabVIEW with ascii code and control character is better than sendig hex and using of byte as port ?


...But you're not SENDING anything...

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 16 of 28
(470 Views)
Highlighted

yes , you right. but I don't want send anything from LabVIEW to MCU. in this level I want read data with LabVIEW and figure it in the Chart.

but LabVIEW suddenly stop working and however run continually is active, I don't see anything in chart !! 

0 Kudos
Message 17 of 28
(465 Views)
Highlighted

Why are you using "run continuously" when you already have a while loop?  In fact, WHY ARE YOU USING IT AT ALL???  That's a troubleshooting tool.  Which, unfortunately, is in a very obvious place next to the run button.

 

Always, always make it so your VI is doing the looping, not the button.  If I remember correctly, LV will close and open resources each time it reiterates with the "run continuously" button, your incoming messages may be getting cut off right in the middle.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 18 of 28
(453 Views)
Highlighted

I want read Data from MCU that send Data each time. in MCU I send Data until determined time and because of this point I use run continusly in LV.

I test LV code. it stop reading data or other problem that cause read buffer and chart doesn't show anything.

0 Kudos
Message 19 of 28
(444 Views)
Highlighted

@ajapyy wrote:

I want read Data from MCU that send Data each time. in MCU I send Data until determined time and because of this point I use run continusly in LV.

I test LV code. it stop reading data or other problem that cause read buffer and chart doesn't show anything.


You did read my last post, right?  I'm gonna poke you in the eye...

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 20 of 28
(436 Views)