PNI 12810 Скачать руководство пользователя страница 68

 

PNI Sensor Corporation 

DOC#1014688 r09.2 

TCM User Manual 

Page 63 

 

kBaudRate,   

 

// 14 - UInt8 

 

kMilOutPut,  

 

// 15 - type Boolean 

 

kDataCal 

 

 

// 16 - type Boolean 

 

kMagCoeffSet = 18, 

// 18 - type UInt32 

 

kAccelCoeffSet,  // 19 - type UInt32 

 
 

// Mounting Reference IDs 

 

kMountedStandard = 1,  // 1 

 

kMountedXUp, 

 

// 2 

 

kMountedYUp, 

 

// 3 

 

kMountedStdPlus90, 

// 4 

 

kMountedStdPlus180, 

// 5 

 

kMountedStdPlus270, 

// 6 

 

kMountedZDown 

 

// 7 

 

kMountedXUpPlus90 

 

// 8 

 

kMountedXUpPlus180 

// 9 

 

kMountedXUpPlus270 

// 10 

 

kMountedYUpPlus90 

 

// 11 

 

kMountedYUpPlus180 

// 12 

 

kMountedYUpPlus270 

// 13 

 

kMountedZDownPlus90 

// 14 

 

kMountedZDownPlus180 

// 15 

 

kMountedZDownPlus270 

// 16 

 
 
 

// Result IDs 

 

kErrNone = 0, 

 

// 0  

 

kErrSave,   

 

// 1 

}; 
 
 
// function to calculate CRC -16 
UInt16 CRC(void * data, UInt32 len) 

 

UInt8 * dataPtr = (UInt8 *)data; 

 

UInt32 index = 0; 

 

// Update the CRC for transmitted and received data using  

 

// the CCITT 16bit algorithm (X^16 + X^12 + X^5 + 1).  

 

UInt16 crc = 0; 

 

while(len--) 

 

 

 

crc = (unsigned char)(crc >> 8) | (crc << 8);  

 

 

crc ^= dataPtr[index++]; 

 

 

crc ^= (unsigned char)(crc & 0xff) >> 4;  

 

 

crc ^= (crc << 8) << 4; 

 

 

crc ^= ((crc & 0xff) << 4) << 1; 

 

 

return crc; 

Содержание 12810

Страница 1: ...User Manual TCM High Performance Tilt Compensated Compass Module ...

Страница 2: ...3 2 Mounting Orientation 11 5 USER CALIBRATION 12 5 1 Magnetic Calibration 13 5 1 1 Full Range Calibration 15 5 1 2 2D Calibration 16 5 1 3 Limited Tilt Range Calibration 17 5 1 4 Hard Iron Only Calibration 18 5 2 Accelerometer Calibration 18 5 2 1 Accelerometer Only Calibration 19 5 2 2 Mag and Accel Calibration 20 6 OPERATION WITH TCM STUDIO 21 6 1 Installation 21 6 2 Connection Tab 22 6 2 1 Ini...

Страница 3: ...oResp frame ID 2d 40 7 3 3 kSetDataComponents frame ID 3d 41 7 3 4 kGetData frame ID 4d 42 7 3 5 kGetDataResp frame ID 5d 42 7 3 6 kSetConfig frame ID 6d 43 7 3 7 kGetConfig frame ID 7d 47 7 3 8 kGetConfigResp frame ID 8d 47 7 3 9 kSave frame ID 9d 48 7 3 10 kStartCal frame ID 10d 48 7 3 11 kStopCal frame ID 11d 50 7 3 12 kSetFIRFilters frame ID 12d 50 7 3 13 kGetFIRFilters frame ID 13d 52 7 3 14 ...

Страница 4: ...29 d 56 7 3 30 kFactoryMagCoeffDone frame ID 30 d 56 7 3 31 kTakeUserCalSample frame ID 31d 57 7 3 32 kFactoryAccelCoeff frame ID 36 d 57 7 3 33 kFactoryAccelCoeffDone frame ID 37 d 57 7 3 34 kSetSyncMode frame ID 46 d 57 7 3 35 kSetSyncModeResp frame ID 47 d 58 7 3 36 kSyncRead frame ID 49 d 58 7 4 Using Multiple Coefficient Sets 59 7 5 Code Examples 61 7 5 1 Header File CRC 16 Function 61 7 5 2 ...

