Sensor Register Layout
Address Type Contents 00 – 07H chars Sensor version number 08 – 0FH chars Manufacturer 10 – 17H chars Sensor type 18 – 3DH bytes Not used 3E, 3FH chars Reserved 40H byte Not used 41H byte Mode control 42H byte Heading } two degree heading 43H byte Heading } one degree adder 44, 45H word Heading (low byte, high byte) 46 – 7FH bytes Not used
The Sensor version number field will report a revision number in the format “²Vn.m” where n is the major version number and m is the revision level. Revision numbers will typically reflect the firmware level. The version number will be used to indicate the hardware level. The Manufacturer field will contain “HiTechnc”. The Sensor type field will contain “Compass”. The Mode control field may be set to 0x00 or 0x43 to define measurement mode or hard-iron calibrate mode. The Heading fields will return the currently measured heading during measurement mode operation. During hard-iron calibrate mode operation, this field will jam. The heading is obtained by reading location 0x42 to obtain the two degree heading and 0x43 to obtain the one degree adder. The heading can then be computed as Heading = (two degree heading *2) + one degree adder. If the sign is a problem, then the conventional 16 bit value can be obtained from 0x44 (low byte) and 0x45 (high byte).
Locn 0x41 is the mode control. Defaults to 0, which is measurement mode. Change to 0x43 to set calibration mode. Must be changed back to 0 when calibration is completed. (If cal. fails, locn. 0x41 will be set to 2 after the host has set it to 0 at the end of the failed calibrate attempt.)
Other Programming Environments RobotC All features of the HiTechnic Compass can be accessed using RobotC. For more information go to http://www-education.rec.ri.cmu.edu/robotc/.
NBC Next Byte Code (NBC) is a simple programming language that can access all compass features. For more information go to http://bricxcc.sourceforge.net/nbc/.
Notes:
|