Monitor (ISSN 1472-0221) Issue 183
-------------------------Monitor------------------------ The Newsletter for PC-Based Data Acquisition and Control Issue 183 www.windmill.co.uk October 2013 --------------------ISSN 1472-0221---------------------- Welcome to Monitor: thanks for subscribing. Could you help us decide the future of Monitor by answering a couple of questions? 1. Would you rather have: [ ] Full articles as now or [ ] Snippets of articles and links to the website for more information 2. Would you prefer: [ ] Plain format as now or [ ] More fancy formatting with 2 columns, more pictures and so on 3. Any other comments? Just reply to this email with your answers. Thank you! Should you wish to remove yourself from our mailing list please go to https://www.windmillsoft.com/daqshop/Monitor_Newsletter.html CONTENTS ======== * ASCII, Decimal, Hex and Control Characters * Communicating with Serial Instruments: Part 2 * Questions on Using Windmill: Logging the Cold Junction * Excel Corner * DAQ News Round-up ________________________________________________________ ________________________________________________________ ASCII, Decimal, Hex and Control Characters ________________________________________________________ When you are logging data or controlling a measurement instrument plugged into the Com port, using software like ComDebug, you need to enter or extract data in ASCII characters or as hexadecimal. This is straight- forward for letters and numbers, but what about special, non-printing, characters like linefeeds or carriage returns? Char Ctrl Dec Hex Meaning NUL ^@ 000 00 Null character SOH ^A 001 01 Start of Header STX ^B 002 02 Start of Text ETX ^C 003 03 End of Text EOT ^D 004 04 End of Transmission ENQ ^E 005 05 Enquiry ACK ^F 006 06 Acknowledge BEL ^G 007 07 Bell BS ^H 008 08 Backspace HT ^I 009 09 Horizontal tab LF ^J 010 0A Line feed VT ^K 011 0B Vertical tab FF ^L 012 0C Form feed CR ^M 013 0D Carriage return SO ^N 014 0E Shift out SI ^O 015 0F Shift in DLE ^P 016 10 Data link escape DCL ^Q 017 11 Xon DC2 ^R 018 12 Device control 2 DC3 ^S 019 13 Xoff DC4 ^T 020 14 Device control 4 NAK ^U 021 15 Negative acknowledge SYN ^V 022 16 Synchronous idle ETB ^W 023 17 End of transmission CAN ^X 024 18 Cancel EM ^Y 025 19 End of medium SUB ^Z 026 1A Substitute ESC ^[ 027 1B Escape FS ^\ 028 1C File separator GS ^] 029 1D Group separator RS ^^ 030 1E Record separator US ^_ 031 1F Unit separator SP 032 20 Space The manuals for some instruments give Control characters which you would normally enter on a keyboard or using the instrument's front panel. Our table shows the decimal and hexadecimal values you can enter when controlling instruments from data logging software. With ComDebug (free to subscribers) you can enter special characters as decimal values. Either use the NonPrint menu or your keyboard's numeric keypad. Alternatively just type the hexadecimal value straight into the Hex column. ASCII includes definitions for 128 characters, 33 of which are non-printing control characters. Originally these were used for instruments like teleprinters, so many of the codes are now obsolete. Carriage Return, Line Feed and Escape are the three that you will most often come across. Also look out for STX and ETX which are used to mark the start and end of messages from instruments. ________________________________________________________ ________________________________________________________ Communicating with Serial Instruments: Part 2 ________________________________________________________ Last month we discussed how to quickly edit the communication part of the set-up file for the free ComDebug data logging software. As we explained in the last issue, you can tell ComDebug about your measurement instrument by making selections in menus and dialogue boxes. ComDebug saves your settings in an *.imd file. Some advanced users, though, like to edit this file directly. You will find your set-up file (*.imd) in the Windmill directory. You can edit it in any text editing program, like Notepad or Wordpad. IMPORTANT: Before editing your imd file please make a backup. The Message part of the file tells ComDebug how to grab the data from the string of characters sent by the instrument: [Message1]
This looks like gobbledygook but with the help of the table above is actually quite easy to understand. [Message1] Name=Message_1 Prompt=W\C(013)\C(010) Parse=\I"0123456789"\E(0)"\C(013)" Ack=
Using ComDebug to enter the Prompt and Parse string Prompt - The command sent to the instrument to ask for data. In the example above it is W followed by a carriage return - \C(013) - and a line feed - \C(010). Parse - ComDebug extracts the actual data from the superfluous characters around it. In our example above \I tells ComDebug to ignore everything until it reaches a numerical digit. \E tells ComDebug to extract characters until a carriage return - \C(013) - occurs. It stores the data in channel 0. Ack - Some instruments need an acknowledgement that they have sent data, which will be given in the Ack line. To tell ComDebug to look for non-printing characters, like carriage returns, use the format \C(013), where 013 is the decimal value of the character. See the previous section for a table of decimal values for various non-printing characters. Other options are available, for example: \I followed by a number not in quotes, means ignore the next n bytes Similarly, \E followed by a number means extract the next n bytes \S means search for all these characters, for example \S"data=" ComDebug can extract data in lots of ways - Extract Until or Extract the Next N are the most common but there are many other options including: \H - Extract N Bytes as Hex \J - Extract Integer LSB-MSB (16-bit 2s complement integer: 2 bytes, -32768 to +32767) \K - Extract Integer MSB-LSB (16-bit 2s complement integer: 2 bytes, -32768 to +32767) \L - Extract Word LSB-MSB (16-bit 2s complement integer: 2 bytes, 0 to 65535) \M - Extract Word MSB-LSB (16-bit 2s complement integer: 2 bytes, 0 to 65535) \N - Extract Signed Byte (A single byte of data interpreted as a value in the range -128 to +127) \O - Extract Byte (A single byte of data interpreted as a value in the range 0 to 255) \P - Extract Bit (A single bit of data, which can only have values of 1 or 0) \Q - Extract Float (Four byte floating point) \R - Extract Reverse Float (As Float, but the bytes are in reverse order) \T - Record Number (enables Windmill to know that a new reading has been taken, even if that reading is the same as the previous one) If you need any help setting up ComDebug to work with your instrument - we have a series of examples at http://www.windmill.co.uk/serial_driver.html. Alternatively you could e-mail your *.imd file, together with details of your instrument and a description of the problem, to [email protected] Further Reading: ================ Parsing Messages from RS232 Instruments http://www.windmill.co.uk/parse.html ________________________________________________________ ________________________________________________________ Questions on Using Windmill ________________________________________________________ This month's question is about a Microlink 751-TC temperature measurement system which we sell in our on-line shop. Question: How can I log the temperature of the cold junction as well as the temperature reported by thermocouples? Answer: First some background. When monitoring thermocouples it is essential that the system knows the temperature of one of the thermocouple junctions. Housing this junction in the isothermal box keeps the temperature constant, and a cold junction sensor in the box tells the system the temperature. To log the cold junction temperature, open the SetupIML program and enable Channel 16. In Windmill Logger, select Channel 16 alongside the thermocouple channels. Windmill will now record the cold junction temperature, which should be stable. The Microlink 751-TC is currently on special offer, reduced from £730 to £360. ________________________________________________________ ________________________________________________________ Excel Corner: Quick Tips ________________________________________________________ You use the File > Open menu option in Excel to open a data file, and it always goes to the MyDocuments directory, which you don't use. You've been meaning to fix it for ages - do it now. Here's how: 1. From Excel's Tools menu choose Options 2. Select the General tab 3. Choose a new default file location While there you could also set more entries to be shown in the recent files list, and change the number of sheets in a new workbook from 3 to 1. Read more Excel tips for scientists and engineers at http://www.windmill.co.uk/excel/excel-tips.html ________________________________________________________ ________________________________________________________ DAQ News Round-up ________________________________________________________ Welcome to our round-up of the data acquisition and control news. If you would like to receive more timely DAQ news updates then follow us on Twitter - @DataAcquisition or Google+ - https://plus.google.com/107072683025496630222/
Killer Robots Slash Jellyfish Aquatic robots, communicating by ZigBee, are tracking and killing millions of jellyfish. Source: SCUBA News http://news.scubatravel.co.uk/
To receive Monitor every month please fill in your e-mail address below. We will not pass your address to any third parties, nor send you any unsolicited e-mail.