Страница 5: ...ion Pattern 17 Table 5 5 6 Point Hard Iron Only Calibration Pattern 18 Table 6 1 Mounting Orientations 24 Table 7 1 UART Configuration 36 Table 7 2 TCM Command Set 39 Table 7 3 Component Identifiers 41 Table 7 4 Configuration Identifiers 44 Table 7 5 Sample Points 45 Table 7 6 Recommended FIR Filter Tap Values 51 Table 7 7 Multiple Coefficient Command List 59 List of Figures Figure 3 1 TCM XB Mech...

Страница 6: ...If any Product furnished hereunder fails to conform to the above warranty OEM s sole and exclusive remedy and PNI s sole and exclusive liability will be at PNI s option to repair replace or credit OEM s account with an amount equal to the price paid for any such Product which fails during the applicable warranty period provided that i OEM promptly notifies PNI in writing that such Product is defec...

Страница 7: ... and Limited Tilt Calibration when tilt is constrained to 45 but 5 of tilt is possible PNI also recognizes conditions may change over time and to maintain superior heading accuracy it may be necessary to recalibrate the compass So the TCM incorporates Hard Iron Only Calibration to easily account for gradual changes in the local magnetic distorting components Plus the accelerometer can be periodica...

Страница 8: ...y 0 05 rms Attitude Range Pitch 90 Roll 180 Accuracy Pitch 0 2 rms Roll 65 of pitch 0 2 rms 80 of pitch 0 4 rms 86 of pitch 1 0 rms Resolution 0 01 Repeatability 0 05 rms Maximum Operational Dip Angle3 85 Magnetometers Calibrated Field Range 125 µT Resolution 0 05 µT Repeatability 0 1 µT Footnotes 1 Specifications are subject to change Assumes the TCM is motionless and the local magnetic field is ...

Страница 9: ...e TCM XB 3 8 to 9 VDC TCM MB 3 3 to 9 VDC Communication Lines TCM XB High Level Input 2 4 V minimum Low Level Input 0 6 V maximum Output Voltage Swing 5 2 V typ 5 0 V min Tx Output Resistance 300 Ω TCM MB High Level Input 2 0 V minimum Low Level Input 0 8 V maximum Output Voltage Swing 0 3 3 V typical Tx Output Resistance 330 Ω Average Current Draw TCM XB max sample rate 20 mA typical 8 Hz sample ...

Страница 10: ...dependent on the strength of the magnetic field and typically will be from 25 to 32 samples sec 2 FIR taps set to 0 Table 3 5 Environmental Requirements Parameter Value Operating Temperature1 40C to 85C Storage Temperature 40C to 85C Footnote 1 To meet performance specifications across this range recalibration will be necessary as the temperature varies Table 3 6 Mechanical Characteristics Paramet...

Страница 11: ...1014688 r09 2 TCM User Manual Page 6 3 2 Mechanical Drawings The default orientation is for the silk screened arrow to point in the forward direction Figure 3 1 TCM XB Mechanical Drawing Figure 3 2 TCM XB Pigtailed Cable Drawing ...

Страница 12: ...PNI Sensor Corporation DOC 1014688 r09 2 TCM User Manual Page 7 The default orientation is for the silk screened arrow to point in the forward direction Figure 3 3 TCM MB Mechanical Drawing ...

Страница 13: ...00 or equivalent The TCM MB incorporates a 4 pin Mil Max connector part number 850 10 004 10 001000 which mates with Mill Max part 851 XX 004 10 001000 or equivalent The pin out is given below in Table 4 1 Table 4 1 TCM Pin Descriptions Pin Number1 TCM XB TCM MB 9 Pin Connector Cable Wire Color 4 Pin Connector 1 GND Black GND 2 GND Gray Vin 3 GND Green UART Tx 4 NC Orange UART Rx 5 NC Violet 6 NC ...

Страница 14: ...4 2 2 Locate away from changing magnetic fields It is not possible to calibrate for changing magnetic anomalies Thus for greatest accuracy keep the TCM away from sources of local magnetic distortion that will change with time such as electrical equipment that will be turned on and off or ferrous bodies that will move Make sure the TCM is not mounted close to cargo or payload areas that may be load...

