完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
我需要一个繁忙的状态线在我的RS485通讯。使用16F86I有RB1可供使用。由于从主人到奴隶的距离,我想我需要在我繁忙的线路上拉上一个电阻器。我想我知道这应该如何工作,但我错了。ANSEL=0ANSELH=0PORTB= 0TrISB= 010K拉到5VMy意图是通过从0到1的切换tiSISB 1从繁忙线从高到低。然而,当TrISB=1=1时,RB1是高的,并且TrISB=1=0,RB1正在拉低线。我的理解是,用TrISB输出,RB1=0将不能下沉。但这正是正在发生的事情。有人能给我解释一下吗?谢谢
以上来自于百度翻译 以下为原文 I need a BUSY Status line on my RS485 comm. Using a 16f886 I have RB1 available for use. Because of distance from Master to Slave I think I need a pullup resistor on my BUSY line. I thought I knew how this should work but I am mistaken. ANSEL =0 ANSELH=0 PORTB=0 TRISB=0 10k pullup to 5v My intent was to go from high to low on the BUSY line by the Toggling TRISB.1 from 0 to 1. However With TRISB.1=1, RB1 is high and with TRISB.1=0, RB1 is pulling the line low. My understanding was that with TRISB an Output, RB1=0 would NOT be able to sink. But that is exactly what is happening. Can someone explain this to me? Thanks |
|
相关推荐
6个回答
|
|
当你设置TrISB 1=0时,你将PIN作为输出。它将根据Pt.B.Bo.1otoh的状态下沉(0)或源电流(1),如果你用TISISB 1=1的输入,PIN将具有高阻抗状态,不会下沉或产生任何电流。
以上来自于百度翻译 以下为原文 Hi Whenever you set TRISB.1 = 0, you make the pin an output. It will sink (0) or source current (1) depending on the state of PORTB.1 OTOH if you make it an input with TRISB.1 = 1, the pin will have an high impedance state not sinking or sourcing any current. HIH Best reagrds Jorge |
|
|
|
豪尔赫,现在我明白了,“TrISB. 1=1……没有沉没或采购任何电流”,这才是关键。如果数据表这么简单,数据表就更容易理解了。谢谢,谢谢。
以上来自于百度翻译 以下为原文 Jorge, Now I understand, "TRISB.1 = 1......NOT sinking or sourcing any current", that was the key. The datasheets would be more understandable if they made the case in such simple terms. Thank you, Thank you |
|
|
|
如果你在没有先入之见的情况下阅读数据表,那么TrISB和PUTB的工作原理就很清楚了。TrISB中的“0”使PIN成为输出,“1”使它成为一个输入,所以如果你想把一个PIN高和低地切换,就把它变成一个输出,只需旋转PUBB位(或者如果你的PIC有一个,那么LATB就可以了。PIC16F86没有。还有一个理由不使用那些古老的照片
以上来自于百度翻译 以下为原文 If you read the datasheet without preconceptions, they are very clear on how TRISB and PORTB work. A "0" in TRISB makes the pin an output, a "1" makes it an input, so if you are trying to toggle a pin high and low, make it an output, and just twiddle the PORTB bit (or LATB if your PIC had one, which a PIC16F886 does not. One more reason to NOT use those ancient PICs) |
|
|
|
我想知道OP是否混淆了使用TrISBIT来模拟开路漏极输出:PobBITS.RB1=0;TribBITS.RB1=0;输出为低TrimbBITS.RB1=1;输出为开路漏极-由扩展电阻器拉出。???
以上来自于百度翻译 以下为原文 I am wondering if the OP is confusing this with the idea of using the TRISbit to simulate an open drain output: PORTBbits.RB1 = 0; TRISBbits.RB1 = 0; output is LOW TRISBbits.RB1 = 1; output is open drain - pulled up by extenral resistor ??? |
|
|
|
你好!你可以想象PIC I/O状态,附有(非常简化的)说明。所以实际上这三个状态是(10MeGaOm欧姆电阻器只是象征性的,但可以想象类似的大小)。
以上来自于百度翻译 以下为原文 Hello! You can imagine the PIC I/O states, with attached (very simplified) illustration. So practically these three states are. (The 10Mega ohm resistor is only symbolic, but something of a similar magnitude is to be imagined). Attached Image(s) |
|
|
|
谢谢大家的宝贵意见。我的困难是理解如何读取一个PoBB板1和板B端口1。如果一个板在TrISB=0,而另一个板在TrISB=1。直到我尝试它,我不明白你不能读取一个端口在输出TrISB状态。(现在我把它看得很傻)事后我都明白了。所有板在TrISB。1=1,任何板都能读取占线的状态。读取和线路高(没有COMM)后,一个板去TISISB。1=0占用占线低。所有其他的板仍然可以读取占线状态。没有碰撞。谢谢你的所有输入。
以上来自于百度翻译 以下为原文 Thank you all for your excellent comments. My difficulty was understanding how to read Board A PortB.1 and Board B PortB.1 if one board is in TRISB=0 and the other board in TRISB=1. Until i tried it i did not understand you can't read a port in output TRISB state. (pretty dumb now that I look on it hindsight) I got it all figured out now. all boards in TRISB.1=1, any board can read status of BUSY line. After Read and line is high (no comm) one board goes TRISB.1=0 pulls BUSY line low. All other boards can still read status of BUSY line. No collisions. Thanks for all your input. |
|
|
|
只有小组成员才能发言,加入小组>>
5166 浏览 9 评论
2000 浏览 8 评论
1928 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3174 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2226 浏览 5 评论
733浏览 1评论
615浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
505浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
631浏览 0评论
528浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-24 09:30 , Processed in 1.375410 second(s), Total 91, Slave 73 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号