完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
大家好!我正在用PSoC 1 CY8C24123A做一个项目。硬件:我在PC -COM电缆上的软件-RS485到COMLATE(有最大的223(1设备)-最大值485(1设备))-CY8C24123A板(有SN75 176B……)。SN17176B的A、B信号与A、B信号最大值一致。(我使用RS485标准,波特率为19200)。通过UART用户模块实现PC与CY8C24123A之间的通信,但TX和RX连接到同一个PIN。PIN P0.4是TX和RX。我必须配置PIN 0.4。-P0.2控制SN75 176B发送或接收数据。P0.2=1发送;P0.2=0接收。内容:PC将发送数据到PSoC,之后PSoC将数据发送到PC。如果PSoC从PC接收3字节0xAA。PSOC发送0xAA、0x31、0x00到PC。如果PSoC从PC接收3字节0xBB。PSOC发送0xBB、0x33、0x00到PC。但是通信不好。有时,PC接收数据失败或不真实地接收数据。我想当我切换TX和RX在同一个引脚不好!你能告诉我解决这个问题的方法吗?多谢。下面是我的计划!
ADC16RS55V2.ZIP 251.5 K 以上来自于百度翻译 以下为原文 Hi every body! I'm doing a project with PSoC 1 CY8C24123A. Hardware: -My software on PC - COM cable - RS485 to COM circuit (have MAXIM232 (1 device)- MAXIM485(1 device)) - CY8C24123A board (have a SN75176B...). A,B signal of SN75176B conect to A,B signal MAXIM485. (I'm using RS485 standard, baudrate is 19200). -Communication between PC and CY8C24123A via UART user module, but TX and RX connect to same pin. -Pin P0.4 is TX and RX. I have to configure pin 0.4. -P0.2 control SN75176B to transmit or receive data. P0.2 = 1 transmit; P0.2 = 0 receive. Contents: - PC will send data to PSoC, after that PSoC send data to PC. -If PSoC received 3 bytes 0xAA from PC. After that PSoC send 0xAA ,0x31, 0x00 to PC. -If PSoC received 3 bytes 0xBB from PC. After that PSoC send 0xBB ,0x33, 0x00 to PC. But communication is not good. Some times, PC received data fail or receive data not truely. I think when I switch between TX and RX at the same pin not well! Can you tell me solutions to solve that problem? Many thanks. Below is my project!
|
|
相关推荐
4个回答
|
|
你必须考虑一个要发送的字节将首先从FIFO缓冲器中删除(然后是空的),然后放入TX寄存器中,它现在不是空的。在切换到接收模式之前,必须等待传输完成。
鲍勃 以上来自于百度翻译 以下为原文 You have to consider that a byte to send will first be removed from the FIFO-buffer (which is empty then) and put into the TX-register which is not empty now. You have to wait until the transmission is done before switching to receive mode. Bob |
|
|
|
嗨,鲍伯,
你有没有告诉我“ValueSunDATAQAR(无符号CHAR CDATA)”? 我修改了: 无符号char数据 { 而(!)(UARTHULSTTXXSTATUS(和);UARTHARTXBAUBELSIOL空)){} UTARTH PUCHCHAR(CDATA); 而(!)(UARTHULSTOTXSTATUS(和)和UARTHARTXIOFFULT){} } 另外,您能检查Stup04totx(空隙)、空隙SETP04TROX(空隙)吗? 切换模式后,需要延时吗? 多谢! 以上来自于百度翻译 以下为原文 Hi Bob, Did you tell me about "void SendDataChar(unsigned char cData)"? I modified: void SendDataChar(unsigned char cData) { while(!(UART_bReadTxStatus()&UART_TX_BUFFER_EMPTY)){} UART_PutChar(cData); while(!(UART_bReadTxStatus()&UART_TX_COMPLETE)){} } Further more, can you check void SetP04ToTX(void), void SetP04ToRX(void), please? After switching mode, need time delay? Many thanks! |
|
|
|
没有延迟的销模式切换后,你只需要相信,其实是没有传输运行,你将中止通过重新编程的IO引脚。
我dubuous大约是事实,你不能够告诉你错过了一个字符,你是否想到现在的第三秒等待3相似的特征(或第一)。当你有影响力的协议,我建议把导入字符(不是一个很好的候选人)得到一个消息的开始。 鲍勃 以上来自于百度翻译 以下为原文 There is no delay needed after switching the pin modes, you only have to be sure that there is actually no transmission running that you will abort by reprogramming the IO-pin. What I am dubuous about is the fact, that you wait for 3 similar characters so that you are not able to tell when you missed one char whether you expect now the second to the third (or the first). When you have influence on the protocol I would suggest to send a lead-in character (SOT is a good candidate) to get the begin of a message. Bob |
|
|
|
|
|
|
|
只有小组成员才能发言,加入小组>>
754个成员聚集在这个小组
加入小组2106 浏览 1 评论
1853 浏览 1 评论
3671 浏览 1 评论
请问可以直接使用来自FX2LP固件的端点向主机FIFO写入数据吗?
1788 浏览 6 评论
1536 浏览 1 评论
CY8C4025LQI在程序中调用函数,通过示波器观察SCL引脚波形,无法将pin0.4(SCL)下拉是什么原因导致?
572浏览 2评论
CYUSB3065焊接到USB3.0 TYPE-B口的焊接触点就无法使用是什么原因导致的?
424浏览 2评论
CX3连接Camera修改分辨率之后,播放器无法播出camera的画面怎么解决?
438浏览 2评论
386浏览 2评论
使用stm32+cyw43438 wifi驱动whd,WHD驱动固件加载失败的原因?
916浏览 2评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-25 10:23 , Processed in 0.898977 second(s), Total 51, Slave 46 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号