Страница 15: ... and therefore also negatively affect heading accuracy 4 3 1 Pitch and Roll Conventions The TCM uses a MEMS accelerometer to measure the tilt angle of the compass This data is output as pitch and roll data and is also used in conjunction with the magnetometers to provide a tilt compensated heading reading The TCM utilizes Euler angles as the method for determining accurate orientation This method ...

Страница 16: ...igure 4 2 All reference points are based on the white silk screened arrow on the top side of the board The orientation should be programmed in the TCM using TCM Studio or the kSetConfig command The default orientation is STD 0 Note TCM XB is shown The Z axis sensor and the connector are on the module s top surface regardless of model Figure 4 2 Mounting Orientations ...

Страница 17: ... be recalibrated every 6 to 12 months Unlike a magnetic calibration the accelerometer may be calibrated outside the host system Accelerometer calibration is more sensitive to noise or hand jitter than magnetic calibration especially for subsequent use at high tilt angles Because of this ideally a stabilized fixture would be used for accelerometer calibration although resting the unit against a sta...

Страница 18: ...ot increase or decrease the total field in the area However the effect of the soft iron distortion changes as the host system s orientation changes Because of this it is more difficult to compensate for soft iron materials Temperature Effects While the hard iron and soft iron distortion of a system may remain quite stable over time normally the distortion signature will change over temperature As ...

Страница 19: ...er s host system To that end the TCM needs to be mounted within the host system and the entire host system needs to be moved as a single unit during a user calibration The TCM allows the user to perform a calibration only in a 2D plane or with limited tilt but provides the greatest accuracy if the user can rotate through 360 of heading and at least 45 of tilt The following subsections provide inst...

Страница 20: ...on is appropriate when the TCM can be tilted 45 or more This method compensates for hard and soft iron effects in three dimensions and allows for the highest accuracy readings The recommended 12 point calibration pattern is a series of 3 circles of evenly spaced points as illustrated in Figure 5 1 and listed in Table 5 2 The pitch used in the second and third circles of the calibration should at l...

Страница 21: ...45 30 to 40 12 330 45 30 to 40 Footnote 1 Yaw listings are not absolute heading directions but rather relative heading referenced to the first sample 5 1 2 2D Calibration A 2D Calibration is intended for very low tilt operation 5 where calibrating the TCM with greater tilt is not practical This procedure calibrates for hard and soft iron effects in only two dimensions and in general is effective f...

Страница 22: ...s restrained to a level plane in service then calibration should be in a plane where max positive and max negative are 0 5 1 3 Limited Tilt Range Calibration A Limited Tilt Range Calibration is recommended when 45 of tilt isn t feasible but 5 of tilt is possible It provides both hard iron and softiron distortion correction The recommended 12 point calibration pattern given below is a series of 3 c...

Страница 23: ... during use Table 5 5 6 Point Hard Iron Only Calibration Pattern Sample Yaw Pitch1 Roll1 1 0 max negative max negative 2 60 max positive max positive 3 120 max negative max negative 4 180 max positive max positive 5 240 max negative max negative 6 300 max positive max positive Footnote 1 For best results the tilt experienced during calibration should match that experienced in service For example i...

Страница 24: ...be calibrated while mounted in the host system or it may be removed and calibrated outside the system The advantage of performing the calibration while mounted in the host system is the user does not need to remove the TCM from the system which can be burdensome and a simultaneous Mag and Accel Calibration may be appropriate The advantage of performing the calibration outside of the system is it m...

Страница 25: ...NI recommends 18 to 32 calibration points for a Mag and Accel Calibration The Accelerometer Only Calibration pattern discussed in Section 5 2 will work for a Mag and Accel Calibration Optimal performance is obtained when all rotations of the TCM are performed towards magnetic north to achieve the widest possible magnetic field distribution Note that combining calibrations only makes sense if all t...

Страница 26: ...on of Studio is identified in the upper left corner of the GUI The TCM Studio evaluation software communicates with the TCM through the RS232 serial port of a computer The TCM MB requires a user supplied level shifter to make it compatible with the computer s RS232 interface 6 1 Installation TCM Studio is provided as an executable program which can be downloaded from PNI s website It will work wit...

Страница 27: ...tion is made the Connected light will turn green and the module s firmware version serial number and PCA version will be displayed in the header section 6 2 2 Changing Baud Rate To change the baud rate In the Module window select the new baud rate for the module Click the Power Down button The button will change to read Power Up In the Computer window select same baud rate for the computer Click t...

