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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
07/22/04 21:27
Read: times


 
#74716 - smart card (memory card) with I2C
Hi there,

first, let me introduce myself, my name is Tiago, i'm studing computer engineer here in Brazil (Curitiba-PR).

So, let's go!

I'm using 80C31 to communicate with smart card (memory card - AT24C128SC - EEPROM).
So, when i'm sending the device address, after the 8th bit, both pins (SDA and SCL) comes into 0 level (0V).
I want to know if it is possible, because, i don't have the signals control anymore.

I'm using pull ups resistors (5,1K), i tried to reset too, i change the code sometimes, but it did'n change.

I attach part of the code here, could you please help me?!
;***subroutines***
SCLHigh:
setb P1.0
JNB P1.0,$
ret

SCLDown:
clr P1.0
JB P1.0, $
ret

SDAHigh:
setb P1.1
jnb P1.1, $
ret
SDADown:
clr P1.1
jb P1.1, $
ret

CLOCK:
call SCLHigh
NOP
NOP
call SCLDown
NOP
NOP
ret

RESET_I2C:
mov r1, #09d
acall SDAHigh
acall SCLDown
loop:
acall SCLHigh
jb P1.1, Decrementa
Decrementa:
acall SCLDown
djnz r1, loop ;9 vezes
ret

;----end of subroutines---


I2C_WRITE:
; SCL -> P1.0
; SDA -> P1.1
mov a, #00d ;zerando
mov P1, #03h ;mantendo SDA e SCL em alta
;device_address:

acall SDADown ;(start condition)
NOP
NOP
NOP
acall SCLDown ;clock em low


acall SDAHigh ;1
acall CLOCK ;clock pulse
acall SDADown ;0
acall CLOCK

acall SDAHigh ;1
acall CLOCK

acall SDADown ;0
acall CLOCK

acall SDADown ;0
acall CLOCK

acall SDADown ;0
acall CLOCK

acall SDADown ;0
acall CLOCK

acall SDADown ;0=write
acall CLOCK

acall SDAHigh ;eleva SDA
acall SCLHigh ;clock em 1
jb P1.1, $ ;waiting ack
acall SCLDown ;ACK=0,
;device address enviado!





List of 3 messages in thread
TopicAuthorDate
smart card (memory card) with I2C            01/01/70 00:00      
   RE: smart card (memory card) with I2C            01/01/70 00:00      
   RE: smart card (memory card) with I2C            01/01/70 00:00      

Back to Subject List