Serial Commands
The MTS160 supports a set of ASCII text commands over RS232 and USB. Commands are not case-sensitive.
All commands and replies are terminated by a carriage return character (0x0D, \r).
Command Prefixes
! Set
Commands beginning with ! are used to execute actions or write configuration parameters.
Configuration changes are stored in nonvolatile memory when the command is accepted and remain in effect after power cycling.
If a command is received and parsed successfully, the sensor replies by echoing the command followed by ,OK.
Example:
Set Zero Level: !ZERO
Reply: !ZERO,OK? Get
Commands beginning with ? are used to request live sensor data, fixed sensor information, or current configuration values.
The sensor replies with the command name followed by a comma and the requested data.
Examples:
Get Firmware Revision: ?FWVR
Reply: ?FWVR,106,20240325,2882400018
Get Communication Configuration: ?SNCF
Reply: ?SNCF,50,50# Repeat / @ Stop Repeat
Commands starting with the # character are Get commands identical to those above, except that the sensor will send a reply with new data repeatedly. The repeat rate is determined by a value in milliseconds, separated by a comma, at the end of the command.
Multiple repeat commands can be running at the same time, all with their own repeat rate.
Sending the @ character stops all the running repeat commands.
Example:
Get Sensor Values every 10ms: #SALL,10
Repeating reply: ?SALL,0,0,0,0,0,0,0,0,0,0,0,250
Stop Repeating: @Commands Summary
The tables below summarize all the commands supported by the sensor. Details for each command are in the sections that follow.
Action Commands (! Set Only)
| Command | Description |
|---|---|
| RSET | Reset to Factory Defaults |
| STST | Perform Self-Test |
| ZERO | Calibrate Zero Level |
Data Requests (? Get Only)
| Command | Description |
|---|---|
| FWVR | Firmware Version |
| HWVR | Hardware Version |
| NVCD | Navicode |
| RSEN | Internal Sensor Values (Calibrated) |
| SALL | Read All Sensor Data |
| SNID | Sensor Serial Number |
| STRS | Self-Test Results |
Configuration Commands (! Set and ? Get)
| Command | Description |
|---|---|
| CMCF | Communication Mode |
| CNCF | CAN Configuration |
| RSCF | RS232 Configuration |
| SNCF | Sensor Configuration |
Action Commands
RSET — Reset to Factory Defaults
Resets all configuration parameters to their factory-default values.
This command will also clear the zero calibration. The sensor needs to be re-calibrated before use.
Syntax: !RSET
Arguments: None
STST — Perform Self-Test
Initiates the internal self-test of the MTS160 sensing system. Use ?STRS to read the test results.
Syntax: !STST
Arguments: None
ZERO — Calibrate Zero Level
Captures and stores the ambient magnetic field strength at each internal sensor when no track or markers are present. Subtracts these values from subsequent readings.
Syntax: !ZERO
Arguments: None
Data Requests
FWVR — Read Firmware Version
Reads the firmware revision, build date, and firmware hash.
Syntax: ?FWVR
Reply: ?FWVR,Revision,Date,FirmwareHash
| Parameter | Type | Format |
|---|---|---|
| Revision | Unsigned 32-bit | 010203 = v1.2.3 |
| Date | Unsigned 32-bit | YYYYMMDD |
| FirmwareHash | Unsigned 32-bit | — |
HWVR — Read Hardware Version
Reads the Hardware Version code.
Syntax: ?HWVR
Reply: ?HWVR,Version
| Parameter | Type |
|---|---|
| Version | Unsigned 8-bit |
NVCD — Read Navicode Marker
Reads the last decoded Navicode value and the associated detection counter. The counter increments each time a valid Navicode is detected.
Syntax: ?NVCD
Reply: ?NVCD,NaviCode,Count
| Parameter | Type | Range |
|---|---|---|
| NaviCode | Unsigned 16-bit | 0–65535 |
| Count | Unsigned 8-bit | 0–255 |
RSEN — Read Internal Sensor Values (Calibrated)
Reads the values of all 32 internal magnetic sensors after zero-offset correction.
Syntax: ?RSEN
Arguments: None
Reply: ?RSEN,Value1,Value2,…,Value32
| Parameter | Type | Units | Range |
|---|---|---|---|
| Value(n) | Signed 16-bit | milliTeslas | ±16000 |
SALL — Read All Sensor Data
Reads the main sensor measurement set in a single comma-delimited reply. The values are defined by their fixed order in the message. An 8-bit frame counter is appended at the end of the reply and increments each time SALL is requested, either by a ? command or by a # repeat command.
Syntax: ?SALL
Arguments: None
Reply: ?SALL,TDet,LTPos,LTAng,RTPos,RTAng,LM,RM,LMPos,RMPos,Count
| # | Field | Description | Type | Units | Range |
|---|---|---|---|---|---|
| 1 | TDet | Track Detect / Strength | 4-bit | — | 0–3 |
| 2 | LTPos | Left Track Position | Signed 8-bit | Millimeters | ±80 |
| 3 | RTPos | Right Track Position | Signed 8-bit | Millimeters | ±80 |
| 4 | LTAng | Left Track Angle | Signed 8-bit | Degrees | ±90 |
| 5 | RTAng | Right Track Angle | Signed 8-bit | Degrees | ±90 |
| 6 | LM | Left Marker Detect | bool | — | 0–1 |
| 7 | RM | Right Marker Detect | bool | — | 0–1 |
| 8 | LMPos | Left Marker Position | Signed 8-bit | Millimeters | ±80 |
| 9 | RMPos | Right Marker Position | Signed 8-bit | Millimeters | ±80 |
| 10 | Count | Frame Counter | Unsigned 8-bit | — | 0–255 |
SNID — Read Sensor Serial Number
Reads the sensor's unique hardware identification number.
Syntax: ?SNID
Reply: ?SNID,SerialNum
| Parameter | Type |
|---|---|
| SerialNum | Unsigned 32-bit |
STRS — Read Self-Test Results
Reads the results of the most recent self-test, whether performed automatically at power-up or started by the user. Returns the pass/fail status followed by the minimum and maximum magnetic delta measured across the internal sensing ICs.
Syntax: ?STRS
Reply: ?STRS,Result,MinMagDelta,MaxMagDelta
| Parameter | Type | Range |
|---|---|---|
| Result | Unsigned 8-bit | 0 = Pass, 1 = Fail |
| MinMagDelta | Unsigned 8-bit | — |
| MaxMagDelta | Unsigned 8-bit | — |
Configuration Commands
CMCF — Communication Mode
Selects the sensor's communication mode and protocol.
Set Syntax: !CMCF,Mode
Get Syntax: ?CMCF
Reply: ?CMCF,Mode
| Parameter | Options |
|---|---|
| Mode | 0: RS232 (Factory Default) |
| 1: CANopen |
CNCF — CAN Configuration
Defines the parameters necessary for CAN operation.
Set Syntax: !CNCF,NodeId,Bitrate,AutoRun,TermResistor,Heartbeat,TPDO1on,Period1,TPDO2on,Period2,TPDO3on,Period3
Get Syntax: ?CNCF
Reply: ?CNCF,NodeId,Bitrate,AutoRun,TermResistor,Heartbeat,TPDO1on,Period1,TPDO2on,Period2,TPDO3on,Period3
| Parameter | Type | Range / Options | Default |
|---|---|---|---|
| NodeId | Unsigned 8-bit | 1–127 | 1 |
| Bitrate | — | 125000: 125 kbits/s | 250000 |
| 250000: 250 kbits/s (Factory Default) | |||
| 500000: 500 kbits/s | |||
| 1000000: 1000 kbits/s | |||
| AutoRun | — | 0: Disabled (Factory Default), 1: Enabled | 0 |
| TermResistor | — | 0: Disabled (Factory Default), 1: Enabled | 0 |
| Heartbeat | Unsigned 16-bit | 0–65535 ms | — |
| TPDO1on | — | 0: Disabled (Factory Default), 1: Enabled | 0 |
| Period1 | Unsigned 16-bit | 0–65535 ms | 0 |
| TPDO2on | — | 0: Disabled (Factory Default), 1: Enabled | 0 |
| Period2 | Unsigned 16-bit | 0–65535 ms | 0 |
| TPDO3on | — | 0: Disabled (Factory Default), 1: Enabled | 0 |
| Period3 | Unsigned 16-bit | 0–65535 ms | 0 |
RSCF — RS232 Configuration
Defines the operating parameters for the RS232 interface.
Set Syntax: !RSCF,Baudrate,Inverted
Get Syntax: ?RSCF
Reply: ?RSCF,Baudrate,Inverted
| Parameter | Options | Default |
|---|---|---|
| Baudrate | 0: 9600 | 4 (115200) |
| 1: 19200 | ||
| 2: 38400 | ||
| 3: 57600 | ||
| 4: 115200 (Factory Default) | ||
| Inverted | 0: Not inverted (Factory Default) | 0 |
| 1: Inverted |
SNCF — Sensor Configuration
Selects whether the tracking tape has North or South polarity on the top surface. Marker polarity is set automatically to the opposite of the selected track polarity.
Set Syntax: !SNCF,Polarity,TrackTh,MarkerTh
Get Syntax: ?SNCF
Reply: ?SNCF,Polarity,TrackTh,MarkerTh
| Parameter | Type | Range | Default |
|---|---|---|---|
| Polarity | — | 0: North on Top (Factory Default), 1: South on Top | 0 |
| TrackThreshold | Unsigned 8-bit | 0–100 % | 50 |
| MarkerThreshold | Unsigned 16-bit | 0–65535 µTesla | 600 |