Страница 28: ...his will reestablish a connection assuming the module baud rate is unchanged 6 3 Configuration Tab Note No settings will be changed in the module until the SAVE button has been selected 6 3 1 Mounting Options TCM Studio supports 16 mounting orientations as illustrated previously in Figure 4 2 The descriptions in TCM Studio are slightly different from those shown in Figure 4 2 and the relationship ...

Страница 29: ...agnetic variation is the difference between true and magnetic north It is measured in degrees east or west of true north Correcting for declination is accomplished by storing the correct declination angle and then changing the heading reference from magnetic north to true north Declination angles vary throughout the world and change very slowly over time For the greatest possible accuracy go to th...

Страница 30: ...e initial sample reading and if Flush Filters is selected the rate at which data is output The default setting is 32 6 3 7 Acquisition Settings Mode When operating in Continuous Acquisition Mode the TCM continuously outputs data to the host system The rate is set by the Sample Delay When operating in Poll Mode TCM Studio simulates a host system and polls the TCM for a single measurement but TCM St...

Страница 31: ... set has been sent Note that the inverse of the Sample Delay is greater than the sample rate since the Sample Delay does not include the actual measurement acquisition time The default is 0 Flush Filters Flushing the FIR filter clears all the filter values so it is necessary to fully repopulate the filter before a good reading can be given For example if 32 FIR taps is set then 32 new samples must...

Страница 32: ...d iron distortion around the module has changed this calibration can bring the module back into specification The minimum recommended number of calibration points is 6 Limited Tilt Range Calibration recommended calibration method when 5 of tilt calibration is available but tilt is restricted to 45 i e Full Range Calibration is not possible The minimum recommended number of calibration points is 12...

Страница 33: ...nfiguration tab it is necessary to click the Take Sample button to take a calibration sample point This should be repeated until the total number of samples as set on the Configuration tab is taken while changing the orientation of the module between samples as discussed in Section 5 If Automatic Sampling is checked the module will need to be held steady for a short time and then a sample automati...

Страница 34: ...r other methods Note that it is possible to get acceptable scores for Dist Error and Tilt Error and still have a rather high Mag CalScore value The most likely reason for this is the TCM is close to a source of local magnetic distortion that is not fixed with respect to the module Dist Error Indicates the quality of the sample point distribution primarily looking for an even yaw distribution Signi...

Страница 35: ...ill occur when the Start button is clicked but no data will be taken 6 4 5 Clear Clear Mag Cal to Factory This button clears the user s calibration of the magnetometers Once selected the module reverts to its factory magnetometer calibration To save this action in nonvolatile memory click the Save button It is not necessary to clear the current calibration in order to perform a new calibration Cle...

Страница 36: ...odule Contrast Selecting this box sets the Current Readings window to have yellow lettering on a black background rather than black lettering on a white background 6 5 2 3D Model The helicopter will follow the movement of the TCM and give a visual representation of the module s orientation assuming the Enable 3D Model Display box is selected on the Configuration tab 6 5 3 Acquisition Settings Thes...

Страница 37: ...Mode check box to enter Sync Mode Sync Mode Output To retrieve the first reading click the Sync Read button Heading pitch and roll information will be displayed on Current Reading window If the Enable 3D Model Display box is selected on the Configuration tab then the helicopter will follow the movement as well The module will enter Sleep Mode after outputting the heading pitch and roll information...

Страница 38: ...he Data window Use Shift Click and Ctrl Click to select multiple items In the screen shot above Heading Pitch and Roll were selected Click the Go button to start logging The Go button changes to a Stop button after data logging begins Click the Stop button to stop logging data Click the Export button to save the data to a file Click the Clear button to clear the data from the window Note The data ...

Страница 39: ...fficients If with User Cal graph data is selected the plot and data provide data after applying the FIR filter and the user calibration coefficients The sample plot shows a 360 rotation in the horizontal plane with both w o User Cal and with User Cal selected The offset between these two plots represents the effect of the calibration coefficients The graph can be used to visually see hard and soft...

Страница 40: ... 8 System Log Tab The System Log tab shows all communication between TCM Studio and the TCM module since launching TCM Studio Closing TCM Studio will erase the system log Select the Export button at the bottom right of the screen to save the system log to a text file ...

