完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
您好,我有一个现有的硬件依赖于引脚26(RB5)是一个可读的输入。它与T3CKI共享,这是默认的28针设备。问题是,如何重新配置它成为一个输入?没有寄存器来禁用定时器3,在T3CON中设置SOSCEN=1也不起作用。我还是看不懂这一点——PORTB的所有其他部分都很好。谢谢,克里斯。
以上来自于百度翻译 以下为原文 Hello, I have an existing hardware that relies on pin 26 (RB5) being a readable input. It is shared with T3CKI which is the default for 28-pin devices. The question is, how to reconfigure it to become an input? There is no register to disable timer 3, and setting SOSCEN=1 in T3CON didn't do the trick either. I still can't read this bit - all other bits in PORTB work fine. Thanks, Chris |
|
相关推荐
15个回答
|
|
将PIN设置为输入模式。使用RB5用于定时器输入(或不)对读针上输入电平的能力没有影响。如果使用CCP5,但不需要CCP输出,那么设置RB5的TIS位应将其置于输入模式中。如果没有使用CCP5,那么它不应该干扰读取PIN。如果这些模块中的任何一个重新启用并被配置为使用RB5,那么读取该引脚可能影响模块操作,但不应阻止读取引脚电平。您使用什么代码来读取PIN值,以及如何观察该值?
以上来自于百度翻译 以下为原文 TRISBbits.TRISB5 = 1; That sets the pin to input mode. Using RB5 for timer input (or not) should have no effect on the ability to read the input level on the pin. IF CCP5 is used but the ccp output is not needed then setting the TRIS bit for RB5 should put it in input mode regardless. If the CCP5 is not used then it should not interfere with reading the pin. IF any of these modules a re enabled and are configured to use RB5 then reading this pin may affect the module operation but should not prevent the reading of the pin level. What code are you using to read the pin value and how do you observe this value? |
|
|
|
这也是我的想法,但它根本不适用于这个别针。我使用下面的代码:TrISBITS.TrISB5=1;如果(PoBBITS.RB5==1){……位总是被读取为0,并且条件代码不执行,这与调试器中的SFR窗口所显示的相匹配。我可以测量外部引脚上的5V -那里有一个上拉电阻和一个光输入,但没有连接到那个,所以它不拉低。同样,相同类型的代码至少适用于RB0、RB1和RB4,而不是RB5。
以上来自于百度翻译 以下为原文 That's what I thought, too, but it simply doesn't work for this pin. I am using the following code: TRISBbits.TRISB5 = 1; if (PORTBbits.RB5 == 1) { ... The bit is read as 0 always and the conditional code doesn't execute, which matches with what the SFR window in the debugger shows. I can measure 5V on the external pin - there is a pull-up resistor there and an opto-input but nothing is connected to that one so it doesn't pull low. Again, the same type of code works for at least RB0, RB1 and RB4, but not RB5. |
|
|
|
|
|
|
|
|
|
|
|
现在也许是时候用Microchip启动支持票了。
以上来自于百度翻译 以下为原文 It may be time to start a support ticket with Microchip..... |
|
|
|
我不需要RTFM,但我下载了它,并简要地看了一下,试图帮助你。我现在读得稍微多了一些,你在第1章中提到的关于Time3的错误是错误的。我这里没有一个真正的18F26K80芯片,但我在MPLAB已经模拟过了,RB5和Simulas一样工作。
以上来自于百度翻译 以下为原文 I don't have to RTFM but I did download it and looked over it briefly trying to help you out. I read it a little bit more now and what you stated in Post #1 regarding Timer3 is wrong. I don't have a real 18F26K80 chip here but I've simulated it in MPLAB and RB5 works as expected with the simulus. I'm outta here. |
|
|
|
我不需要RTFM,但我下载了它,并简要地看了一下,试图帮助你。我现在读得稍微多了一些,你在第1章中提到的关于Time3的错误是错误的。我这里没有一个真正的18F26K80芯片,但我在MPLAB已经模拟过了,RB5就像Simulas一样工作。我在这里。“我在Time3的第1版中所说的是错误的”——不这么认为。模拟并没有真正帮助,我想我们已经确定了它应该工作。而且,你知道RTFM是什么意思,不是吗?它基本上说“先问自己”,这是我在你指责我的时候做的。把RTFM删掉,你的回答会像我的问题一样礼貌。
以上来自于百度翻译 以下为原文 I don't have to RTFM but I did download it and looked over it briefly trying to help you out. I read it a little bit more now and what you stated in Post #1 regarding Timer3 is wrong. I don't have a real 18F26K80 chip here but I've simulated it in MPLAB and RB5 works as expected with the simulus. I'm outta here. "What I stated in Post #1 regarding Timer3 is wrong" - don't think so - anything more specific? Simulation is not really helping, I think we have already established that it *should* work. Also, you know what RTFM means, don't you? It basically says "educate yourself before asking", which is what I did while you accused me otherwise. Leave out the RTFM and your answer would have been just as polite as my question was. |
|
|
|
所有与RB5相关的函数在默认情况下都被禁用。如果有一些关于RB5(只有RB5)的松动的东西,我认为它可能是某种硬件问题。这个小程序如前面的注释所示工作。在我的PIC18F26K80电路板上使用XC8版本1进行测试。41。(我不会浪费一分钟用FurChutiNER模拟器来测试硬件。)不是我的东西,也不是别人的东西。时期。同样,我从来没有开始任何项目,无论大小,直到我捏造了一个测试计划,不涉及单步与皮卡3(或任何),并希望我能弄清楚(或不是)井手告诉我真相。问候,戴夫
以上来自于百度翻译 以下为原文 All of those functions associated with RB5 are disabled by default. If there is something squirrelly about RB5 (and only RB5), I'm thinking it might a hardware problem of some sort. This little program works as indicated in the leading comments. Tested on my PIC18F26K80 breadboard using XC8 version 1.41. (I won't waste a single minute with the furchlugginer simulator for testing hardware. Not for my stuff or anyone else's stuff. Period. Full stop.) Also, I never start any project, large or small, until I have concocted a test plan that does NOT involve single-stepping with a PICkit 3 (or whatever) and hoping that I can figure out whether (or not) the IDE is telling me the truth. // LEDs on pins 27 and 28 (RB6 and RB7) // Switch on pin 25 (RB5) // // LED1 blinks 1 second_on / 1 second_off // LED2 follows the Switch // // XC8 version 1.41 in "Free" mode // davekw7x // April, 2017 // // PIC18F26K80 Configuration Bit Settings // 'C' source line config statements // CONFIG1L #pragma config RETEN = OFF // VREG Sleep Enable bit (Ultra low-power regulator is Disabled (Controlled by REGSLP bit)) #pragma config INTOSCSEL = HIGH // LF-INTOSC Low-power Enable bit (LF-INTOSC in High-power mode during Sleep) #pragma config SOSCSEL = DIG // SOSC Power Selection and mode Configuration bits (Digital (SCLKI) mode) #pragma config XINST = OFF // Extended Instruction Set (Disabled) // CONFIG1H #pragma config FOSC = INTIO2 // Oscillator (Internal RC oscillator) #pragma config PLLCFG = ON // PLL x4 Enable bit (Enabled) #pragma config FCMEN = ON // Fail-Safe Clock Monitor (Enabled) #pragma config IESO = ON // Internal External Oscillator Switch Over Mode (Enabled) // CONFIG2L #pragma config PWRTEN = ON // Power Up Timer (Enabled) #pragma config BOREN = SBORDIS // Brown Out Detect (Enabled in hardware, SBOREN disabled) #pragma config BORV = 3 // Brown-out Reset Voltage bits (1.8V) #pragma config BORPWR = ZPBORMV // BORMV Power level (ZPBORMV instead of BORMV is selected) // CONFIG2H #pragma config WDTEN = SWDTDIS // Watchdog Timer (WDT enabled in hardware; SWDTEN bit disabled) #pragma config WDTPS = 1048576 // Watchdog Postscaler (1:1048576) // CONFIG3H #pragma config CANMX = PORTB // ECAN Mux bit (ECAN TX and RX pins are located on RB2 and RB3, respectively) #pragma config MSSPMSK = MSK7 // MSSP address masking (7 Bit address masking mode) #pragma config MCLRE = ON // Master Clear Enable (MCLR Enabled, RE3 Disabled) // CONFIG4L #pragma config STVREN = ON // Stack Overflow Reset (Enabled) #pragma config BBSIZ = BB2K // Boot Block Size (2K word Boot Block size) // CONFIG5L #pragma config CP0 = OFF // Code Protect 00800-03FFF (Disabled) #pragma config CP1 = OFF // Code Protect 04000-07FFF (Disabled) #pragma config CP2 = OFF // Code Protect 08000-0BFFF (Disabled) #pragma config CP3 = OFF // Code Protect 0C000-0FFFF (Disabled) // CONFIG5H #pragma config CPB = OFF // Code Protect Boot (Disabled) #pragma config CPD = OFF // Data EE Read Protect (Disabled) // CONFIG6L #pragma config WRT0 = OFF // Table Write Protect 00800-03FFF (Disabled) #pragma config WRT1 = OFF // Table Write Protect 04000-07FFF (Disabled) #pragma config WRT2 = OFF // Table Write Protect 08000-0BFFF (Disabled) #pragma config WRT3 = OFF // Table Write Protect 0C000-0FFFF (Disabled) // CONFIG6H #pragma config WRTC = OFF // Config. Write Protect (Disabled) #pragma config WRTB = OFF // Table Write Protect Boot (Disabled) #pragma config WRTD = OFF // Data EE Write Protect (Disabled) // CONFIG7L #pragma config EBTR0 = OFF // Table Read Protect 00800-03FFF (Disabled) #pragma config EBTR1 = OFF // Table Read Protect 04000-07FFF (Disabled) #pragma config EBTR2 = OFF // Table Read Protect 08000-0BFFF (Disabled) #pragma config EBTR3 = OFF // Table Read Protect 0C000-0FFFF (Disabled) // CONFIG7H #pragma config EBTRB = OFF // Table Read Protect Boot (Disabled) // #pragma config statements should precede project file includes. // Use project enums instead of #define for ON and OFF. #include #define _XTAL_FREQ 64000000UL #define LED1 LATBbits.LATB6 #define LED1_TRIS TRISBbits.TRISB6 #define LED2 LATBbits.LATB7 #define LED2_TRIS TRISBbits.TRISB7 // RB5 is digital: No ANSEL bit for this one. Tris bit is 1 upon power-up #define SW1 PORTBbits.RB5 void main(void) { LED1 = 0; LED2 = 0; LED1_TRIS = 0; LED2_TRIS = 0; // Set 16 MHz internal oscillator OSCCONbits.IRCF = 0b111; // x4 PLL gives Fosc = 64 MHz; 16 MIPS // Make sure it's on. OSCTUNEbits.PLLEN = 1; // LED1 blinks 1 second on / 1 second off // LED2 follows the Switch while (1) { LED1 ^= 1; LED2 = SW1; __delay_ms(1000); } } Regards, Dave |
|
|
|
正如我之前说过的,RB5与T0CKI、T3CKI和CCP5共享。再次阅读该手册的内容如下:禁用Time3,将TMR3ON位清除为“0”,这是默认的。默认情况下,TIME0是由T0CKI引脚的时钟输入启用的。所以,尝试改变T0CS位到内部时钟…编辑和GT;和/或禁用TMRE0与TMR0on位。当手册中的所有东西都用完了,那么它可能是一个硬件问题,比如坏的PIN。
以上来自于百度翻译 以下为原文 As I've said earlier, RB5 is shared with T0CKI, T3CKI, and CCP5. Reading The Fine Manual again here reveals the followings: To disable Timer3, clear the TMR3ON bit to "0" which is the default. By default, Timer0 is enabled with clock input from the T0CKI pin. So, try changing the T0CS bit to internal clock ... When everything in the manual is exhausted, then it might be a hardware problem such as a bad pin. |
|
|
|
我不需要RTFM,但我下载了它,并简要地看了一下,试图帮助你。我现在读得稍微多了一些,你在第1章中提到的关于Time3的错误是错误的。我这里没有一个真正的18F26K80芯片,但我在MPLAB已经模拟过了,RB5就像Simulas一样工作。我在这里。“我在Time3的第1版中所说的是错误的”——不这么认为。模拟并没有真正帮助,我想我们已经确定了它应该工作。而且,你知道RTFM是什么意思,不是吗?它基本上说“先问自己”,这是我在你指责我的时候做的。离开RTFM,你的回答会像我的问题一样有礼貌。论坛中的哪些问题可以通过仔细阅读数据表和勘误表来解决?有多少张新海报?他们的技术水平如何?你的是什么?这个线程中的任何人都会知道你是否先进行RTFM?它基本上说“先问自己”。不,它说为什么你会让一个陌生人为你读几百页的数据表,并期望他们去做?
以上来自于百度翻译 以下为原文 I don't have to RTFM but I did download it and looked over it briefly trying to help you out. I read it a little bit more now and what you stated in Post #1 regarding Timer3 is wrong. I don't have a real 18F26K80 chip here but I've simulated it in MPLAB and RB5 works as expected with the simulus. I'm outta here. "What I stated in Post #1 regarding Timer3 is wrong" - don't think so - anything more specific? Simulation is not really helping, I think we have already established that it *should* work. Also, you know what RTFM means, don't you? It basically says "educate yourself before asking", which is what I did while you accused me otherwise. Leave out the RTFM and your answer would have been just as polite as my question was. What percent of the Problems in the Forum can be solved by a careful reading of the Data sheet and Errata? How many new Posters Do? What are their skill level? What is Yours? How would anyone in this thread know if you RTFM first? It basically says "educate yourself before asking". No, It says that why would you ask a stranger to read a several hundred page data sheet for you, and expect them to do it? |
|
|
|
他们不会,但你怎么能认为我没有?认为其他人都是懒洋洋的,这是不礼貌的,因为违反了发布准则。这就是“你读过手册”的区别吗?扔出“阅读手册”!同样,假设OP太懒以至于无法研究数据表,并且在第一个响应中抛出RTFMS至少是不礼貌的。你的观点是空洞的。
以上来自于百度翻译 以下为原文 They wouldn't, but how can you assume I didn't? It's impolite to assume everyone else is lazy right off the bat, and as such in violation of the posting guidelines. It's exactly the difference between asking "Did you read the manual [here and there]?" and throwing out "Read the f***** manual!". Again, assuming that an OP is just too lazy to study the data sheet and throwing RTFMs in the first response is - at the very least - impolite. Your point is void. |
|
|
|
RB5与T0CKI、T3CKI和CCP5共享。你原来的帖子没有提到T0CKI,CCP5,TrISB等。你的帖子只指出“没有注册禁用定时器3,设置SoSoCon=1在T3CON没有做的伎俩”,当事实上,它可以禁用在同一个T3CON RealSt.RTFM位。有些人对这样的回答感到不安。我没有说这是粗鲁的,那个缩写词有不同的缩写。我自己也这么说,因为我已经做了这么多,打开手册或数据表是本能的,尤其是在嵌入式编程和工程。因此,如果我告诉某人RTFM(我可能是)是不礼貌的,那是因为在论坛中张贴的大部分问题可以通过阅读数据表而不是在这里发布的时间来轻松解决。函数小心地显示,*不与RB5共享的所有函数在默认情况下被禁用,并给出要检查的事物的列表:*可以影响RB5的配置位,*Time3可以被禁用,* Time0**是启用的,并且使用RB5/T0CKI引脚,因此这可能影响读RB5,*等RTFM是一个。最有帮助的轻蔑建议在那里,我不会在接收端冒犯,因为我经常从中学习到更多。如果有人接受这种类型的回答那么糟糕…我们在这里看到太多礼貌的回答被忽略了。
以上来自于百度翻译 以下为原文 RB5 is shared with T0CKI, T3CKI, and CCP5. Your original post makes no mention of T0CKI, CCP5, TRISB, etc. Your post states only that there is "no register to disable timer 3, and setting SOSCEN=1 in T3CON didn't do the trick" when in fact it can be disabled with a bit in the same T3CON register. RTFM. Some people get upset by such a reply. I did not say it to be rude, that acronym has different abbreviations. I say it to myself too as I've done it so much that opening a manual or datasheet is instinctive, especially in embedded programming and engineering. So if I seem impolite telling someone to RTFM (and I might be) it's because there is a large percentage of the problems posted in the forum can be easily solved by reading the datasheet and in less time than to post it here. In this case, reading just the sections in the datasheet of the associated functions carefully will reveal that *NOT* all functions shared with RB5 are disabled by default and give a list of things to check: * configuration bits that can affect RB5, * Timer3 can be disabled, * Timer0 *IS* enabled and uses the RB5/T0CKI pin, so this might affect reading RB5, * etc. RTFM is one of the most helpful despised advices out there, and I will not take offense when on the receiving end as often I learn more from it. If someone takes this type of reply badly then so be it ... we have seen too many polite replies being ignored all the time here. |
|
|
|
我对他的想法感到好奇:任何人可以确认/测试这一点,使RB5作为输入信号到Time0会干扰读取引脚上的电平的能力吗?我从来没有在其他图片上看到过(我没有18F26K80),我有很多这样做的应用程序(所有都在非K-18F图片上)。
以上来自于百度翻译 以下为原文 I am curious about his idea: can anyone confirm/test this, that enabling RB5 to act as the input signal to timer0 will interfere with the ability to read the level on the pin? I have never seen this on other pics (I do not have a 18F26K80), I have a number of applications that do this (all on non-K 18F pics). |
|
|
|
我也是。典型地,与端口引脚复用的外围功能具有比输出引脚更高的优先级,并且模拟功能比输入引脚具有优先级。这是一个测试和确认的项目。
以上来自于百度翻译 以下为原文 Me too. Typically peripheral functions multiplexed with a port pin have higher priority than an output pin, and analog functions have priority over input pins. This is one item to test and confirm. |
|
|
|
有很多海报不读数据表,我相信大多数人都这么做。大部分的“我有一个莫名其妙的问题”都是由代码中的错误或图解引起的,实际上是通过一些神秘的方式来解决的,比如“哦,我忘了打开电源”之类的。当然,从几千英里以外的人看不到这一点。我自己的99%个问题来自愚蠢的错误,比如缺少逗号,不好的焊接等等。但我已经知道了。
以上来自于百度翻译 以下为原文 There are many posters who don't read the datasheet, but I believe most of them do. Most of the "I have an inexplicable problem" posts are caused by bugs in the code or in schematics and actually get resolved by some mysterious ways, such as "Oh, I forgot to turn on the power" or alike. Of course, people from thousands if miles away couldn't see that. 99% of my own problems come from silly mistakes, such as missing comma, bad soldering etc ... But I know that already. |
|
|
|
只有小组成员才能发言,加入小组>>
5159 浏览 9 评论
1998 浏览 8 评论
1927 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3170 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2223 浏览 5 评论
724浏览 1评论
610浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
499浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
623浏览 0评论
522浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-20 13:39 , Processed in 1.544454 second(s), Total 108, Slave 91 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号