This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Problem in Interfacing a 89C51 and ATMEL 24C04 (External Memory)

Dear Sir,


I am facing a problem in interfacing the AT89C51 with AT24C04 (External memory).


the code is as follows:






FADDR	EQU	0A0h	; fixed address for AT24Cxx EEPROMs
MEM_SIZE EQU	20h	 ; bytes per AT24C64
FILL	 EQU	53h		; example fill value

SDA	EQU	P1.2
SCL	EQU	P1.3
		; Register definitions.

addr_ptr  EQU	r3 ; 8-bit address pointer

ORG	0000H	; power on/reset vector

SJMP 	MAIN
ORG 	0030H

MAIN:

;;;;;;;;;;;;;;;;;;;;  LCD Part Initialization for Display  ;;;;;;;;;;;;;;;;;;;;;;;;;

            ACALL  DELAY
            MOV A,#30H         ;;;; To define 16x2 line character display
            NOP
            NOP
            MOV  P2,A
            NOP
            NOP
            CLR   P1.4
            SETB  P1.5
            CLR   P1.5
            ACALL DELAY

            MOV A,#0CH         ;;;; To display cursor on and blinking
	        NOP
            NOP
            MOV   P2,A
            NOP
            NOP
            CLR   P1.4
            SETB  P1.5
            CLR   P1.5
            ACALL DELAY

            MOV A,#01H         ;;;; To clear the screen
            NOP
            NOP
            MOV   P2,A
            NOP
            NOP
            CLR   P1.4
            SETB  P1.5
            CLR   P1.5
            ACALL DELAY

            MOV A,#80H          ;;;;  To display from first line
            NOP
            NOP
            MOV   P2,A
            NOP
            NOP
            CLR   P1.4
            SETB  P1.5
            CLR   P1.5
            NOP
            ACALL DELAY

            MOV A,#06H          ;;;;  To increment the cursor
            NOP
            NOP
            MOV   P2,A
            NOP
            NOP
            CLR   P1.4
            SETB  P1.5
            CLR   P1.5
            NOP
            ACALL DELAY

;;;;;;End LCDinitialization Part  ;;;;;;;;

sending the rest of the code in next message:

  • "Sorry to send it in four parts. The message didnt fit in."

    There's a clue there!

    You are trying to debug far too much at once.

    Your first step must be to reduce this to something really simple, and get that working. Then you can extend & expand it one small step at a time.

    Be sure that you have each step working before moving to the next step;
    Always keep a backup of the previous working step.

    When it stops working, go back to the previous step, examine what you've changed, and deduce where you went wrong.