LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

RS232 communication with LabView

Thank RavensFan, Billko and Jeff for the reply. Jeff program also helped understand some of the changes that billko did earlier. I am getting an error msg as an output. I think it has to do something with what I write to the serial port. Excuse me if I sound stupid, I have trouble understanding some of the changes you have made. I would summarize below on what I understood.

 

The case structure is removed such that once the serial port is configured and write file is opened, the while loop is continuously run for write/read from the port and writing to the file until the user stops.

I understand about the orphans.

I don't get the idea about the shift registers, that's partly because I don't understand completely about the concept of error in/out.

Earlier with the delay before read I was able to control the frequency of temperature data acquisition from the thermocouples. I believe the wait (ms) here is for similar purpose.


The mystery part is the functioning of the FOR loop. When I type the commands in the commands for each thermocouple dialog box, I am not clear how it operates.

 

The serial board I interact with has 4 thermocouple input channels. The minimum delay it takes before reading two serial inputs is 70ms. Hence the min frequency I can operate (assume 1 channel) need to be >70ms. So when I operate, say 2 channels, I write to the port asking it to read from ch 1 (something like ARA\r) wait (min 70ms) then write to port asking it to read from ch 2 (something like ARB\r) wait (min 70ms) writ to ch 1 again.  I want this to be in a loop fashion until I press STOP.

 

Am I doing the above operation when I type the code in the commands for each thermocouple ? The no 0.1.2 and so on mean the code I write for each channel A,B, etc. ? When I type the code for , say 2 channels in the commands for each thermocouple  dialog box 0 and 1, when I click run does it take code in 0, write to port-wait-read from it, then take code in 1 write to port-wait-read from it ? 

 

Appreciate your help. I have also attached the output text I got when I ran the VI if it can help.

 

vzv

 

0 Kudos
Message 31 of 43
(1,594 Views)

@vzv wrote:

Thank RavensFan, Billko and Jeff for the reply. Jeff program also helped understand some of the changes that billko did earlier. I am getting an error msg as an output. I think it has to do something with what I write to the serial port. Excuse me if I sound stupid, I have trouble understanding some of the changes you have made. I would summarize below on what I understood.

 

The case structure is removed such that once the serial port is configured and write file is opened, the while loop is continuously run for write/read from the port and writing to the file until the user stops.

I understand about the orphans.

I don't get the idea about the shift registers, that's partly because I don't understand completely about the concept of error in/out.

Earlier with the delay before read I was able to control the frequency of temperature data acquisition from the thermocouples. I believe the wait (ms) here is for similar purpose.


The mystery part is the functioning of the FOR loop. When I type the commands in the commands for each thermocouple dialog box, I am not clear how it operates.

 

The serial board I interact with has 4 thermocouple input channels. The minimum delay it takes before reading two serial inputs is 70ms. Hence the min frequency I can operate (assume 1 channel) need to be >70ms. So when I operate, say 2 channels, I write to the port asking it to read from ch 1 (something like ARA\r) wait (min 70ms) then write to port asking it to read from ch 2 (something like ARB\r) wait (min 70ms) writ to ch 1 again.  I want this to be in a loop fashion until I press STOP.

 

Am I doing the above operation when I type the code in the commands for each thermocouple ? The no 0.1.2 and so on mean the code I write for each channel A,B, etc. ? When I type the code for , say 2 channels in the commands for each thermocouple  dialog box 0 and 1, when I click run does it take code in 0, write to port-wait-read from it, then take code in 1 write to port-wait-read from it ? 

 

Appreciate your help. I have also attached the output text I got when I ran the VI if it can help.

 

vzv

 


In answer to the Q about the delay.  I believe that what the 70 ms wait for is the minimum time you need to wait in order to receive an answer from  to process the next command.  Since we wait until we get an answer, I believe we are okay.  HOWEVER, if you are sending commands which are NOT queries, I would add maybe 100 ms wait after the write to make sure the command was processed.  I was not aware of this constraint, but I believe we get by okay because we are waiting on the equipment to answer us, and answering us implies that it is ready for the next command.

 

You have the correct idea about the commands for each thermocouplecontrol, but - ugh, my fault - you need to right-click in the text box of the control and set the display type to '\' Codes Display.  I'm sorry about that.  Your VI should work fine then.

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 32 of 43
(1,572 Views)

Thanks billko. Its working excellent now. You guys helped me a lot. Would work with labview at ease now. 

 

How do I post my query in this forum? Because I couldn't find it. I just find a topic relating to my query and can only post as a reply to that.

 

vzv

0 Kudos
Message 33 of 43
(1,564 Views)

@vzv wrote:

Thanks billko. Its working excellent now. You guys helped me a lot. Would work with labview at ease now. 

 

How do I post my query in this forum? Because I couldn't find it. I just find a topic relating to my query and can only post as a reply to that.

 

vzv


Hmmm, not sure what you mean by "post your query?"

 

Glad it's working!  🙂

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 34 of 43
(1,560 Views)

By query I mean, what if I need to ask something other than RS232 communications. .  Can I creat a thread containing my question or do I need to find a related discussion thread and post my question over there as a reply? Because I dont know how to creat an individual thread. Hope I'm not confusing you further.

 

vzv

0 Kudos
Message 35 of 43
(1,552 Views)

You use the New Message button that is near the top of the LabVIEW board.

 

It will make you search first since many people want to ask questions that have been asked and answered 1000's of times before ("How do I export data to Excel?")

 

If you haven't found the answer in your search, then you can compose your message as a new message thread.

Message 36 of 43
(1,545 Views)

Oh!  At the main LabVIEW forum screen, there is a little button on the left side that says "New Message."  LOL, when I first got here, I couldn't find that button, either!

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 37 of 43
(1,546 Views)

@RavensFan wrote:

You use the New Message button that is near the top of the LabVIEW board.

 

It will make you search first since many people want to ask questions that have been asked and answered 1000's of times before ("How do I export data to Excel?")

 

If you haven't found the answer in your search, then you can compose your message as a new message thread.


An additional benefit of the required search is that it prevents topics like "URGENT!!!  HELP ME PLZZZ PLZZZZZZ!!!!" and forces (or at least encourages) the poster to phrase his question meaningfully. Smiley Happy  I'm surprised more forums haven't adopted this policy.

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019 - Unfortunately now moving back to C#, .NET, Python due to forced change to subscription model by NI. 8^{
Message 38 of 43
(1,520 Views)

Thank you RavensFan, Billko and NIquist once again.

 

vzv

0 Kudos
Message 39 of 43
(1,507 Views)

@vzv wrote:

Thank you RavensFan, Billko and NIquist once again.

 

vzv


Thank you is usually coulped with a Kudos Just click the star under the posters name.  It is sort of cheesy but very few posters will reject a Kudos!


"Should be" isn't "Is" -Jay
Message 40 of 43
(1,497 Views)