Monitor - ISSN 1472-0221
The Newsletter for PC-Based Data Acquisition and Control
Issue 213, May 2016
Welcome to Monitor, the data acquisition and control newsletter. Don't forget subscribers can download our serial data acquisition and trouble-shooting software.
You can download Monitor as a pdf file from https://www.windmill.co.uk/monitor/monitor213.pdf.
Contents
* Reading data over an I2C bus
* Windmill Question: Taking a weight reading by pressing a key
* Excel Corner: Copying only Visible Cells
* DAQ News Round-up
Reading data over an I2C bus
Web link: https://www.windmill.co.uk/i2c.html
The I2C bus was developed by Philips Semiconductors. It was designed to provide communicaitons between integrated circuits, though now it's used in many other applications.
I2C uses just two wires: the clock wire (called SCL) and the data wire (called SDA).
All devices on the I2C bus are either a master or slave. There is generally just one master which controls the clock and data transfer. The slave devices respond to the master.
Initiating a Message
When the master wishes to talk to a slave it sends a start sequence, leaving SCL high and pulling SDA low.
Transferring Data
Data is transferred in sequences of 8 bits. The bits are placed on the data line starting with the Most Significant Bit (MSB). After every bit the clock line pulses high then low.
For every 8 bits transferred, the device receiving the data sends back an acknowledge bit (ACK). This means that there are 9 SCL clock pulses for each 8-bit byte of data.
Acknowledging the Data Transfer
If the receiving device sends back a low ACK bit, then it has received the data and is ready to accept another byte. If it sends back a high then it is indicating it cannot accept any further data and the master should terminate the transfer by sending a stop sequence.
Addressing I2C Devices
I2C addresses are most commonly 7 bits.
Even though the address is 7-bit, the master always sends 8 bits. The extra bit tells the slave whether data is being read or written. If the bit is 0 then the master is writing to the slave. If the bit is 1 then master is reading from the slave. The 7-bit address is placed in the upper 7 bits of the byte and the Read/Write (R/W) bit is in the LSB (Least Significant Bit). Thinking in 8-bit bytes, this means that even numbers are write addresses and odd numbers read addresses.
Working in decimal this addressing method can be confusing. Decimal 15 for example, is 00001111. But if you are sending 15 as a 7-bit address plus a read direction bit, you send 00011111 which is decimal 31.
Reading from and Writing to Registers
After sending the start sequence and the slave address, the next thing is to specify the register to which you want to write or from which you want to read. Some devices don't have any registers, some have several. After specifying the register the master can send the data. If more data arrives than will fit in the register, the slave just allocates it to the next register.
Stopping sending Data
At the end of the transfer the master sends the stop sequence.
Software to communicate with I2C Devices
Windmill ComDebug lets you communicate with I2C devices. Subscribes can download this from https://www.windmill.co.uk/jsarrpsrr.htm.
You can read the complete I2C bus specification here.
Windmill Question: Taking a weight reading by pressing a key
Question
Good Afternoon - I may be trying to do something the software is not designed to do, but I thought I would ask if it is possible. I would like to be able to log data from my balance only when I hit a key on my computer keyboard. For example, I would like to weigh one sample, hit print to log the weight, then weigh another sample and hit print to log that weight. I do not want continuous logging. I have the files set up to log weight correctly (from a Denver Instrument SI-234 balance), but the only thing I can figure out how to do is continuously log. Is there a way to do what I want to do?
Answer
Yes, you can log data when you hit a key on the keyboard, but you need the Windmill Logger program to do so. You just need to license your trial copy to get the full version of Windmill.
Whilst ComDebug logs data continuously, Logger has many more options for starting and stopping logging. With Logger, for example, you can automatically log only when the weight changes on the balance. Even if two items weigh the same, Windmill knows that a change has occurred and doesn't miss a reading.
To log data when you press a key on the keyboard go to the Logger settings and choose Log on Keypress. Set the log duration to less than the logging interval or sample rate. For example, setting the log duration to half a second and the logging interval to 1 second will result in one reading being taken whenever you hit a key.
Logger options for taking readings
The full version of Logger is available at https://www.windmillsoft.com/daqshop/rs232-modbus.html.
Excel Corner: Copying only Visible Cells
Imagine you have hidden some of the rows or columns in your spreadsheet. If you select to copy a range containing the hidden cells, all cells will be copied - not just the visible ones. If you only want to copy the cells you can see then you need to do things differently.
- Select the range to copy.
- On the Home tab, in the Editing group, click Find and Select, and then click Go To. Or for earlier versions of Excel, from the Edit menu select Go To.
- Click the Special button and choose Visible cells only.
- Press Ctrl C to copy. You can now paste the cells.
For more Excel tips see https://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 grab our rss feed.
Robot ranchers monitor animals on giant Australian farms
Farmbots will herd livestock, keep an eye on their health and check they have enough pasture to graze on.
Source: New Scientist
https://www.newscientist.com/
Engineers shrink size and cost of RFID chips
Engineers have created passive radio-frequency identification (RFID) tags that are 25 percent smaller - and therefore less expensive. This is possible because the tags no longer need to convert alternating current (AC) to direct current (DC) in order for the tags to function effectively.
Source: North Carolina State University
https://news.ncsu.edu/
Revised ISA alarm management standard approved
The Management of Alarm Systems for the Process Industries standard has been improved.
Source: ISA
https://www.isa.org/
Earth's forest biomas to be measured from space
Airbus Defence and Space are to build a Biomass satellite to measure forest biomass and assess terrestrial carbon stocks and fluxes for five years. The spacecraft will deliver exceptionally accurate maps of tropical, temperate and boreal forest biomass that are not obtainable by ground measurement techniques.
Source: Airbus Defence and Space
https://airbusdefenceandspace.com//
Graphene sensor detects individual molecules to warn of indoor air pollution
Air pollution in homes and work places, which can cause health problems such as headaches, nausea and breathing difficulties, could be detected with an ultra-sensitive graphene sensor.
Source: The Engineer
https://www.theengineer.co.uk/
* Copyright Windmill Software Ltd
* Reprinting permitted with this notice included
* For more articles see https://www.windmill.co.uk/
We are happy for you to copy and distribute this
newsletter, and use extracts from it on your own web
site or other publication, providing the above notice
is included and a link back to our website is in place.
For previous issues by subject see https://www.windmill.co.uk/monitorindex.html
DOWNLOAD DATA ACQUISITION SOFTWARE
As a thank you for subscribing we offer you the ComDebug data logging and Com port trouble-shooting software. Log data over RS232, RS422, RS485 or Modbus. Also included is a month's trial of the Windmill 7 logging, charting and control programs.
SUBSCRIBING OR CANCELLING SUBSCRIPTION Visit https://www.windmill.co.uk/newsletter.html and add or remove your e-mail address.
Windmill Software Ltd, PO Box 58, North District Office,
Manchester, M8 8QR, UK
Telephone: +44 (0)161 834 6688
Facsimile: +44 (0)161 833 2190
E-mail: monitor@windmillsoft.com
https://www.windmill.co.uk/
https://www.windmillsoft.com/