Страница 41: ...RC 16 UInt16 Payload 1 4091 UInt8 Frame ID UInt8 Figure 7 1 Datagram Structure The ByteCount is the total number of bytes in the packet including the CRC 16 checksum CRC 16 is calculated starting from the ByteCount to the last byte of the Packet Frame The ByteCount and CRC 16 are always transmitted in big Endian Two examples follow Example The complete packet for the kGetModInfo command which has ...

Страница 42: ... ABCD EFGH little Endian DCBA HGFE Exponent S Mantissa 63 62 5251 0 The value v is determined as if and only if 0 Exponent 2047 then v 1 S 2 Exponent 1023 1 Mantissa 32 Bit Floating Point Float32 Shown below is the 32 bit float format in big Endian In little Endian format the 4 bytes are in reverse order with LSB first Exponent S Mantissa 3130 2322 0 The value v is determined as if and only if 0 E...

Страница 43: ...b 7 0 msb 15 8 Signed 8 Bit Integer SInt8 UInt8 based parameters are unsigned 8 bit numbers Bit 7 represents the sign of the value where 0 positive and 1 negative byte 7 0 Unsigned 32 Bit Integer UInt32 UInt32 based parameters are unsigned 32 bit numbers msb 31 24 23 16 15 8 lsb 7 0 Big Endian lsb 7 0 15 8 23 16 msb 31 24 Little Endian Unsigned 16 Bit Integer UInt16 UInt16 based parameters are uns...

Страница 44: ...or data 5 kGetDataResp Response to kGetData 6 kSetConfig Sets internal configurations in TCM 7 kGetConfig Queries TCM for the current internal configuration 8 kGetConfigResp Response to kGetConfig 9 kSave Saves the current internal configuration and any new user calibration coefficients to non volatile memory 10 kStartCal Commands the TCM to start user calibration 11 kStopCal Commands the TCM to s...

Страница 45: ...icients to original factory established values 30 kFactoryMagCoeffDone Response to kFactoryMagCoeff 31 kTakeUserCalSample Commands the TCM to take a sample during user calibration 36 kFactoryIAccelCoeff Resets accelerometer calibration coefficients to original factory established values 37 kFactoryAccelCoeffDone Respond to kFactoryAccelCoeff 46 kSetSyncMode Sets whether the TCM is in normal or Syn...

Страница 46: ...uence of the data components defined by kSetDataComponents will match the output sequence of kGetDataResp Example To query for heading and pitch the payload should contain When querying for data kGetData frame the sequence of the data component output follows the sequence of the data component IDs as set in this frame Table 7 3 Component Identifiers Component Component IDd Format Units kHeading 5 ...

Страница 47: ...elZ Component IDs 21d 22d 23d These values represent the accelerometer sensor data for the x y and z axis respectively The values are normalized to g Earth s gravitational force kMagX kMagY kMagZ Component IDs 27d 28d 29d These values represent the magnetic sensor data for the x y and z axis respectively The values are given in µT 7 3 4 kGetData frame ID 4d If the TCM is configured to operate in P...

Страница 48: ...e first byte of the payload is the configuration ID followed by a format specific value These configurations can only be set one at time To save these in non volatile memory the kSave command must be issued Example To configure the declination the payload would look like 2 Heading ID ID Count Payload Heading Float32 Pitch ID Pitch Output Float32 5 359 9 24 10 5 Config ID ID Specific Value UInt8 Pa...

Страница 49: ... X UP 90 9 X UP 180 10 X UP 270 11 Y UP 90 12 Y UP 180 13 Y UP 270 14 Z DOWN 90 15 Z DOWN 180 16 Z DOWN 270 1 kUserCalNumPoints 12 UInt32 4 32 12 kUserCalAutoSampling 13 Boolean True or False True kBaudRate 14 UInt8 0 300 1 600 2 1200 3 1800 4 2400 5 3600 6 4800 7 7200 8 9600 9 14400 10 19200 11 28800 12 38400 13 57600 14 115200 12 kMilOutput 15 Boolean True or False False kHPRDuringCal 16 Boolean...

