キャンセル
次の結果を表示 
次の代わりに検索 
もしかして: 

Serial write problem

解決済み
解決策を見る

Hi, I'm having problems writing to serial. If I run in debug (highlight execution) mode it appears to write OK, but once out of debug it will only work occasionally or if I send something to my VI for it to read first.

 

0 件の賞賛
メッセージ1/11
3,683件の閲覧回数

Please post a snippet of your code where you are sending the data.

-----

The best solution is the one you find it by yourself
0 件の賞賛
メッセージ2/11
3,681件の閲覧回数

Sounds like it could be a timing issue, but as P Anand said post your code and we'll help you out

 

-CC 

----------------------------------------------------------------------------------------------------------------------------
"If anyone needs me, I'll be in the Angry Dome!"


0 件の賞賛
メッセージ3/11
3,678件の閲覧回数

Here's the VI.

0 件の賞賛
メッセージ4/11
3,667件の閲覧回数

Hi,

 

Could you post the VI in 2010?

 

-CC 

----------------------------------------------------------------------------------------------------------------------------
"If anyone needs me, I'll be in the Angry Dome!"


0 件の賞賛
メッセージ5/11
3,662件の閲覧回数

Hope I've done this correctly.

0 件の賞賛
メッセージ6/11
3,654件の閲覧回数

Yep you did it right スマイリー とてもハッピー

 

Your program looks good (although a single case structure with an enum selector might be a better fit for selecting which command to send).

 

I would try and put a delay (maybe 50ms to start with) between the write and read VIs. 

 

 

See if that helps.

 

-CC 

 

 

----------------------------------------------------------------------------------------------------------------------------
"If anyone needs me, I'll be in the Angry Dome!"


0 件の賞賛
メッセージ7/11
3,645件の閲覧回数
解決策
トピック作成者NewWorldManが受理

No I don't think its the right way. You are trying to read from the serial port and the same resourse you are passing to the write so if you don't have any data to read you will get an error in sequence your write serial port will not work/through error. So you have to check whether any data is available at the serial port before reading.

 

Its just an example I have attached you can do that better.

 

Good luck.

 

 

-----

The best solution is the one you find it by yourself
メッセージ8/11
3,638件の閲覧回数

I cant open the VI here, but a common problem is to not have any wait between write and read in the VISA communication. Put a 100ms in between to give the serial port time to talk and recieve a result.

 

It's about the only instance where a sequence frame is a good solution. 😄

 

/Y 

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 件の賞賛
メッセージ9/11
3,632件の閲覧回数

Thanks Guys for all your help.

0 件の賞賛
メッセージ10/11
3,627件の閲覧回数