|Documentation :||Hardware | Software | Tutorials||Wardrobe :||Jackets | Applications|
|Papers :||Notes | Proposals | Research||Administration :||Stock | Minutes | Progress|
The PNI Vector 2X is used in conjunction with the location system to provide heading data. It is used in Master mode sending two bytes to the PIC. These are then passed on to the RS232 output port along with the location data.
(Click here for full circuit diagram integrating Pinger Rx, Ultrasonics and Compass and 4 transducer PIC code too).
Two magnetometers are used to measure the magnetic field strengths in the X-Y plane of the circuit board. Once it has been calibrated to remove the effects of local static magnetic fields, it is able to determine heading with an accuracy of a few degrees and a resolution of one degree. Accuracy deteriorates rapidly if the board is not level.
The compass is calibrated by:
closing the switch on P5;
pressing the switch on P6 (the red led on P13 illuminates);
turning the board through 180deg, and pressing the switch on P6 again (the red led extinguishes); and
opening the switch on P5 returning the board to it's normal mode in which it outputs data on P2 (the green led on P12 flashes).
The switches on P10 and P11 invert the signal from the two magnetometers allowing the unit to be used upside down(!). P10 is normally closed.
The data is normally output as two bytes which can be read from P2. The clock frequency tends to be slightly erratic (why?!), so it is useful to synchronise reading the data with the clock signal. Consistent results are then obtained.
; PULSE waits for -ve pulse, then returns on +ve edge
BTFSC A_PORT,SCLK ; Test
GOTO EDGE_P ; Clock is still high so loop until pulse (low) is seen.
BTFSS A_PORT,SCLK ; Now wait
for +ve edge
GOTO EDGE_M ; Clock is still low
; reads and stores the two bytes of compass data
;-------v2.0 uses clock signal into RXD4 for timing data
; Load seven clock pulses
CLRF DIR1 ; Clear Direction byte 1
MOVLW b'00000001' ; Bit 0 is shifted with data and flags 8 rx'd.
MOVWF DIR2 ; Initialise Direction byte 2
; Read 7 pulses
BTFSC A_PORT,SO ; +ve edge so now receive data
BSF DIR1,0 ; Set Serial bit 0 - data was high i.e. a '1'
; Now get the second byte
RLF DIR2,1 ; Shift data left to make way for next bit
BCF DIR2,0 ; Clear Serial bit 0
BTFSC A_PORT,SO ; Test receive data
BSF DIR2,0 ; Set Serial bit 7 - data was high i.e. a '1'
BNC HDG_RD ; Loop until the 'carry' bit appears
; Received character is in DIR2, now dump the stop bit
WAITEM ; Dump stop bit ???
RETURN ; Exit from RXHEADG