Страница 50: ...libration Table 7 5 provides the Minimum Recommended number of sample points as well as the full Allowable Range The Minimum Recommended number of samples normally is sufficient to meet the TCM s heading accuracy specification while less than this may make it difficult to meet specification See Section 5 for additional information Table 7 5 Sample Points Calibration Mode Number of Samples Allowabl...

Страница 51: ...ferent coefficient sets can be used for storing coefficients for varying conditions such as when a door is open or closed near the sensor or when the temperature varies since the magnetic signature of the host system may change over temperature Also if the existing coefficients are acceptable but not great and you want to recalibrate you should recalibrate to a different set number so you can retr...

Страница 52: ... values but not lose the current set The initial default is set 0 To store a new set of coefficients first establish the set number 0 to 2 using kAccelCoeffSet then perform an accelerometer calibration The new coefficient values will be stored in volatile memory in the defined set number and will be implemented immediately Save the coefficient set to non volatile memory by sending kSave When the T...

Страница 53: ...oefficients will be will be stored in volatile memory and immediately applied Save this coefficient set to non volatile memory by sending kSave If you do not want to use this new coefficient set either reboot the TCM which will restore the prior coefficients switch to a different coefficient set or reload the factory coefficients On powering up the last saved calibration coefficients will be loade...

Страница 54: ...n magnetic and accelerometer calibration will be done simultaneously Below is a complete sample packet to start a 2D Calibration kStartCal Heading pitch and roll information is output via the kGetDataResp frame during the calibration process This feature provides guidance during the calibration regarding calibration sample point coverage During calibration in the kGetDataResp frame the number of d...

Страница 55: ...tion coefficients to non volatile memory send the kSave command 7 3 11 kStopCal frame ID 11d This command aborts the calibration process Assuming the minimum number of sample points for the calibration as defined in Table 7 5 is not acquired prior to sending kStopCal the prior calibration results are retained If the acquired number of sample points prior to sending kStopCal is within the allowable...

Страница 56: ...2 07 9724971069144e 3 01 4823725958818e 3 2 04 5329134234467e 1 06 4500864832660e 2 01 2710056429342e 2 02 0737124095482e 3 3 04 5329134234467e 1 01 6637325898141e 1 02 5971390034516e 2 03 2757326624196e 3 4 04 6708657655334e 2 02 4925036373620e 1 04 6451949792704e 2 05 3097803863757e 3 5 02 4925036373620e 1 07 1024151197772e 2 08 3414139286254e 3 6 01 6637325898141e 1 09 5354386848804e 2 01 24568...

Страница 57: ...ter settings for the sensors Byte 1 should be set to 3 and Byte 2 should be set to 1 7 3 14 kGetFIRFiltersResp frame ID 14d This is the response to kGetFIRFilters and it has the same payload definition as kSetFIRFilters 7 3 15 kPowerDown frame ID 15d This frame is used to power down the module which puts the module in Sleep Mode The frame has no payload The command will power down all peripherals ...

Страница 58: ...iding quality indicator of the magnetometer calibration Acceptable scores will be 1 for Full Range Calibration 2 for other methods Note that it is possible to get acceptable scores for DistError and TiltError and still have a rather high MagCalScore value The most likely reason for this is the TCM is close to a source of local magnetic distortion that is not fixed with respect to the device In the...

Страница 59: ...to 20º and rolled 25º to 15º the TiltRange value would be 20º which represents half the roll range For Full Range Calibration and Hard Iron Only Calibration this should be 45 For 2D Calibration ideally this should be 2 For Limited Tilt Range Calibration the value should be as large a possible given the user s constraints In the event of an aborted calibration the score will be 179 8d or in the eve...

Страница 60: ...in the FIR filter being flushed cleared after every measurement The default is FALSE Flushing the filter clears all tap values thus purging old data This can be useful if a significant change in heading has occurred since the last reading as the old heading data would be in the filter Once the taps are cleared it is necessary to fully repopulate the filter before data is output For example if 32 F...

Страница 61: ...mpleDelay does not include actual acquisition time 7 3 25 kGetAcqParams frame ID 25d This frame queries the unit for the acquisition parameters The frame has no payload 7 3 26 kSetAcqParamsDone frame ID 26d This frame is the response to kSetAcqParams frame The frame has no payload 7 3 27 kGetAcqParamsResp frame ID 27d This frame is the response to kGetAcqParams frame The payload has the same struc...

