IIC on a MC68HC908JL16 Assembly Language

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

IIC on a MC68HC908JL16 Assembly Language

689 Views
i_kauf
Contributor III

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

Labels (1)
0 Kudos
1 Reply

313 Views
RogerSchaefer
Contributor III

Hello Ingo,

 

Don't know about the JL16 exactly but I have some assembly code for IIC in the MC9S08SH8 at this site:

 

http://www.rasmicro.com/DS1307.htm

 

 

Roger

0 Kudos