LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading multiple strings from thermometer

Solved!
Go to solution

Hello guys, 

 

I need some help. I have a thermometer with two modules, each module has two channels ( four channels total). When i want temperature i have to give him comand (ASCII) but it only work for one module so if i want temperature from both moudels i have to give two diffrent commands. So my problem is that i have to read two diffrent answers. One answer contains  two temperatures from one module. (example from one module A01 #04 263 262)  A01= first module, #04 = command for temperature of all channles from module, 263 262 = temperatures. In attachment is my failed attempt. 

 

Thank you very much for help.

Jacob

0 Kudos
Message 1 of 5
(2,298 Views)
Solution
Accepted by topic author kostijak

DON'T USE BYTES AT PORT!  It is the wrong thing to use 99% of the time.

The other problem in your VI is that you immediately check bytes at port following the Write.  You probably haven't given the device a number time to respond to your message.

 

Your serial configuration is set for no termination character.  Is that true?  That makes it harder to know when a message ends.  Double check the manual for the communication protocol.

If it used a termination character (such as carriage return or line feed), then set it and read a large number of bytes.

If it does not, does it always send the same number of bytes in a reply?  If so, wire that constant in.

If it does not, does it prepend the message with the number of bytes that will follow in the message?  If so, read the first bytes, decode the number, and read that many more bytes.

 

Rather than Write 2 commands in a row, you should write the first command, read it, write the second command, read that.

0 Kudos
Message 2 of 5
(2,293 Views)

Yes i just checked it there is no termination character in manual.

 

Okey thank you i will try that. 

0 Kudos
Message 3 of 5
(2,274 Views)

@RavensFan

 

I triend write the fisrt comand and read  then write second comand and read. But it give me Error. 

error.jpg

0 Kudos
Message 4 of 5
(2,258 Views)

@kostijak wrote:

@RavensFan

 

I triend write the fisrt comand and read  then write second comand and read. But it give me Error. 

error.jpg


Punchline to a joke: "If it hurts when you do that, then don't do that!"  Don't use that node to do your matching.  You are parsing binary code, and it's highly likely that you'll encounter null characters.

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 5 of 5
(2,227 Views)