Страница 62: ...e One application of this is to reduce power consumption Another use of the Sync Mode is to trigger a reading during an interval when local magnetic sources are well understood For instance if a system has considerable magnetic noise due to nearby motors the Synch Mode can be used to take measurements when the motors are turned off Note When Sync Mode is selected the TCM will acknowledge the chang...

Страница 63: ...aps 7 3 35 kSetSyncModeResp frame ID 47 d This frame is the response to kSetSyncMode frame The payload contains the Mode ID requested Mode ID UInt8 Payload 7 3 36 kSyncRead frame ID 49 d If the TCM is configured to operate in Sync Mode as defined by kSetSyncMode then this frame wakes up the module requests a measurement outputs the results then powers down again This frame has no payload The respo...

Страница 64: ...7 Set kCoeffCopySet to be copy 1 0x00 0x0A 0x06 0x12 0x00 0x00 0x00 0x01 0x2E 0x57 0x00 0x05 0x13 0xDD 0xA8 Set kCoeffCopySet to be copy 4 0x00 0x0A 0x06 0x12 0x00 0x00 0x00 0x04 0x7E 0xF2 0x00 0x05 0x13 0xDD 0xA9 kGetConfig frame ID kCoeffCopySet config ID Value UInt32 Examples Command Bytes TCM Response 0x07 0x12 get kCoeffCopySet value which is currently used in TCM 0x00 0x06 0x07 0x12 0x19 0x4...

Страница 65: ...ng the following command Optional 0x00 0x06 0x07 0x12 0x19 0x44 Send kSave command to save the kCoeffCopySet to flash so that it will be still available after power cycle The kSave command is as following 0x00 0x05 0x09 0x6E 0xDC Start a user calibration when completes save calibration coeffs to TCM The coeffs have been saved into coeff set copy 4 Example 2 Use Magnetic Coeff Copy Set 1 in TCM The...

Страница 66: ...mple with the TickGenerator h the user needs to write a routing that generates 10 msec ticks 7 5 1 Header File CRC 16 Function type declarations typedef struct UInt8 AcquisitionMode FlushFilter Float32 AcquireDelay SampleDelay __attribute__ packed AcqParams typedef struct Float32 MagCalScore Float32 reserve1 Float32 AccelCalScore Float32 DistError Float32 TiltError Float32 TiltRange __attribute__ ...

Страница 67: ...30 type Float32 kLimitedTiltCal 40 40 type Float32 kAccelCalOnly 100 100 type Float32 kAccelCalwithMag 110 110 type Float32 Param IDs kSetDataComponents 3 3 AxisID UInt8 Count UInt8 Value Float64 Data Component IDs kHeading 5 5 type Float32 kTemperature 7 7 type Float32 kDistortion 8 type boolean kAccelX 21 21 type Float32 kAccelY 22 type Float32 kAccelZ 23 type Float32 kPitch 24 type Float32 kRol...

Страница 68: ...Plus90 8 kMountedXUpPlus180 9 kMountedXUpPlus270 10 kMountedYUpPlus90 11 kMountedYUpPlus180 12 kMountedYUpPlus270 13 kMountedZDownPlus90 14 kMountedZDownPlus180 15 kMountedZDownPlus270 16 Result IDs kErrNone 0 0 kErrSave 1 function to calculate CRC 16 UInt16 CRC void data UInt32 len UInt8 dataPtr UInt8 data UInt32 index 0 Update the CRC for transmitted and received data using the CCITT 16bit algor...

Страница 69: ...mmProtocol handles the actual serial communication with the module Process is a base class that provides CommProtocol with cooperative parallel processing The Control method will be called by a process manager on a continuous basis class CommProtocol public Process public enum Frame IDs Commands kGetModInfo 1 kGetModInfoResp 2 kSetDataComponents 3 kGetData 4 kGetDataResp 5 Data Component IDs kHead...

Страница 70: ...cting the hardware implementation CommProtocol CommHandler handler NULL SerPort serPort NULL void Init UInt32 baud 38400 void SendData UInt8 frame void dataPtr NULL UInt32 len 0 void SetBaud UInt32 baud protected CommHandler mHandler SerPort mSerialPort UInt8 mOutData kBufferSize mInData kBufferSize UInt16 mExpectedLen UInt32 mOutLen mOldInLen mTime mStep UInt16 CRC void data UInt32 len void Contr...

