SWTB_Banner_Left_LogoOnly

UCON Scale Example

clearpixel

SWTB_7Button_BlueLine

Weight Scale

The Device profile below is from the Transaction editor and shows the protocol configuration for a A&D Weight Scale. The Scale reads a weight and sends the information to the Comm. port of the PC ending with a carriage return and line feed. The protocol message is shown below.

Incoming Data

xxx,

+####.##

xxx

0D0A

header

Data

units

end message

Since this is a Unsolicited Serial message, a new block was created (Block_1) in the Transaction Editor along with counter tag. The counter tag increments ever time a new message is received, so that when two messages of the same data are received, one after the other, the client program can determine that a second message with same data has been received. Under the Unsolicited Icon on the right, the first step is to create the Read Response entry. The incoming message is fixed length and always ends with the same characters. The Read Response is set to look for stop characters to determine what incoming data is a single message.

In this case the stop characters are 0x0D (carriage return) 0x0A (line feed). This message is then placed in a read buffer with a pointer set to the first byte of the message. The first tag updated is the counter tag. This tag simply increments by one with every new message placed in the buffer. 

The next tag updated is the Header tag. This data contains three characters identifying the state of the incoming measurement, for example stable or unstable. The header is followed by a comma, so we move the Buffer Pointer one byte to start the next tag update at the beginning of the data string. 

The Data part of the message always begins with a + or - sign. In order to report the sign of the data the Value tag is a string and not a float. To read this data as an ASCII float we would have to disregard the sign and move the buffer pointer 2 bytes. 

The next part of the message is the Unit which is read as a string of three byte. The units can be up to three characters in this message but is normally two spaces with a single character. The Units tag is formatted to pad the spaces as spaces the same way they are received in this example.

Download this example project.

 

 

 | HOME | OVERVIEW | EXAMPLES | QUICK START | RELATED PRODUCTS | SUPPORT & DOWNLOADS | PRICING & ORDERING

P: 1-888-665-3678 (US-Sales) or 704-849-2773 (Support & International), F: 704-849-6388
148A East Charles Street, Matthews, North Carolina, USA 28105
Copyright Software Toolbox, Inc., 1996-2006, All Rights Reserved Worldwide.