Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7617053
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T03:02:57+00:00 2026-05-31T03:02:57+00:00

I have a task to write eeprom read/write subroutines for PIC16F84 microcontroller. I have

  • 0

I have a task to write eeprom read/write subroutines for PIC16F84 microcontroller. I have written such code:

    EEPROM_Read
        clrw
        bsf     STATUS, RP0  ; Bank0
        movlw   DATA_EE_ADDR  ; Any location in Data EEPROM memory space
        movwf   EEADR        ; Address to read
        bsf     EECON1, RD   ; EE Read

        movlw   EEDATA
        bcf     STATUS, RP0  ; Bank0
        return

EEPROM_Write        
        bcf     INTCON,GIE      ;disable interrupts for EEPROM write
            banksel     EEADR           ;bank 2
            movfw       DATA_EE_ADDR        ;load write address to EEPROM address pointer
            movwf       EEADR
            movfw       DATA_EE_DATA        ;load write data to EEPROM data buffer
            movwf       EEDATA
            banksel     EECON1          ;bank 3
            bsf         EECON1,WREN         ;enable EEPROM write
            movlw       0x55 ;unlock codes
            movwf       EECON2
            movlw       0xAA
            movwf       EECON2
            bsf         EECON1,WR       ;enable EEPROM write
            btfsc       EECON1,WR       ;wait here until write completes
            goto        $-1
            bcf         EECON1,WREN     ;write complete, disable write mode
            banksel     0 ;bank 0
            movlw       0 ;are interrupts being used?
            xorwf       INTCON,W
            btfss       STATUS,Z
            bsf     INTCON,GIE      ;yes,enable interrupts
            return

Is it right? I have problems with EEProm_Read. It seems that it doesn’t work right.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T03:02:58+00:00Added an answer on May 31, 2026 at 3:02 am

    According to datasheet information your EEPROM read code is wrong, because EEADR register is in memory bank 0 and not in bank 1 as in your code case:

    Correct code is:

    BCF    STATUS, RP0    ; Bank 0
    MOVLW  DATA_EE_ADDR
    MOVWF  EEADR          ; Address to read
    BSF    STATUS, RP0    ; Bank 1
    BSF    EECON1, RD     ; EE Read
    BCF    STATUS, RP0    ; Bank 0
    MOVF   EEDATA, W      ; W = EEDATA
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been assigned wit the task to write a program that takes a
I have a task and I want to generate some code using the CodeDom.
I have task to write program allowing users to draw stars, which can differ
I have been given a task to write a program to automatically create a
I have the task to write a user control to display some results by
My task is to write MATLAB code to produce a 4-part logo as shown
I have written a java code in Eclipse and i am developing a plug-in
I have the unfortunate task of cleaning up a bunch of old ColdFusion code.
Well, i have a task to write Tcp Client for Andoid on java. Before,
Can anyone help me with this? I have a task to write a function,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.