Reading Calibration Information from a Digital Accelerometer

Reading Calibration
Information from a
Digital Sensor
Tech Note 414
Calibration data is stored in the sensor as a block of ASCII data. There are several steps involved in reading this data, then
interpreting the information. This note discusses how to read data from the digital sensor, how to find the calibration data,
and how to interpret the data.
The SIP Protocol
Measurement Specialties Serial Instrument Protocol, SIP™, is a general purpose protocol designed around the requirements
of instrument and sensor communications. This tech note uses a subset of the SIP protocol to read the calibration data from
the sensor.
The SIP protocol is a command/response protocol. Only the bus controller (typically a PC) issues commands. Every
command is responded to by the sensor.
SIP Commands
SIP commands and responses follow the following format:
Command 1 Byte
Bits 7-4 : data length in bytes (0-15 bytes) or 16 byte blocks-1
Bit 3 : 1 = data length is in bytes / 0 = length in 16 byte blocks-1
Bits 2-0 : Command or Response code
Data 0 to 16 bytes
CRC 2 bytes (low byte sent first)
Listen Command
0 0 0 1 1 0 0 0 : 1 byte of data; Command = 8 = Listen
0 0 0 0 0 0 0 1 : Device number = 1 = factory default
x x x x x x x x : CRC low byte
x x x x x x x x : CRC high byte
Write Address Register
0 1 0 0 1 1 0 0 : 4 bytes of data; Command = 4 = Write Address Register
x x x x x x x x : 4 bytes Address pointer
xxxxxxxx:
xxxxxxxx:
xxxxxxxx:
x x x x x x x x : CRC low byte
x x x x x x x x : CRC high byte
Read Data @ Address
x x x x 1 1 1 1 : Reply with x bytes of data; Command = 7= Read Data at Address
x x x x x x x x : CRC low byte
x x x x x x x x : CRC high byte
TN 414: Reading Calibration Information from a Digital Sensor
precisionsensors.meas-spec.com 2236 N. Cleveland-Massillon Road
Akron OH 44333 PH : 330-659-3312 7/24/2013
www.meas-spec.com
For this command, the Reply message contains the data requested.
Reply messages have the following format:
Response 1 Byte
Bits 7-4 : data length in bytes (0-15 bytes) or 16 byte blocks-1
Bit 3 : 1 = data length is in bytes ; 0 = length in 16 byte blocks-1
Bits 2-0 : Command or Response code
Data 0 to 16 bytes
CRC 2 bytes (low byte sent first)
Ack Response
0 0 0 0 1 1 0 1 : 0 Bytes of data; 5 = Response is Acknowledged
x x x x x x x x : CRC low byte
x x x x x x x x : CRC high byte
Read Data Response
x x x x 1 1 0 1 : x Bytes of data; 5 = Response is Acknowledged
Data 0 to 16 bytes
x x x x x x x x : CRC low byte
x x x x x x x x : CRC high byte
Reading the digital sensor internal memory
The following steps are required to read the Calibration data from a Digital Sensor. The steps correspond to the example at
the end of this note:
1. Send a Listen command to enable the Digital Sensor to process commands.
2. Wait for the sensor to acknowledge the processing of the Listen Command.
3. Send the Write Register command to write the memory address 0x80000016 to the address register. This is the address
of the pointer to the calibration data block.
4. Wait for the sensor to acknowledge the processing of the Write Register Command.
5. Use the Read Data @ Address command to read the address of the calibration data.
6. Wait for the sensor to reply with the data. This is the address of the calibration data.
7. Send the Write Register command to write the memory address of the calibration data header to the address register.
The Calibration data header address is ten less than the calibration data address.
8. Wait for the sensor to acknowledge the processing of the Write Register Command.
9. Use the Read Data @ Address command to read ten bytes of the calibration data header.
10. Wait for the sensor to reply with the data. This is the header of the calibration data block. The seventh through tenth
byte is the pointer to the next empty byte in the data block. The length of the calibration data block is the address returned
in step 6 subtracted from this address.
TN 414: Reading Calibration Information from a Digital Sensor
precisionsensors.meas-spec.com 2236 N. Cleveland-Massillon Road
Akron OH 44333 PH : 330-659-3312 7/24/2013
www.meas-spec.com
11. Send the Write Register command to write the memory address of the calibration data to the address register.
The Calibration data address was read in step 6.
12. Wait for the sensor to acknowledge the processing of the Write Register Command.
13. Use the Read Data @ Address command to read 16 bytes of the calibration data block.
14. Wait for the sensor to reply with the data.
15. Repeat steps 13 and 14 until the entire calibration data block has been read. Note that the address register
automatically increments to point to the next block of data. Since the Calibration Data block is not necessarily a
multiple of 16 bytes, the last Read Data @ Address command may be for something less than 16 bytes.
Interpreting the Calibration data block
The calibration data block is a collection of strings delimited by carriage return (0x0d in hex). Each string starts
with a two letter prefix and parameters that are separated by commas.
The alignment data has the following format:
ALS,Axis1,Axis2,Axis3
where:AL signifies alignment data
S is the Sensor number (for example 2 for A2, note: this is not the channel number)
Axis1 the normalized reading along Axis 1
Axis2 the normalized reading along Axis 2
Axis3 the normalized reading along Axis 3
For example the alignment string for A2 might be:
AL2,-0.00510,0.99978,0.02027
TN 414: Reading Calibration Information from a Digital Sensor
precisionsensors.meas-spec.com 2236 N. Cleveland-Massillon Road
Akron OH 44333 PH : 330-659-3312 7/24/2013
www.meas-spec.com
Reading Calibration Data Example
Step
1
Sent by Controller
0x18
0x01
0xCB
0xC0
Listen
Device ID 1 (factory default)
CRC Low
CRC High
2
3
0x4C
0x16
0x00
0x00
0x80
0x14
0x26
0x4F
0x41
0xF4
0x4C
0x00
0x7C
0x00
0xC0
0xD0
0x46
Ack
CRC Low
CRC High
0x0D
0xC1
0xC5
Ack
CRC Low
CRC High
0x4D
0xC0
0x00
0x7C
0x0A
0xB0
0xC9
Read Data Response 4 bytes
Returned data
0x0D
0xC1
0xC5
Ack
CRC Low
CRC High
CRC Low
CRC High
Read Data @ Address 4 bytes
CRC Low
CRC High
6
7
0x0D
0xC1
0xC5
Write Address Register
Calibration Data Address Pointer
4
5
Reply from 65210 Series System
CRC Low
CRC High
Write Address Register
Calibration Data Header Address
CRC Low
CRC High
8
continued on next page...
TN 414: Reading Calibration Information from a Digital Sensor
precisionsensors.meas-spec.com 2236 N. Cleveland-Massillon Road
Akron OH 44333 PH : 330-659-3312 7/24/2013
www.meas-spec.com
Step
9
Sent by Controller
0xAF
0x40
0x7C
Read Data @ Address 10 bytes
CRC Low
CRC High
10
11
0x4C
0x0A
0x7C
0x00
0xC0
0xD3
0x0E
0x07
0x41
0xC2
0xAD
0x20
0x08
0xC0
0x00
0x7D
0x80
0xC0
0x00
0x7D
0x11
0x85
0xFB
Read Data Response 10 bytes
Returned data
0x0D
0xC1
0xC5
Ack
CRC Low
CRC High
0x05
0x44
0x54
0x32
0x37
0x2D
0x4A
0x75
0x6C
0x2D
0x32
0x30
Read Data Response 16 bytes
CRC Low
CRC High
Write Address Register
Calibration Data Address
CRC Low
CRC High
12
13
Reply from 65210 Series System
Read Data @ Address 16 bytes
CRC Low
CRC High
14
continued on next page...
TN 414: Reading Calibration Information from a Digital Sensor
precisionsensors.meas-spec.com 2236 N. Cleveland-Massillon Road
Akron OH 44333 PH : 330-659-3312 7/24/2013
www.meas-spec.com
Step
Sent by Controller
Reply from 65210 Series System
0x30
0x34
0x20
0x31
0x35
0xB5
0x9F
...Continue to Read 16 byte Cal Data Blocks
(not shown)
.
.
.
The last block may be less than 16 bytes
For this example, read the last 7 bytes
15
0x7F
0x41
0xE0
Read Data @ Address 7 bytes
CRC Low
CRC High
16
TN 414: Reading Calibration Information from a Digital Sensor
precisionsensors.meas-spec.com 0x7D
0x30
0x2E
0x39
0x39
0x39
0x39
0x34
0xA3
0xE3
Read Data Response 7 bytes
2236 N. Cleveland-Massillon Road
Akron OH 44333 PH : 330-659-3312 7/24/2013
www.meas-spec.com