Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
12/13/06 00:10
Read: times


 
#129369 - Thanks for all Replies, But...
Responding to: ???'s previous message
Hi again,
Thanks for your replies. Firtsly I want to give some info. about the problem. I have specified that the read opeartion has no defect. I have divided the all code into two seperate program.(Read program and write program)I set the 10H add. location to 'F0'H manually, and started the simulation. Program read the data and moved to port#1.
Then I suspected from write code. So, I modified the write code(Modification was, two different data write operation instead of one, into 10H & 15H add. locations)When I started the simulation, I saw that the 10H add. location was written by the micro. but 15H add. location was not. I could not understand how this can be. The code works for first operation but not for second again!

To Charles:
Charles, you can download the evaluation version of this simulation program that I use. (Search in google it is easy to find link) Also I use the evaluation version, there are some limitations but this is not a handicap for simulate the program. For instance one of the limitation is 64K or 32K external program memory option.It is not allowed to use etc.

To Ap Charles:
I think, you were worry about write or read bit specification. I especially took care for this. I have uploaded the whole program code. You can have look if you want.

To Jan:
Jan you were also worry about the simulation program ý think. I can say that I used this sim. program in every application that I realized. And there was no problem or bug in the problem till now. I got your advice and set the circuit on the bord. But unfortunately problem goes on.

Again thanks for all suggestions and waiting new ones.

Best Regards,
Batuhan

$MOD51
	ORG 00H
SCL	EQU P2.0
SDA	EQU P2.1
VERI	EQU 30H
	MOV IE,#00H
	MOV DPL,#10H
	MOV VERI,#0F0H
	ACALL EEPROM_WRITE
	NOP
	NOP
	NOP
	ACALL EEPROM_READ
	MOV P1,VERI
GO:	NOP
	AJMP GO

EEPROM_WRITE:
	LCALL I2C_START
	LCALL EE_ADD_WR
	MOV A,DPL
	LCALL I2C_WRITE
	LCALL ACK
	MOV A,VERI
	LCALL I2C_WRITE
	LCALL ACK
	LCALL I2C_STOP
	RET
EEPROM_READ:
	LCALL I2C_START
	LCALL EE_ADD_WR
	MOV A,DPL
	LCALL I2C_WRITE
	LCALL ACK
	LCALL I2C_START
	LCALL EE_ADD_RD
	LCALL I2C_READ
	LCALL NO_ACK
	LCALL I2C_STOP
	RET

EE_ADD_WR:
	MOV A,#0A0H
	LCALL I2C_WRITE
	LCALL ACK
	RET
EE_ADD_RD:
	MOV A,#0A1H
	LCALL I2C_WRITE
	LCALL ACK
	RET

I2C_WRITE:
	MOV R7,#8D
	CLR C
LOOP:	RLC A
	MOV SDA,C
	LCALL CLOCK
	DJNZ R7,LOOP
	RET
I2C_READ:
	MOV R7,#8D
LOOP2:	SETB SDA
	SETB SCL
	NOP
	NOP
	MOV C,SDA
	RLC A
	CLR SCL
	NOP
	NOP
	DJNZ R7,LOOP2
	MOV VERI,A
	RET

I2C_START:
	SETB SCL
	SETB SDA
	NOP
	CLR SDA
	NOP
	CLR SCL
	RET
I2C_STOP:
	SETB SCL
	CLR SDA
	NOP
	SETB SDA
	NOP
	CLR SCL
	RET

ACK:
	CLR SCL
	SETB SCL
	NOP
	JNB SDA,GO_ON
	CLR SCL
	RET
GO_ON:	CLR SCL
	RET
NO_ACK:
	CLR SCL
	SETB SDA
	SETB SCL
	NOP
	CLR SCL
	CLR SDA
	RET

CLOCK:
	SETB SCL
	NOP
	NOP
	CLR SCL
	RET

END


List of 14 messages in thread
TopicAuthorDate
I2C Read Operation            01/01/70 00:00      
   Photo            01/01/70 00:00      
      get the real stuff            01/01/70 00:00      
         I agree and, in addition            01/01/70 00:00      
            Thanks for all Replies, But...            01/01/70 00:00      
               By the way...            01/01/70 00:00      
                DELAY time is required ,I guess            01/01/70 00:00      
                  EEPROM needs time to write            01/01/70 00:00      
               what is it you do not understand            01/01/70 00:00      
                  what is it you do not understand            01/01/70 00:00      
                     I will not            01/01/70 00:00      
                        True            01/01/70 00:00      
   simulator            01/01/70 00:00      
   What addressing you are using            01/01/70 00:00      

Back to Subject List