Data Sheet

MicroBasic Scripting
MGSWxxxx Magnetic Sensor Datasheet 12
FIGURE 14. MagSensor Control Utility
MicroBasic Scripting
The MGSW1600 features the ability for the user to write programs that are permanently saved into, and run from
the sensors Flash Memory. This capability is the equivalent of combining the functionality of a PLC or Single Board
Computer, directly into the sensor. The language is a very simple, yet powerful one that resembles Basic. Scripts
can be simple or elaborate, and can be used for various purposes. For example, sensor data manipulation and con-
version, two dimension marker processing, or even the full motion and steering control for a simple line follow-
ing robot. See the Microbasic manual for details on the language.
Sensor Zero Calibration
The sensor is factory calibrated to compensate for the natural ambient magnetic field. For best results, the ambi-
ent “zero” must be reset in every new installation. This is done by clicking on the “Calibrate Zero” button on the
Setup tab of the PC utility. Make sure that the sensor is away from any magnetic material when doing the zero
calibration. Zero Calibration can also be initiated by sending the %ZERO maintenance command followed by
%EESAV for storing the new calibration permanently in Flash.
When the calibration takes place, an integrity test is executed in order to detect if any of the internal sensors
has failed. If the test detects an error, a respective message is printed, the LEDs flash and bit 8 in the Sensors
Status byte (accessible using the MGS query) is set. If this happens make sure the sensor is not close to any
magnetic field and retry sensor calibration. If the problem remains, then most probably the sensor is damaged.