本帖最后由 ayaqby 于 2014-11-13 10:09 编辑
#define I2C_SLAVE_ADDRESS1 0x50
uint8_t u8I2C_SendBuff[64];
uint8_t u8I2C_ReceiveBuff[64];
int main (void)
{
部分代码未显示
while(1)
{
I2C_MasterSendWait(I2C0,I2C_SLAVE_ADDRESS1,&u8I2C_SendBuff[0],64);
I2C_MasterReadWait(I2C0,I2C_SLAVE_ADDRESS1,&u8I2C_ReceiveBuff[0],64);
printf("Read data from I2C slave:
");
for(i=0;i<8;i++)
{
for(j=0;j<8;j++)
{
printf("0x%x,", u8I2C_ReceiveBuff[i*8+j]);
}
printf("
");
}
u8I2C_SendBuff[0]++;
for(i=1;i<64;i++)
{
u8I2C_SendBuff = i+u8I2C_SendBuff[0];
}
for(i=0;i<0xfffff;i++);
}
}
在读库函数例程的时候#define I2C_SLAVE_ADDRESS1 0x50我理解为从设备地址,请问这个地址是PRDM-KE02Z上面的哪个地址 还是KE02芯片内部的地址呢,求大神帮助,谢谢
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
楼主,是另一块板子呢。
其实在KEXX_DRIVERS_V1.2.1_DEVDkexx_drv_libsrcprojectsKE02I2C_MasterPoll_demo
这个路径下面有个readme.txt.里面讲的很清楚,如何使用。
@par Example description
===================
This example provides a template for I2C master with poll mode.
it cycle to transfer a frame data(64 bytes) and show it on terminal.
it also provide a template for how to initialize I2C module.
@par Code configuration
===================
Make sure the following macros are defined in ke02_config.h:
USE_FEE and
EXT_CLK_FREQ_KHZ macro is defined to 10000.
@par Directory contents
==================
- platforms/ke02_config.h library and board Configuration file
- projects/ke02/isr.h Interrupt handler installation
- projects/ke02/I2C_MasterPoll_demo.c Main program
@par Hardware environment
====================
- Board: freedom FRDM-KE02Z, revA
- Requirement for demo:
1. populate R47,R39
2. connect two boards with J2 18-18(SDA),20-20(SCL), 14-14(GND)
@par How to use it
=============
In order to make the program work, you must do the following :
- Rebuild all project files and load demo code into the device
- Connect J6 USB port to the computer that will find serial terminal port
- Open the serial terminal
- Configure the serial terminal to protocol: 8-N-1, 115200bps, and flow control: none
- Run the example
一周热门 更多>