EngineersGarage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise
You are here: Home / Topics / Interfacing accelerometer MMA7660 to 8051 and display values on LCD

Interfacing accelerometer MMA7660 to 8051 and display values on LCD

|

Microcontroller › 8051 › Interfacing accelerometer MMA7660 to 8051 and display values on LCD

  • This topic has 0 replies, 1 voice, and was last updated 12 years, 3 months ago by Jaideep.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • March 14, 2013 at 4:04 am #2186
    Jaideep
    Participant

    Hello everyone
    I am Jaideep pursuing Btech final year. Currently i am doing my project titled “Vehicle Tracking and Accident Alert System“
    It works with an acceleration sensor MMA7660 and depending on values obtained from it, the tilt is measured and accident is detected 
    Currently am facing projects in interfacing MMA7660 to 8051 since some Garbage values are coming on LCD

     

    Here is my code, Please help:

     

    sda equ P3.6
    scl equ P3.7
    org 00h
    acall init 

    sa:
    mov a,#98h 
    acall startc
    acall send
    acall mack 
    jc sa

    amr:
    mov a,#07h 
    acall send
    acall mack
    jc amr


    am:
    mov a,#09h 
    acall send
    acall mack
    jc am 

    start:
    mov a,#98h 
    acall startc
    acall send
    acall mack
    jc start

    rax: 
    mov a,#00h 
    acall send
    acall mack
    jc rax 

    rby: 
    mov a,#01h
    acall send
    acall mack
    jc rby

    rcz: 
    mov a,#02h
    acall send
    acall mack
    jc rcz 

    sar:
    mov a,#99h 
    acall rstart
    acall send
    acall mack
    jc sar
    acall recv
    acall ack
    mov r0,a 
    acall recv
    acall ack
    mov r1,a 
    acall recv
    acall nak
    mov r2,a 
    acall stop

    mov a,#38h
    acall cmdwrt
    acall delay

    mov a,#0eh
    acall cmdwrt
    acall delay

    mov a,#01h
    acall cmdwrt
    acall delay

    mov a,#06h
    acall cmdwrt
    acall delay

    mov a,#80h
    acall cmdwrt
    acall delay
    mov a,#’X’
    acall datawrt
    acall delay

    mov a,#81h
    acall cmdwrt
    acall delay
    mov a,#’=’
    acall datawrt
    acall delay

    mov a,#82h
    acall cmdwrt
    acall delay
    mov a,r0
    acall datawrt
    acall delay

    mov a,#86h
    acall cmdwrt
    acall delay
    mov a,#’Y’
    acall datawrt
    acall delay

    mov a,#87h
    acall cmdwrt
    acall delay
    mov a,#’=’
    acall datawrt
    acall delay

    mov a,#88h
    acall cmdwrt
    acall delay
    mov a,r1
    acall datawrt
    acall delay

    mov a,#8bh
    acall cmdwrt
    acall delay
    mov a,#’Z’
    acall datawrt
    acall delay

    mov a,#8ch
    acall cmdwrt
    acall delay
    mov a,#’=’
    acall datawrt
    acall delay

    mov a,#8dh
    acall cmdwrt
    acall delay
    mov a,r2
    acall datawrt
    acall delay

    jmp start 

    cmdwrt:
    mov p1,a
    clr p2.0
    clr p2.1
    setb p2.2
    acall delay
    clr p2.2
    ret

    datawrt:
    mov p1,a
    setb p2.0
    clr p2.1
    setb p2.2
    acall delay
    clr p2.2
    ret

    delay:
    mov r3,#0c8h
    bck1:mov r4,#64h
    bck:djnz r4,bck
    djnz r3,bck1
    ret

    init:
    setb sda
    setb scl
    ret

    startc:
    setb scl
    clr sda
    clr scl
    ret

    rstart:
    clr scl
    setb sda
    setb scl
    clr sda
    ret

    send:
    mov r7,#08
    back:
    clr scl
    rlc a
    mov sda,c
    setb scl
    djnz r7,back
    clr scl
    setb sda
    ret

    ack:
    clr sda
    setb scl
    clr scl
    setb sda
    ret

    mack:
    setb scl
    mov c, sda
    clr scl
    ret

    nak:
    setb sda
    setb scl
    clr scl
    setb scl
    ret

    recv:
    mov r7,#08
    back2:
    clr scl
    setb scl
    mov c,sda
    rlc a
    djnz r7,back2
    clr scl
    setb sda
    ret

    stop:
    clr scl
    clr sda
    setb scl
    setb sda
    ret


    end

     

  • Author
    Posts
Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.
Log In

RSS Recent Posts

  • Parts required for a personal project June 15, 2025
  • Curved lines in PCB design June 15, 2025
  • Wideband matching an electrically short bowtie antenna; 50 ohm, 434 MHz June 15, 2025
  • using a RTC in SF basic June 15, 2025
  • PIC KIT 3 not able to program dsPIC June 15, 2025

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2025 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise