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
You are here: Home / Topics / EEPROM test code problem.

EEPROM test code problem.

|

Microcontroller › 8051 › EEPROM test code problem.

  • This topic has 1 reply, 2 voices, and was last updated 7 years, 11 months ago by AJISH ALFRED.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • July 29, 2014 at 7:06 am #3193
    Nexus
    Participant

    This simple code is test the write and read of EEPROM.

     

    Firstly the LED at P1 will have all LED on, after a sec, have the P1 will have LED on.

    Next, code is to write 01010101B into the EEPROM.

    CJNE will check to see if it is written.

    But, after comparing, the data isn’t similar and the code is restarted.

     

    If the writing process works the LED at P1.0 should be the only LED on, which will notify the success of writing into the EEPROM.

     

    The next portion of the code will recall/read the written data in the EEPROM.

    f it is able to read, P1 will have alternate LED on and off.

    Please provide solutions, sources and why or what I had done wrong, to educate me. Thank you.

    =============================

    org 0
    jmp start
    eecon EQU 96h
     
    start:
    MOV A,#11111111B
    MOV P1,A
    ACALL DELAY0
    MOV A,#00001111B
    MOV P1,A
    ACALL DELAY0
     
    WRITE:
    MOV EECON,#00001000b
     
    mov dptr,#0 ;point to the memory location needed to write to. chosen location 0
    mov a,#10101010B ;move the data (0fch) to Accumulator
    movx @dptr,a ;write the data to the chosen location
     
    MOVX A, @DPTR
    CJNE A, #10101010B, START
     
    WRITEFIN:
    MOV A,#00000001B
    MOV P1,A
    ACALL DELAY0
    READ:
    MOV EECON,#00001000b
    mov DPTR,#0 ;point to the memory location needed to read from. Chosen location 0
    movx A,@dptr ;move the data within the memory location to the Accumulator
    mov R0,A ;move the data within Accumulator to the Register
     
    WAT: MOV P1,R0
    SJMP WAT
     
    ;========================================
    DELAY0:
    ACALL DELAY
    ACALL DELAY
    ACALL DELAY
    ACALL DELAY
    ACALL DELAY
    RET
    DELAY:
    MOV R3, #255
    HERE2:
    MOV R4, #255
    HERE:
    DJNZ R4, HERE
    DJNZ R3, HERE2
    RET
    end

     

    September 12, 2014 at 11:54 am #12159
    AJISH ALFRED
    Participant

    Hi,

    If you can try C code, there are many examples available in this site.

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

RSS Recent Posts

  • Basic questions about MOSFETS, Gate Drivers and Diodes August 9, 2022
  • LTSpice DC-AC August 9, 2022
  • Circuit Problem August 8, 2022
  • Google translate suggest "device sheet" or "apparatus sheet" but that cannot be ? August 8, 2022
  • Right channel distortion on vintage fisher rs-2010 August 8, 2022

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2022 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