Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

I2c and At89c2051..... problem

Status
Not open for further replies.

operator6wp

Newbie level 4
Joined
Nov 17, 2003
Messages
6
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
43
HI, I have one problem in VSMproteus....
I used At89c2051 and 24c04a for simulation I2C and PFC8583 and I can't read I2C data byte from eeprom ... is steel 0 value ... but in log view I2C is data ok read....
I connect SCL-P3.0 and SDA-P3.1....

I2C_read:

SETB SDA
MOV b,#8
I2C_R: CALL I2C_wait ;(nop's sub)
SETB SCL
MOV C,SDA
CLR SCL
RLC A
DJNZ b,I2C_R
RET


in sda is not change bits.... how to read... whats wrong.... HELP!!!!

but, when I disconnect Clock pcf8583 from I2C bus , eeprom simulation is work ok... what up....
 

IIC_START MACRO
SETB SDA
SETB SCL
CLR SDA
CLR SCL
ENDM
IIC_STOP MACRO
CLR SDA
SETB SCL
SETB SDA
CLR SCL
ENDM
IIC_DT_0 MACRO
CLR SDA
SETB SCL
CLR SCL
ENDM
IIC_DT_1 MACRO
SETB SDA
SETB SCL
CLR SCL
ENDM
IIC_RD_BIT MACRO
SETB SDA
SETB SCL
CLR SCL
MOV C,SDA
ENDM
IIC_DV_ADDR MACRO
IIC_DT_1
IIC_DT_0
IIC_DT_1
IIC_DT_0
IIC_DT_0
IIC_DT_0
IIC_DT_0
ENDM

;------------------------------
IIC_READ:
IIC_START
IIC_DV_ADDR
IIC_DT_1
IIC_DT_1
MOV R2,#8
IIC_R_L1:
IIC_RD_BIT
RLC A
DJNZ R2,IIC_R_L1
MOV IIC_BUF,A
IIC_STOP
RET
;------------------------------
IIC_WR_ADDR:
IIC_START
IIC_DV_ADDR
IIC_DT_0
IIC_DT_1 ;ACK
MOV A,R7
MOV R2,#8
IIC_WA_L1:
RLC A
MOV SDA,C
SETB SCL
CLR SCL
DJNZ R2,IIC_WA_L1
IIC_DT_1 ;ACK
IIC_STOP
RET
;------------------------------
IIC_WRITE:
IIC_START
IIC_DV_ADDR
IIC_DT_0
IIC_DT_1 ;ACK
MOV A,R7
MOV R2,#8
IIC_W_L1:
RLC A
MOV SDA,C
SETB SCL
CLR SCL
DJNZ R2,IIC_W_L1
IIC_DT_1 ;ACK
MOV A,R6
MOV R2,#8
IIC_W_L2:
RLC A
MOV SDA,C
SETB SCL
CLR SCL
DJNZ R2,IIC_W_L2
IIC_DT_1 ;ACK
IIC_STOP
RET
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top