完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
扫一扫,分享给好友
大家早上好!一个我无法回答的问题——使用MpTaRead BITSH()来读取这个特定设备上的RA04(512L变型)只有当我要求它这样做时才起作用:-我不明白为什么RA04是用比特16读取的,并且当电压[2.5V在这个情况下(3V3具有1K下拉)]在2.5V时为什么会出现160当电压在0V时,我希望看到一个逻辑电平。至少这是可重复的,而且我也要这么做,我无法理解为什么RA04在波尔塔上注册为位16,顺便说一下,我确实设置了TrISA位,以便RA04(5位我认为是输入IE,1)。星期五!谢谢你,马修
以上来自于百度翻译 以下为原文 Good morning people! A question that I can't answer - using mPORTAReadBits() to read RA04 on this particular device [the 512L variant] only works IF I ask it to do this:- if (mPORTAReadBits(16) == 16){ // Report to System structure that safety switch is active sSwitch = 1; }else{ sSwicth = 0; } I don't understand why RA04 is read using bit 16, and why it yeilds 16 when the voltage [2.5V in this case (3v3 with a 1k pull down)] is at 2.5V, and 0 when the voltage is at 0V, I was expecting to see a logic level.. At least this is repeatable and does what I ask it too, I just can't fathom out why RA04 registers as bit 16 on PORTA, incidentally, I do have the TRISA bits set up so that RA04 (bit 5 I think is set up as in input ie, 1). Baffled for a Friday! Thank you, Matthew |
|
相关推荐
3个回答
|
|
因为参数是一个掩码值。16=0x00,这是位4。/ Ruben
以上来自于百度翻译 以下为原文 Because the argument is a mask value. 16=0x0010 which is bit 4. /Ruben |
|
|
|
哎呀,我从来没有注意到-现在完全明显!我不是这样做的,而是在做一件事:谢谢你,Ruben!
以上来自于百度翻译 以下为原文 Oops, I never even noticed that - totally obvious now! Rather than going through a macro, I am now doing this:- if((PORTA & 0x10) == 0x10){ //Do something }else{ //DO something else } Works a treat. Thanks Ruben! |
|
|
|
|
|
|
|
只有小组成员才能发言,加入小组>>
4849 浏览 9 评论
1847 浏览 8 评论
1773 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
2975 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2076 浏览 5 评论
474浏览 1评论
320浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
379浏览 0评论
271浏览 0评论
LAN9252使用SQI通信,进行数字复位后读BYTE_TEST异常
1828浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-5-21 16:16 , Processed in 0.959187 second(s), Total 80, Slave 64 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号