comparison code_part1/OSTC_code_asm_part1/i2c_eeprom.asm @ 539:a587f491693d

clock in I2C "bus failed" routine
author heinrichsweikamp
date Sun, 08 Jan 2012 18:52:19 +0100
parents 3091628b2742
children 77c8ff191cd7
comparison
equal deleted inserted replaced
538:5eff719fd292 539:a587f491693d
357 movlw d'9' 357 movlw d'9'
358 movwf i2c_temp ; clock-out 9 clock cycles manually 358 movwf i2c_temp ; clock-out 9 clock cycles manually
359 I2CReset_1: 359 I2CReset_1:
360 bsf PORTC,3 ; SCL=1 360 bsf PORTC,3 ; SCL=1
361 nop 361 nop
362 nop
363 nop
364 nop
362 btfsc PORTC,4 ; SDA=1? 365 btfsc PORTC,4 ; SDA=1?
363 bra I2CReset_2 ; =1, SDA has been released from slave 366 bra I2CReset_2 ; =1, SDA has been released from slave
364 bcf PORTC,3 ; SCL=0 367 bcf PORTC,3 ; SCL=0
368 nop
369 nop
365 bcf PORTC,3 370 bcf PORTC,3
371 nop
372 nop
366 decfsz i2c_temp,F 373 decfsz i2c_temp,F
367 bra I2CReset_1 ; check for nine clock cycles 374 bra I2CReset_1 ; check for nine clock cycles
368 I2CReset_2: 375 I2CReset_2:
369 bsf TRISC,3 ; SCL Input 376 bsf TRISC,3 ; SCL Input
370 clrf SSPCON1 ; set I²C Mode 377 clrf SSPCON1 ; set I²C Mode