Ingo Kauf

IIC on a MC68HC908JL16 Assembly Language

Discussion created by Ingo Kauf on Aug 8, 2010
Latest reply on Aug 9, 2010 by RogerSchaefer

Hello to all!

 

I working on a communication between an MC68HC908JL16 an a IIC device. I have a working write routine but I can not read from my IIC device.

 

write:

 mov I2C_adr,MMADR

 mov I2C_data,MMDTR

 bclr 3,MIMCR                 ;Transmit

 bset 4,MIMCR                 ;Start

 brclr 1,MMSR,*               ;MMDTR empty-flag

 bclr 4,MIMCR                 ;Stop

 rts

 

Read:

 mov i2C_adr,MMADR

 bset 0,MMADR               ;read bit set  

 bclr 3,MMCR                 ;Ack

 bset 3,MIMCR                ;Receive

 bset 4,MIMCR                ;Start

 brclr 0,MMSR,*             ;MMDRR full      The program stops always here and does not work further

 bclr 4,MIMCR                ;Stop

 mov MMDRR,I2C_Data

 rts

 

There must be an little error in my read routine. Can anyone help me please?

 

Regards,

 

Ingo

Outcomes