Cypress技术william hill官网
直播中

李涛

7年用户 1365经验值
私信 关注
[问答]

ARDUINO与PSoC的I2C接口

大家好,
我想在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 communication 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.

回帖(11)

王华梅

2018-8-19 05:01:57
嗨,Faruk,
你能告诉我这里的主人和奴隶是哪个?
当做,
布雷加德什
                    
                    
以上来自于百度翻译

               
                                                                                      以下为原文
                                            Hi Faruk,
 
Can you please tell me which is the master and slave here?
 
Regards,
Bragadeesh
举报

李涛

2018-8-19 05:14:40
引用: 60user152 发表于 2018-8-19 05:01
嗨,Faruk,
你能告诉我这里的主人和奴隶是哪个?
当做,

嗨,Bragadeesh,
谢谢你的回复。就像我说的,我想从Arduino发送数据到PSoC。因此,我们可以说,Arduino是主设备。而且,当我设计的PSoC,我说ezi2c模块。
昨天,有人告诉我我必须连接设备地面常见(线地面)。是真的吗?
谢谢。
                    
                    
以上来自于百度翻译

               
                                                                                      以下为原文
                                            Hi Bragadeesh,
 
Thanks for replying. As I said, I want to send a data from Arduino to PSoC. So, we can say Arduino is the master device. Also, when I designed the PSoC, I added EZI2C module.
 
Yesterday, someone told me I had to connect devices' ground common(wire ground to ground). Is it true?
 

Thanks.
举报

王华梅

2018-8-19 05:31:11
引用: 乔伊斯e 发表于 2018-8-19 05:14
嗨,Bragadeesh,
谢谢你的回复。就像我说的,我想从Arduino发送数据到PSoC。因此,我们可以说,Arduino是主设备。而且,当我设计的PSoC,我说ezi2c模块。
昨天,有人告诉我我必须连接设备地面常见(线地面)。是真的吗?

是的,你需要把2个场地连接起来。
你试过用桥接控制面板来传送PSoC设备吗?
当做,
布雷加德什
                    
                    
以上来自于百度翻译

               
                                                                                      以下为原文
                                            Yes,you need to connect the 2 grounds together.
 
Did you try communicating the PSoC device with the bridge control panel?
 
Regards,
Bragadeesh
举报

李涛

2018-8-19 05:46:37
引用: 60user152 发表于 2018-8-19 05:31
是的,你需要把2个场地连接起来。
你试过用桥接控制面板来传送PSoC设备吗?
当做,

好的,我把2个场地连接在一起了。有没有在PSoC的LED,但在Arduino write()函数返回1,好。这意味着我设法发送数据。
是的,我试过了桥牌控制面板。我设法沟通我只有Arduino通讯有问题。
                    
                    
以上来自于百度翻译

               
                                                                                      以下为原文
                                            OK, I connected the 2 grounds together now. There is nothing on PSoC LED, but write() function on the Arduino returns 1   that is good. It means I managed to send data
 
Yes, I tried Bridge Control Panel. I managed to communicate  I have a problem only with Arduino communication.
举报

更多回帖

发帖
×
20
完善资料,
赚取积分