Download Print this page

Garmin LIDAR-Lite v1 Silver Label Operating Manual page 33

Advertisement

Downloading a Correlation Record 
 
The following details simplified C­code routine to download three types of records stored in the system 
memory.  The first selection is a memory bank where the last correlation template pattern is stored. The last 
received signal record stored is in bank 2 while bank 3 stores the full correlation record.  See detailed 
descriptions of the accessed control registers in Appendix A for a detailed explanation of their function. 
 
Note:​   Only external registers are accessed using this command and the correlation processor cannot be in 
a sleep state. 
 
Sample C Code ­ Download Correlation Data to a Serial Port Using Put 
 
This pseudo code can be used as a basis for the download of correlation data for analysis. 
  
bank_num – memory banks in the correlation processor 
1: template memory 
2: last signal record 
3: correlation record 
  
Function ­ write_twi (register address (hex), value); 
Function ­ read_twi (register address (hex), number of bytes) 
Elements – number of words to be transferred 
read_val is 16 bit integer 
  
if (bank_num == 3){ 
    write_twi (0x51, 0x10);  //  points to the base of the correlation record address 
    write_twi (0x53, (char) (bank_num <<6)); 
// selects memory bank
 
    write_twi (0x40, 0x06);   //sets test mode select 
    For (i=0; i<elements; i++) { 
        read_val = (unsigned char) read_twi (0x52, 1); // added to select single byte 
        if (read_twi (0x5d, 1)) read_val |= 0xff00; // if upper byte lsb is set, the value is negative 
        put_dec (read_val); 
        T0_Wait_ms (1); //hold longer than the transfer time for the serial transfer. 
   } 
   write_twi (0x40, 0x00); // return to normal control – null command to control register 
 
 
 
 
LIDAR­Lite v1 "Silver Label" Manual​ ,  Updated: 08/13/15  

Advertisement

loading