完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
电子发烧友论坛|
你好。希望有人能帮帮忙吗?为了准备使用18F46J50进行一些开发,有必要使用端口RA0、RA1、RA2和RA3进行纯数字输出。RA0和RA3的作用是预期的,并输出健康的3.3V输出。另一方面,RA1和RA2不守规矩。单独振荡它们会导致1V左右的不良数字输出。如果我将它们一起振荡,那么我得到一个健康的3.3V数字输出。很显然,我做错了什么,并且已经多次读取了数据表。我相信我的模拟设置是正确配置端口的数字,而不是模拟操作。我曾怀疑过比较器,但是想不出还有什么可以改变的。我创建了一个非常简单的程序来振荡端口A引脚(通过不注释该行)来测试各种配置。使用:PIC18F46J50全速USB显示板MPLAB-X 3.51 XC8(V1.38和V1.40)罗德&施瓦茨HMO2024四通道TopeSchAN你看。
以上来自于百度翻译 以下为原文 Hello. I hope someone can please help? Getting ready for some development using the 18F46J50, it became necessary to use ports RA0, RA1, RA2 and RA3 for pure digital output. RA0 and RA3 act as expected and output a healthy ~3.3V output. On the other hand, RA1 and RA2 mi***ehave. Oscillating them independently results in a poor digital output of around 1V. If I oscillate them in unison then I get a healthy 3.3V digital output. Clearly I am doing something wrong and have read the datasheet many times. I believe that my Analogue settings are correctly configuring the ports for digital, rather than analogue operation. I have suspected the Comparator but can't think of anything more that I can change in my configuration that suggests a fix. I created a very simple program to oscillate Port-A pins (by un-commenting the line) to test various configurations. Using: PIC18F46J50 Full-Speed USB Demonstration Board MPLAB-X 3.51 XC8 (v1.38 and v1.40) Rhode & Schwarz HMO2024 4-channel scope Thank you for looking. /******************************************************************** * Project: PORTA_Test1 * Module: main.c * Created: 01Feb17 *******************************************************************/ #include #include /******************************************************************** * MAIN - CONFIGURATION ******************************************************************** * Minimal configuration for 8 MHz using internal OSC */ #pragma config OSC = INTOSCPLL //Internal OSC with PLL #pragma config PLLDIV = 2 //Divide by 2 (internal 8MHz input) #pragma config CPUDIV = OSC1 //No CPU system clock divide /******************************************************************** * MAIN *******************************************************************/ void main(void) { LATEbits.LATE0 = 1; LATEbits.LATE1 = 1; TRISEbits.TRISE0 = 1; //LED0 TRISEbits.TRISE1 = 0; //LED1 /**************************************************************** * PORTA **************************************************************** * RA0/AN0/C1INA/ULPWU/PMA6/RP0 (ICE #42) * RA1/AN1/C2INA/PMA7/RP1 (ICE #41) * RA2/AN2/Vref-/CVref/C2INB (ICE #40) * RA3/AN3/Vref+/C1INB (ICE #39) */ #define DEFINE_CONFIGURATOR #ifdef DEFINE_CONFIGURATOR CM1CONbits.CON = 0; //Disable comparator #1 CM1CONbits.COE = 0; CM1CONbits.CREF = 1; //Connect non-inverting output to CVref not C1INA CM1CONbits.CCH1 = 1; //Connect input to Virv not C1INB CM1CONbits.CCH0 = 1; CM2CONbits.CON = 0; //Disable comparator #2 CM2CONbits.COE = 0; CM2CONbits.CREF = 1; //Connect non-inverting output to CVref CM2CONbits.CCH1 = 1; //Connect input to Virv not C2INB CM2CONbits.CCH0 = 1; #endif CVRCONbits.CVREN = 0; CVRCONbits.CVROE = 0; //AD settings ADCON0bits.VCFG1 = 0; //Voltage ref uses AVxx not Vref-/AN2 ADCON0bits.VCFG0 = 0; //Voltage ref uses AVDD not Vref+/AN3 ANCON0bits.PCFG0 = 1; //RA0 = digital ANCON0bits.PCFG1 = 1; //RA1 = digital ANCON0bits.PCFG2 = 1; //RA2 = digital ANCON0bits.PCFG3 = 1; //RA3 = digital LATAbits.LA0 = 0; LATAbits.LA1 = 0; LATAbits.LA2 = 0; LATAbits.LA3 = 0; TRISAbits.TRISA0 = 0; TRISAbits.TRISA1 = 0; TRISAbits.TRISA2 = 0; TRISAbits.TRISA3 = 0; /**************************************************************** * MAIN LOOP **************************************************************** * RA0 produces good 3.3v square wave * RA1 produces ~500mv output on RA1 and RA2 * RA2 produces ~100mv output on RA1 and RA2 * RA3 produces good 3.3v square wave * */ while(1) { for(unsigned char i = 0; i < 255; i++); LATAbits.LA0 = ~LATAbits.LA0; //YEL // LATAbits.LA1 = ~LATAbits.LA1; //BLU // LATAbits.LA2 = ~LATAbits.LA2; //VIO LATAbits.LA3 = ~LATAbits.LA3; //GRN } } /* Main */ /* End */ |
|
相关推荐
12个回答
|
|
|
听起来像两个引脚之间的短(也许部分)?
以上来自于百度翻译 以下为原文 Sounds like a short (maybe partial) between the two pins? |
|
|
|
|
|
嗯,事实证明你是对的。谢谢你,杰克,但这引起了更多的问题。我有错误的董事会吗?微芯片打算RA1和RA2连接吗?如果是,那么为什么和为什么在文档模式中没有描述?HTTP:/WW1.MICCHIP.COM/DeLoSt/En/DeVICEDC/OC51806B.PDF
以上来自于百度翻译 以下为原文 Well, it turns out that you are correct. Thank you Jack. But that raises more questions. Do I have a faulty board? Did Microchip intend for RA1 and RA2 to be connected? If so then why and why is it not depicted in the documentation schema? http://ww1.microchip.com/downloads/en/DeviceDoc/51806b.pdf |
|
|
|
|
|
看一下Biad。如果它是这样路由的,可能是。如果它是焊桥或其他“事件”,那么最好。
以上来自于百度翻译 以下为原文 Hi Take a look at the biard. If its routed that way, probably yes. If its a solder bridge or some other "incident" then no. Best regards Jorge |
|
|
|
|
|
我没有看到任何DEV板上的示意图,表明RA1和RA2是或应该连接在一起,然而RA1在两个不同的名称(RA1和RC4IICE)的引脚上连接到ICE报头。
以上来自于百度翻译 以下为原文 I do not see anything on the schematic of the dev board that indicates RA1 and RA2 are or should be connected together, however RA1 is connected to the ICE header at two pins with different names (RA1 & RC4_ICE). |
|
|
|
|
|
HII也注意到,“短”可能不在这个(USB)板上,但是在其他一些板上,它可能被连接到。
以上来自于百度翻译 以下为原文 Hi I noticed that too, maybe the "short" is not on this (USB) board, but on some other it may be connected to. Best regards Jorge |
|
|
|
|
|
也许这个示意图有助于:你在板的底部使用冰连接器吗?还有其他的连接板吗?
以上来自于百度翻译 以下为原文 Maybe this note from the schematic helps: Are you using the ICE connectors on the bottom of the board? Any other board connected there? |
|
|
|
|
|
谢谢豪尔赫。我仔细检查了电路板,没有明显的焊料桥。更重要的是,我看不到RA2的路由,所以它必须是一个四层的板。在这种情况下,只有微芯片可以确认,因为它们似乎没有发布完整的模式或GeBER文件。
以上来自于百度翻译 以下为原文 Thanks Jorge. I have closely examined the board and there are no visible solder bridges. More to the point I cannot see the routing of RA2 so it must be a four-layer board. In which case only Microchip can confirm since they do not appear to have released a full schema or gerber files. J |
|
|
|
|
|
我使用的董事会孤立,没有额外的设备连接到董事会。该板由5V电源供电至JP3(馈送TC108~33 VDB)。正如您所指出的,RA1(引脚×41)连接到RC4IICE(引脚×47)。我知道这一点。即使没有连接到全速USB演示板,我也能检测到18F46J50J之间的引脚20和21之间的短路。
以上来自于百度翻译 以下为原文 I am using the board in isolation and there are no additional devices connected to the board. The board is powered by a 5V supply to JP3 (feeding the TC1108-33VDB). As you point out, RA1 (pin #41) is connected to RC4_ICE (pin #47). I am aware this. Even with nothing connected to the Full-Speed USB demo board, I can detect a short between pins #20 and #21 of the 18F46J50. J |
|
|
|
|
|
这不是问题的起因,只是一个注释。这条线是完全不必要的:γ包含和pIC18f46j50.h & gt;该文件已经被xc.h包含,所以你正在做第二次。
以上来自于百度翻译 以下为原文 This is not the cause of your problem at all, but just a note. This line is totally unnecessary: #include that file has already been included by xc.h, so you are doing it for a second time. |
|
|
|
|
|
HII注意到这个板(MA18024)是我的一个兄弟姐妹(MA18021),可能是一个较新的版本。以防万一,我会尝试检查我是否也有这个“短”。
以上来自于百度翻译 以下为原文 Hi I noticed that this board (MA180024) its a sibling of one I have (MA180021), probably a newer version. Just in case I'll try to check if I also have that "short". Best regards Jorge |
|
|
|
|
|
从我在文档中看到的,它是董事会的“完整的示意图”。
以上来自于百度翻译 以下为原文 From what I see in the documentation it is a "full schematic" of the board. |
|
|
|
|
|
我检查了法纳尔技术支持。他们告诉我他们联系了微芯片,声称板不应该有RA1和RA2之间的短路。我想我有一个有缺陷的板,所以我们应该能够关闭这个线程。谢谢大家。
以上来自于百度翻译 以下为原文 I checked with Farnell technical support. They tell me that they contacted Microchip who claim that the board is not supposed to have a short between RA1 and RA2. I suppose I have a defective board, so we should be able to close this thread. Thank you to everyone. |
|
|
|
|
只有小组成员才能发言,加入小组>>
MPLAB X IDE V6.25版本怎么对bootloader和应用程序进行烧录
483 浏览 0 评论
5804 浏览 9 评论
2344 浏览 8 评论
2233 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3538 浏览 3 评论
1143浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
1114浏览 1评论
我是Microchip 的代理商,有PIC16F1829T-I/SS 技术问题可以咨询我,微信:A-chip-Ti
882浏览 1评论
MPLAB X IDE V6.25版本怎么对bootloader和应用程序进行烧录
485浏览 0评论
/9
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-12-8 09:33 , Processed in 0.945340 second(s), Total 66, Slave 59 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
1257