IIC on a MC68HC908JL16 Assembly Language

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

IIC on a MC68HC908JL16 Assembly Language

807 次查看
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

标签 (1)
0 项奖励
回复
1 回复

431 次查看
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 项奖励
回复