9S12ZVL IIC software problem

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

9S12ZVL IIC software problem

跳至解决方案
1,635 次查看
huang_hw
Contributor II

I am trying to control an IIC device from my 9S12ZVL board.

Background:

MPU: MC9S12ZVL32MLF (48 pins)

Dev. System: Code Warrior 10.6 Special (with Processor Expert installed)

 

I am already able to control other IO lines and PWM from software.

 

When I tried the simplest of initialization and testing WITHOUT using interrupt,

I get stuck at the very beginning when trying to send out the very first byte.

 

Would be grateful if someone can give me a pointer as to what I have missed?

 

Thanks.

 

My IIC code segment:

(all macros generated by Processor Expert)

 

IIC0IBCR = IIC0IBCR_IBEN_MASK;    //enable IIC

//set IIC to Enable, Master and Tx mode, NO interrupt (this should send out a START)

IIC0IBCR = (IIC0IBCR_IBEN_MASK  &  IIC0IBCR_MS_SL_MASK  &  IIC0IBCR_TX_RX_MASK);

 

IIC0IBDR = 0x52U;  //write slave address

 

while ((IIC0IBSR & IIC0IBSR_IBIF_MASK) == 0) {}

(The software is stuck here forever).

标签 (1)
0 项奖励
回复
1 解答
1,423 次查看
kef2
Senior Contributor V

IIC0IBCR = (IIC0IBCR_IBEN_MASK  &  IIC0IBCR_MS_SL_MASK  &  IIC0IBCR_TX_RX_MASK);

在原帖中查看解决方案

0 项奖励
回复
2 回复数
1,423 次查看
huang_hw
Contributor II

Thanks Edward. You are absolutely  right.

What would I do without Freescale(NXP?) Community.

I was in this mode where I can see the finest details but become blind to something obvious.

For others following this thread, it should have been

IIC0IBCR = (IIC0IBCR_IBEN_MASK  |  IIC0IBCR_MS_SL_MASK  |  IIC0IBCR_TX_RX_MASK);

0 项奖励
回复
1,424 次查看
kef2
Senior Contributor V

IIC0IBCR = (IIC0IBCR_IBEN_MASK  &  IIC0IBCR_MS_SL_MASK  &  IIC0IBCR_TX_RX_MASK);

0 项奖励
回复