Site Search:

How To Use Protocol-level Commands

FacebooktwitterredditlinkedinmailFacebooktwitterredditlinkedinmail

ProtocolSince DATAQ Instruments released protocol documentation for its data acquisition starter kits, many requests have been received for an example program to show how they’re used. It makes sense, because using protocol commands is not as easy as you might think. Setting up the data acquisition starter kit using the protocol is usually a straight-forward affair. You might have to slug through some binary-to-hex or binary-to-decimal conversions, but configuring such items as scan lists and sampling rate presents no real problem for a reasonably astute programmer. The fun begins when the protocol’s START command is issued and the instrument is configured for its most efficient operating mode: binary. In that instant, 8-bit serial data begins flying at the program at rates up to 20,000 per second, so the program had better be prepared to handle it. Then there are the required per-byte, bit-wise manipulations to construct a usable ADC value. It’s at this point that novice programmers may run for cover, and even their seasoned counterparts may struggle to manage the avalanche of data coming at them.

VB.NET Protocol Example Program

To provide a framework for how one might handle protocol-level programming, especially when binary output data is configured, we’ve released an example VB.NET program. The program allows you to enter a protocol command and see the response in an output window. For example:

info 1 1550
info 0 DATAQ

The program is designed to handle ASCII, as well as binary responses from any hooked COM port. Results that return binary streams are converted into ADC counts and display as ASCII values in the output window. And the program is really fast. It can keep pace with the fastest sampling rates while outputting ADC count values in real time as they’re acquired. To achieve this, the program uses an event handler that’s triggered by starter kit data entering the hooked COM port. Exactly how this is done and how the binary streams are converted into ASCII is documented in well-commented source code, and it supports the DI-145, -149, -155, and -245 data acquisition starter kits.

.NET? Really?

Well, right. Since all the data acquisition starter kits are provided with a .NET class, why would anyone want to program these devices in .NET at the protocol level? The short answer is, “no one”, but we had to provide the sample program in SOME programming language and in SOME popular environment. VB.NET just felt right. Besides, for those really locked out of Windows, the source code (frmProtocolTool.vb) is a text file that can be viewed from any operating system.

Downloads follow

Use the following inks to access protocol documents for various starter kits (you’re really gonna need those) as well as the zipped VB.NET protocol example program:

DI-145 Protocol Doc
DI-149 Protocol Doc
DI-155 Protocol Doc
DI-245 Protocol Doc
VB.NET protocol example program

Finally, support

We’ve tested the program and found it to work well. Any bugs you find can be reported using our support ticket system.

 

 

Follow Us
FacebooktwitterlinkedinyoutubeFacebooktwitterlinkedinyoutube

 Categories: Data Acquisition, Programming

 Tags: , , ,

 Bookmark the permalink

 RSS Feed (comments for this post)

 Post a comment

 Trackback URL

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>