大家好,
我想在ARDUINO UNO和PSoC 5LP(CY8CITK-059)之间提供一个I2C接口。我在YouTube上完成了I2C课程,我成功地设置了PSoC和桥接控制面板之间的
通信。
然后,我想把一个字节从ARDUINO发送到PSoC。但我还没有完成。我正确地将时钟值设置为相同的值,正确地开发了两边的代码,但是当我发送PSoC一个字节时,什么也没有。
有人能在这些设备之间建立I2C接口吗?或者有人能帮助我?
谢谢
相关主题:R: I.C通信AdoiNo & Gt;PSoC
这是我的档案;
阿杜里诺
包括:
空设置()
开始(9600);
StCeCH(100000);
开始(8);
}
空sEnWiReR()
PrimTLN(“发送…”);
开始传输(8);
字节y=线。写(0x00);
endtransmission()线;
串行out.println(“送…”);
}
loop() { void
而(串行。available() & gt;0){
int x = read()系列;
如果(X = = 49){
sendwire();
}
}
}
PSoC主要C。
#包括”项目。”
int main(void)
{
卡片i2cbuf [ 1 ];
cyglobalintenable;/ *启用全局中断。* /
pwm_1_start();
i2c_start();
i2c_setbuffer1(1,1,i2cbuf);
i2cbuf [零] = 1;
为(;;)
{
pwm_1_writecompare(i2cbuf [ 0 ]×20);
}
}
信息编辑:A. Faruk UNAL
增加了文件。
以上来自于百度翻译
以下为原文
Hello everyone,
I want to provide an i2c interface between Arduino UNO and PSoC 5LP (cy8ckit-059). I completed the i2c lesson on YouTube and I managed to setup the communica
tion between PSoC and Bridge Control Panel.
Then, I want to send a byte from Arduino to PSoC. But I haven't done yet. I wired correctly, set clock values to the same value, developed the code for both sides correctly but when I send PSoC a byte, there is nothing.
Is there someone who could setup i2c interface between these devices before? Or someone who can help me?
Thanks
Related topic:
Re: I²C Communication Arduino -> PSoC
Here is my files;
Arduino side
#include
void setup() { Serial.begin(9600); Wire.setClock(100000); Wire.begin(8);}void sendWire(){ Serial.println("Sending..."); Wire.beginTransmission(8); byte y=Wire.write(0x00); Wire.endTransmission(); Serial.println("Sent...");}void loop() { while(Serial.available()>0){ int x=Serial.read(); if(x==49){ sendWire(); } }}
PSoC main.c
#include "project.h"int main(void){ uint8 i2cbuf[1]; CyGlobalIntEnable; /* Enable global interrupts. */ PWM_1_Start(); I2C_Start(); I2C_SetBuffer1(1,1, i2cbuf); i2cbuf[0]=1; for(;;) { PWM_1_WriteCompare(i2cbuf[0]*20); }}
Message was edited by: A. Faruk UNALThe files were added.