Skip to content

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)

CommandDescription
RSETReset to Factory Defaults
STSTPerform Self-Test
ZEROCalibrate Zero Level

Data Requests (? Get Only)

CommandDescription
FWVRFirmware Version
HWVRHardware Version
NVCDNavicode
RSENInternal Sensor Values (Calibrated)
SALLRead All Sensor Data
SNIDSensor Serial Number
STRSSelf-Test Results

Configuration Commands (! Set and ? Get)

CommandDescription
CMCFCommunication Mode
CNCFCAN Configuration
RSCFRS232 Configuration
SNCFSensor 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

ParameterTypeFormat
RevisionUnsigned 32-bit010203 = v1.2.3
DateUnsigned 32-bitYYYYMMDD
FirmwareHashUnsigned 32-bit

HWVR — Read Hardware Version

Reads the Hardware Version code.

Syntax: ?HWVR

Reply: ?HWVR,Version

ParameterType
VersionUnsigned 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

ParameterTypeRange
NaviCodeUnsigned 16-bit0–65535
CountUnsigned 8-bit0–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

ParameterTypeUnitsRange
Value(n)Signed 16-bitmilliTeslas±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

#FieldDescriptionTypeUnitsRange
1TDetTrack Detect / Strength4-bit0–3
2LTPosLeft Track PositionSigned 8-bitMillimeters±80
3RTPosRight Track PositionSigned 8-bitMillimeters±80
4LTAngLeft Track AngleSigned 8-bitDegrees±90
5RTAngRight Track AngleSigned 8-bitDegrees±90
6LMLeft Marker Detectbool0–1
7RMRight Marker Detectbool0–1
8LMPosLeft Marker PositionSigned 8-bitMillimeters±80
9RMPosRight Marker PositionSigned 8-bitMillimeters±80
10CountFrame CounterUnsigned 8-bit0–255

SNID — Read Sensor Serial Number

Reads the sensor's unique hardware identification number.

Syntax: ?SNID

Reply: ?SNID,SerialNum

ParameterType
SerialNumUnsigned 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

ParameterTypeRange
ResultUnsigned 8-bit0 = Pass, 1 = Fail
MinMagDeltaUnsigned 8-bit
MaxMagDeltaUnsigned 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

ParameterOptions
Mode0: 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

ParameterTypeRange / OptionsDefault
NodeIdUnsigned 8-bit1–1271
Bitrate125000: 125 kbits/s250000
250000: 250 kbits/s (Factory Default)
500000: 500 kbits/s
1000000: 1000 kbits/s
AutoRun0: Disabled (Factory Default), 1: Enabled0
TermResistor0: Disabled (Factory Default), 1: Enabled0
HeartbeatUnsigned 16-bit0–65535 ms
TPDO1on0: Disabled (Factory Default), 1: Enabled0
Period1Unsigned 16-bit0–65535 ms0
TPDO2on0: Disabled (Factory Default), 1: Enabled0
Period2Unsigned 16-bit0–65535 ms0
TPDO3on0: Disabled (Factory Default), 1: Enabled0
Period3Unsigned 16-bit0–65535 ms0

RSCF — RS232 Configuration

Defines the operating parameters for the RS232 interface.

Set Syntax: !RSCF,Baudrate,Inverted

Get Syntax: ?RSCF

Reply: ?RSCF,Baudrate,Inverted

ParameterOptionsDefault
Baudrate0: 96004 (115200)
1: 19200
2: 38400
3: 57600
4: 115200 (Factory Default)
Inverted0: 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

ParameterTypeRangeDefault
Polarity0: North on Top (Factory Default), 1: South on Top0
TrackThresholdUnsigned 8-bit0–100 %50
MarkerThresholdUnsigned 16-bit0–65535 µTesla600