I am relatively new to micro-controllers and having trouble with my first I2C application. I am using a MC9S1C32 processor to communicate with an external capacitance to digital Converter (AD7746). I have the micro correctly hooked up to the data/clock lines of the converter, and the I2C bean added in my project. I am using code warrior 5.5.1272 and processor expert 2.95. In the I2C bean settings, I entered in the slave address 72 which is specified in the AD7746 datasheet. I believe my problems are in the way I am trying to call the functions generated by the I2C bean.
Currently my I2C code is as follows:
EI2C1_SendChar(0x01); //Send x01 over I2C to set sub address register of converter to 1
EI2C1_RecvBlock( 0xC000, 3); //Receive 3 blocks of data from the converter, store starting at address C000
That code then gets repeated every second.
When I look at address C000 with the debugger, the values never change from zero (I have a small capacitor hooked up to the converter capacitance measurement channel). I viewed the data/clock lines with a scope to verify messages where being send, and I was seeing serial like communication.
Also the AD7746 external ready pin never changes when viewed with a scope. So I believe another problem is I never "say go".
Anyone have any help, pointers?
Thanks.
Solved! Go to Solution.
It seems that your problem could be caused by three following misunderstandings:
- the EI2C1_RecvBlock method has 3 parameters, not 2
- 0xC000 is from FLASH memory in default setting and therefore you didn't receive any data
- possible incorrect usage of EI2C_RecvBlock method, this method receives a block of 3 bytes size, not 3 blocks
I hope this help you
Best Regards, Jan Pospisilik, Processor Expert Support
It seems that your problem could be caused by three following misunderstandings:
- the EI2C1_RecvBlock method has 3 parameters, not 2
- 0xC000 is from FLASH memory in default setting and therefore you didn't receive any data
- possible incorrect usage of EI2C_RecvBlock method, this method receives a block of 3 bytes size, not 3 blocks
I hope this help you
Best Regards, Jan Pospisilik, Processor Expert Support