Страница 71: ...otocol mHandler handler store the object that will parse the data when it is fully received mSerialPort serPort Init Initialize the serial port and variables that will control this process void CommProtocol Init UInt32 baud SetBaud baud mOldInLen 0 no data previously received mStep 1 goto the first step of our process Put together the frame to send to the module void CommProtocol SendData UInt8 fr...

Страница 72: ... while len mOutData index data compute and add the crc crc CRC mOutData index mOutData index crc 8 mOutData index crc 0xFF Write block will copy and send the data out the serial port mSerialPort WriteBlock mOutData index Call the functions in serial port necessary to change the baud rate void CommProtocol SetBaud UInt32 baud mSerialPort SetBaudRate baud mSerialPort InClear clear any data that was ...

Страница 73: ...tch mStep case 1 wait for length bytes to be received by the serial object if inLen 2 Read block will return the number of requested or available bytes that are in the serial objects input buffer read the byte count mSerialPort ReadBlock mInData 2 byte count is ALWAYS transmitted in big endian copy byte count to mExpectedLen to native endianess mExpectedLen mInData 0 8 mInData 1 Ticks is a timer f...

Страница 74: ... mExpectedLen 1 if crc crcReceived the crc is correct so pass the frame up for processing if mHandler mHandler HandleComm mInData 2 mInData 3 mExpectedLen kPacketMinSize else crc s don t match so clear everything that is currently in the input buffer since the data is not reliable mSerialPort InClear go back to looking for the length bytes mStep 1 else Ticks is a timer function 1 tick 10msec if Ti...

Страница 75: ... received Process is a base class that provides TCM with cooperative parallel processing The Control method will be called by a process manager on a continuous basis class TCM public Process public CommHandler public TCM SerPort serPort TCM protected CommProtocol mComm UInt32 mStep mTime mResponseTime void HandleComm UInt8 frameType void dataPtr NULL UInt16 dataLen 0 void SendComm UInt8 frameType ...

Страница 76: ...ommProtocol know this object will handle any serial data returned by the module mComm new CommProtocol this serPort mTime 0 mStep 1 TCM TCM Called by the CommProtocol object when a frame is completel y received void TCM HandleComm UInt8 frameType void dataPtr UInt16 dataLen UInt8 data UInt8 dataPtr switch frameType case CommProtocol kGetDataResp Parse the data response UInt8 count data 0 The numbe...

Страница 77: ...size bytes Move copies the specified number of bytes from the source pointer to the destination pointer Store the heading Move data pntr heading sizeof heading increase the pointer to point to the next data element type pntr sizeof heading break case CommProtocol kPitch Move source destination size bytes Move copies the specified number of bytes from the source pointer to the destination pointer S...

Страница 78: ...next data element type pntr sizeof temperature break default Message is a function that displays a formatted string similar to printf Message Unknown type 02X r n data pntr 1 unknown data type so size is unknown so skip everything return break count One less element to read in Message is a function that displays a formatted string similar to printf Message Heading f Pitch f Roll f Temperature f r ...

Страница 79: ...rn to execute void TCM Control switch mStep case 1 UInt8 pkt kDataCount 1 the compents we are requesting preceded by the number of components being requested pkt 0 kDataCount pkt 1 CommProtocol kHeading pkt 2 CommProtocol kPitch pkt 3 CommProtocol kRoll pkt 4 CommProtocol kTemperature SendComm CommProtocol kSetDataComponents pkt kDataCount 1 Ticks is a timer function 1 tick 10msec mTime Ticks 100 ...

Страница 80: ...M User Manual Page 75 mTime Ticks 100 take a sample every second mStep break case 3 Ticks is a timer function 1 tick 10msec if Ticks mResponseTime Message No response from the module Check connection and try again r n mStep 0 break default break ...

Страница 81: ...tive Date Approval R08 Added Revision Control Block Corrected Section 7 3 3 example to indicate Pitch ID is 24 not 79 Mar 18 2014 A Leuzinger R09 Added in section on using Multiple Calibration Coefficient January 21 2015 D McKenzie R09 1 R09 2 AcquisitionMode in 7 3 24 default value 0 indicating Poll Mode May 14 2018 B Zhang ...

Отзывы: