3-Axis Accelerometer (LIS302DL)


Closed Thread
Results 1 to 21 of 21

Hybrid View

  1. #1
    Join Date
    Dec 2007
    Location
    Finland
    Posts
    191


    Did you find this post helpful? Yes | No

    Default Re: 3-Axis Accelerometer (LIS302DL)

    Hi Haim,

    It is OK to put IC vertically and reset acceration/tilt values (HP_FILTER_RESET (23h)).
    You have to configure certain parameters if you want to use interrupt. Here are couple of examples from working piece of codes:

    Code to init accelerometer:
    Code:
    Accelerometer_Init:
    
        'Axes
        I2CAddress_3D = $20     'CTRL_REG1
        TEMP = %01000111        'DR=0, PD=1, FS=0, STP=00, Zen=1, Yen=1, Xen=1 (X,Y,Z enable, Output 100Hz)
        gosub I2C_Write_3D      
        '---------------------
        
        'Filters
        I2CAddress_3D = $21     'CTRL_REG2
        TEMP = %00000111        'SIM = 0, BOOT = 0, --,  FDS = 0, HP FF_WU2 = 0, HP FF_WU1 = 1, HP coeff2 = 1, HP coeff1 = 1 (HP 0.25Hz for FF_WU1)
        gosub I2C_Write_3D
        
        '---------------------
        
        'Interrupts
        I2CAddress_3D = $22     'CTRL_REG3
        TEMP = %00000001        'IHL = 0, PP_OD = 0, I2CFG2-0 = 000, I1CFG2-0 = 001 (FF_WU 1 = INT1)
        gosub I2C_Write_3D
        
        '---------------------
        
        'Sensitivity
        I2CAddress_3D = $32     'FF_WU_THS_1
        TEMP = $02              'DCRM = 0, THS6 = 0, THS5 = 0, THS4 = 0, THS3 = 0, THS2 = 0, THS1 = 1, THS0 = 0 (~36mg wake-up threshold, ~18mg step)
        gosub I2C_Write_3D      
        
        '---------------------
        
        'Duration
        I2CAddress_3D = $33     'FF_DURATION_1
        TEMP = $0D              'D7 = 0, D6 = 0, D5 = 0, D4 = 0, D3 = 1, D2 = 1, D1 = 0, D0 = 1 (130ms, 0 - 2.55s, 10ms step)
        gosub I2C_Write_3D      '0Ah = 100ms, 0Fh = 150ms, 14h = 200ms, 28h = 400ms, 32h = 500ms,
        
        '---------------------
        
        'Wake-Up Thresholds
        I2CAddress_3D = $30     'FF_WU_GFG_1
        TEMP = %01101010        'AOI = 0, LIR = 1, ZHIE = 1, ZLIE = 0, YHIE = 1, YLIE = 0, XHIE = 1, XLIE = 0 (wake-up above thresholde on x,y,z)
        gosub I2C_Write_3D
        
        '---------------------
    Code how to deal when INT will occur:
    Code:
    Accelerometer:
        IF Int1_3D = 1 THEN         ' Int1_3D is IO pin for Interrup coming from 3D sensor
            gosub Accelerometer_Clear
            Accel_Alarm = 1         ' This is indecator that something must be done in main program        
        endif
        return
    
    Accelerometer_Clear:            ' If sensor has moved during event hadling, then interrupt must be cleared once before new sequence
        I2CAddress_3D = $31         ' Clear interrupt request
        gosub I2C_Read_3D
        I2CAddress_3D = $23         ' Reset acceration/tilt value after interrupt 
        gosub I2C_Read_3D
        Return
    Vdd_IO = Vdd = 5V. Even spec says 3.6V, I have used 5V already several years for same parts. Same voltage is used also for I2C pull-ups & CS (pins 1, 3, 6, 7).
    Last edited by Gusse; - 27th January 2013 at 22:00.

  2. #2
    Join Date
    Jul 2007
    Posts
    7


    Did you find this post helpful? Yes | No

    Default Re: 3-Axis Accelerometer (LIS302DL)

    Thank you very much , I will try and let you know the results. If you need assistance for GSM and GPS, I am very very experienced
    thanks again
    haim

Similar Threads

  1. Replies: 4
    Last Post: - 15th April 2009, 01:54
  2. 3 HPWM channels
    By docwisdom in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 4th April 2006, 02:43
  3. having problems with Hantronix 20x4 lcd
    By Rhatidbwoy in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 22nd December 2005, 12:22
  4. Someone help me to simplify this
    By thrix in forum General
    Replies: 4
    Last Post: - 21st February 2004, 05:01
  5. Help wanted..
    By thrix in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 17th February 2004, 23:44

Members who have read this thread : 2

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts