Jump to content

Serial communication: Taking the next step


bjarket

Recommended Posts

Hi!

I've studied the simple serial communication examples in LabVIEW and knows how to set up and close a connection.

But how do I take the next step? What is good programming practice when developing a routine for serial communication?

My application is about streaming data via RS232, and I would appreciate references for further development

/Bjarke

Link to comment
Hi!

I've studied the simple serial communication examples in LabVIEW and knows how to set up and close a connection.

But how do I take the next step? What is good programming practice when developing a routine for serial communication?

My application is about streaming data via RS232, and I would appreciate references for further development

/Bjarke

It will mainly depend on what type of data you are streaming and what you are streaming from. Many serial devices have their own way of sending data and you need to know how to decode the data as it is received. After you have determined what type of data it is sending you and how to properly decode it, you can then build an appropriate program around it. :book:

Link to comment
It will mainly depend on what type of data you are streaming and what you are streaming from. Many serial devices have their own way of sending data and you need to know how to decode the data as it is received. After you have determined what type of data it is sending you and how to properly decode it, you can then build an appropriate program around it. :book:

So true! I'm building both the transmitter and receiver, so I can pretty much decide everything... The data to be sent is both measurements taken from a DAQ device and commands to start and stop measuring. I see a lot of different possible solutions and could go from there. However, my question was intended to be more general than that. I'm interested in dos and don'ts such that I can improve the quality of my code...

Link to comment
Hi!

I've studied the simple serial communication examples in LabVIEW and knows how to set up and close a connection.

But how do I take the next step? What is good programming practice when developing a routine for serial communication?

My application is about streaming data via RS232, and I would appreciate references for further development

/Bjarke

Do a websearch for Scott Hannah's Serial Server routines in LabVIEW. They are an example of well-written code that can read/write serial data.

Any other improvements really depend on your application. Are you JUST reading and writing? Do you need to analyze the data? What is the Baud rate/Data Rate?

In the past, I had a very high data rate serial application with lots of display/file write/analysis. About 20 plots, over 200 variables, and data at 10Hz from the device. There I had two loops, a very fast serial loop, and a slower parse/display/write loop. The 2 loops communicated via 2 separate Q's. One for data read from the device and another for sending commands to the device. Both loops were state-machines. Sorry can't post any code.

Neville.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.