1
完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
你好,
我必须发送3个长tiPE可变形式的PLC到CY8C KIT01,我应该使用这个工具包的串行端口,但我没有任何线索如何开始。我应该使用哪些组件来编程它来使用串行端口发送和接收数据。恳求帮助! 以上来自于百度翻译 以下为原文 Hello, I have to send 3 long tipe variable form a PLC to CY8C kit001 and i tought to use the serial port from this kit, but i don't have any clue how to start. what components should i use to program it to send and recive data using the serial port. pleasssse help! |
|
相关推荐
13个回答
|
|
您需要的模块是UART(缩写:通用异步接收机和发射机AFAIK)。
可在所有PSoC版本。 快乐编码 鲍勃 以上来自于百度翻译 以下为原文 The module you need is the UART ( Acronym of: Universal Asynchrone receiver and Transmitter afaik) Available in all PSoC versions. Happy coding Bob |
|
|
|
10xthx为您的答案!事实上,使用UART模块,我设法建立PLC和套件之间的通信,但LCD剂量不显示的数据,我从PLC巫师发送的是一个常数16咬。例如,我从PLC发送的号码3(16咬)和显示器上的PSoC工具包出现了各种奇怪的字符。我认为这是因为比特/秒率,但我没有解决这个问题,即使我固定相同的保费率这两个设备。有什么办法解决这个问题吗?
以上来自于百度翻译 以下为原文 10xthx for your answers! indeed using the UART module I managed to establish the communication between the PLC and the kit but the LCD dose not display's the data I'm sending from the PLC witch is a constant on 16 bites. For example I am sending from the PLC the number 3 (on 16 bites) and on the display of the PSoC kit appears all kind of strange characters. I thought it is because of the bits/seconds rate but I didn't solved this problem even if I fixed the same baude rate to both devices. Any ideas how to solve this problem? |
|
|
|
嗯,把你的项目拉开,让我们看看它,有一些陷阱可以做…
鲍勃 以上来自于百度翻译 以下为原文 Well, zip your project and let us have a look at it, there are some pitfalls one can make... Bob |
|
|
|
你提到没有显示数据,可能有
1。您没有发送数据,或者数据不是正确格式。 2。PSoC没有看到来自输入引脚WHCIH的信号可能是缓冲器/电平移位器的问题… 三。纺纱机收到信号,但Psoc Uart没有接收到信号。 4。PSoC处理接收正确,但您的程序从错误的地址获得数据或以错误的格式解码。 5。数据被正确地解码和解码,但LCD显示功能不能正确地输出到LCD。 6。数据被正确地输出到LCD模块,但是LCD模块没有显示正确的东西。 这就是我检查的方式。 检查这个,上传项目,告诉人们这里哪一个是你的问题,也许有人能帮助你。 以上来自于百度翻译 以下为原文 You mentioned not showing the data, there can be 1. you are not sending the data or the data is not is the correct format 2. The psoc doesnt see the signal from the input pin whcih could be a problem with the buffer/level shifter... 3. The spindoes get the signal, but Psoc Uart doesn't peform the receiving funtion 4. The Psoc handles the receiving correctly but your program get the data from a wrong address or decoding in a wrong format 5. the data is receved and decoded correctly, but the LCD display fucntion not outputing it to the LCD correctly 6. The data is output to the LCD module correctly but the LCD module not displaying the right thing. This would be the way I check. Check this, upload the project and tell people here which one is your problem, some one may be able to help |
|
|
|
这是我的计划。正如我之前所说的,PSoC Kit必须在LCD 3上接收和显示长变量数据,我从一个PLC女巫那里发送给它的数据量是19200。在这3个变量中,它连续地释放出一些奇怪的特性。(我也尝试使用Simulff()函数,但没有成功。
测试2.Zip 3.8兆字节 以上来自于百度翻译 以下为原文 Here is my project. As I said before the PSoC Kit has to recive and display on the lcd 3 long variables data witch I am sending to it from a PLC witch has a baude rate of 19200. Insted of the 3 variables it dispays continousely some strange characers.(I also tryed to use the sprintf() function but without succes).
|
|
|
|
1。首先
我会改变 从串行端口接收到的In16CH;/*数据*/ 到 从串口接收的char;/*数据*/ 2。你从PLC,ASCII 0—9或0~255字节(从0x00到0xFFFF)输入什么?如果发送二进制值,则需要将其转换为ASCII字符串以显示。 三。你用超级终端检查你从PLC发送的信息吗? 4。正如我在上一篇文章中提到的,你检查过台阶上有什么列表吗?IT项目失败的步骤是什么? 以上来自于百度翻译 以下为原文 1. First of all I would change int16 ch; /* Data received from the Serial port */ to char ch; /* Data received from the Serial port */ 2. What do you send from PLC, ASCII 0-9 or a byte of 0-255 ( ie an int from 0x00 to 0xffff? If you are send a binary value, you need to convert it to ascii string to display. 3. Have you use hyperterminal to check what you are sending from the PLC? 4. As I menention in my last post, have you check as what list on the steps? which step does it project failed? |
|
|
|
用UART发送3个长变量可能是复杂的:UART是一个8位的设备,您必须发送一个长为四个独立的字节,而在接收端,必须将它们组合成一个长整数。对工会的转移、标引或使用似乎是双方都不可忽视的。
在你通过UART发送它们之前,你应该先检查一个程序,你是否将其分成字节和重新组合工作。 LCD组件是一个字符组件,它只显示ASCII字符(一个是0x31,字母“a”是0x41),您将不得不将您的数字转换为字符串来显示它。幸运的是,有一个功能: 包括: 字符缓冲器〔16〕; UIT32 32 MyVaR=0x7FFFFFF; /和现在的位隐式喷洒: Spultf(缓冲器,“%u”),MyVar;// LCDApReltScript(缓冲区); 希望,没有打字… 鲍勃 以上来自于百度翻译 以下为原文 to send 3 long variables with an UART may be complicated: An UART is an 8-Bit device, you have to send one long as four separate bytes and on the receiving side, you have to combine them to form again a long integer. A bit of shifting or indexing or use of a union seems nessecary on both sides. You ought to check first with a program whether your separating into bytes and the re-combination works, before you sent them via UART. The LCD-Component is a CHARACTER component, it only displays ASCII chars (the one is 0x31, the letter "A" is 0x41) you will have to convert your numbers into a character string to display it. Fortunately there is a function for that: #include char Buffer[16]; uint32 MyVar = 0x7FFFFFFF; // and now the bit cryptic sprintf: sprintf(Buffer,"%Lu",MyVar; // LCD_PrintString(Buffer); Hope, there's no typo... Bob |
|
|
|
|
|
|
|
1。我还用“chch-ch'”安装了“十六进制”,但它不起作用。
2。我认为PLC正在发送字节。PLC可以发送的数据是布尔、字和长(二进制值我认为)。 三。我已经测试了这里的程序与HIPER终端,它的工作原理。它从PC RS232端口接收数据,我还测试了一个程序,使PC接收PSoC发送和工作的数据,但是当我使用超级终端来查看PLC发送什么时,出现了一些奇怪的字符。但是把相同的数据发送给另一个PLC工作。 4。我认为这是一个编纂信息的问题。让我看看我是否理解正确:LCD只能显示ACSIIcode,所以如果PLCIS发送二进制代码,使用fPrimff()函数,我必须把它转换成ASCII。 以上来自于百度翻译 以下为原文 1. I tryed also with 'char ch' insted 'int16' but it dose not work. 2. I think the plc is sending byte. The data that the plc can send are boolean, word and long(binary value I think). 3. I have tested the program posted here with the hiper terminal and it works. It recives data from the PC rs232 port, and I also tested a program so that the PC recives data that the PSoC sends and also worked, but when I used the hyperterminal to see what is the plc sending....appeared some strange characters. But to send the same data to another PLC works. 4. I think is a problem of codification of the information. Let me see if I understood correctly: the LCD can display only ACSII code so if the PLC is sending binary code, using fprintf() function i have to convert it to ASCII. |
|
|
|
是的,完全正确。当您在示例中使用SaveTFF时,可以在EasyLIER调试之前,查看Buffer或打印到LCD之前的输入值。
快乐调试 鲍勃 以上来自于百度翻译 以下为原文 Yes, perfectly right. When you use sprintf as I showed in the example, you can easylier debug, look at Buffer or the input-value before printing to LCD. Happy debugging Bob |
|
|
|
确切地说,我怎么能看到PSoC在LCD上没有打印出来的东西呢?Iook在缓冲区是怎么回事?
以上来自于百度翻译 以下为原文 And exactely how can i see what PSoC is reciveing whithout printing on the LCD? How can Iook at what is in the buffer? |
|
|
|
你有冰吗?如果使用,则使用调试器进行步骤和跟踪。
以上来自于百度翻译 以下为原文 Do you have the ICE? If you do, use the debugger to step and trace |
|
|
|
如果你没有冰,然后你可以使用以下功能
LCDPr6PythLoad,LCD-PrHuxTin。 你可以从设计师的LCD数据表中找到该函数的descritpion。 第一个让你一次打印一个字节,先试试这个。这样你就可以打印出四个不同的字节。 如果这样的话,你的接收就可以了。剩下的就是如何组4字节形成一个长的又如何显示它,使用printf和这些打印功能应该工作,你只需要读到规范和选择一个适合你的。 以上来自于百度翻译 以下为原文 If you don't have the ICE, then you may use the following functions LCD_PrHexByte, LCD_PrHexInt. You can find the descritpion of this function in the LCD DATA sheet from the designer. THe first one let you print one byte at a time, try this first. This way you print it out as four seperate bytes. If that works, your receiving should be OK. The rest would be how to groupt the 4 bytes to form a long and also how to display it, using printf and these printing fucntion should work, you just need to read thru the specificationa and pick the one the suits you. |
|
|
|
只有小组成员才能发言,加入小组>>
754个成员聚集在这个小组
加入小组2113 浏览 1 评论
1860 浏览 1 评论
3673 浏览 1 评论
请问可以直接使用来自FX2LP固件的端点向主机FIFO写入数据吗?
1794 浏览 6 评论
1540 浏览 1 评论
CY8C4025LQI在程序中调用函数,通过示波器观察SCL引脚波形,无法将pin0.4(SCL)下拉是什么原因导致?
581浏览 2评论
CYUSB3065焊接到USB3.0 TYPE-B口的焊接触点就无法使用是什么原因导致的?
434浏览 2评论
CX3连接Camera修改分辨率之后,播放器无法播出camera的画面怎么解决?
445浏览 2评论
393浏览 2评论
使用stm32+cyw43438 wifi驱动whd,WHD驱动固件加载失败的原因?
1016浏览 2评论
小黑屋| 手机版| Archiver| 德赢Vwin官网 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-30 22:37 , Processed in 1.060730 second(s), Total 70, Slave 64 queries .
Powered by 德赢Vwin官网 网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
德赢Vwin官网 观察
版权所有 © 湖南华秋数字科技有限公司
德赢Vwin官网 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号