完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
|
比特31 BGVRRDY:带隙电压/ADC参考电压状态位1=带隙电压和ADC参考电压(VREF)准备就绪0=要么或带隙电压和ADC参考电压(VREF)都不是READYDATA处理,仅在BGVRRDY由硬件设置之后才有效,所以应用程序代码必须检查BGVRRDY位,以确保数据的有效性。当AN(ADCCON1和lt;15和gt)=0时,该位设置为“0”。除此寄存器之外,在整个数据表中找不到任何关于“带隙电压”的参考。所以我假设没有别的东西可以让我考虑到带隙基准。这样就留下了ADC参考电压。我有VREF+SET到3.2V。AVDD设置为3.3V。如果我想使用AVDD和AVSS或者1,如果我想使用VREF+和AVSF和FRU,我认为ADCCON3VREFSEL&LT 2:0&GT应该是0。我已经尝试了所有的8个数字,仍然没有得到状态位去影响什么?这是我的设置代码,扫描AN46、AN3、AN4、AN5、AN29。A/CCON2BITS.BGVRRDY);(或)等待参考电压RADYI从“23-3扫描多输入”的例子中获得了大部分,这是家庭参考手册的第22节12位高速SAR ADC。我错过了什么,或者没有设置或设置错误来保持这一点不高?基普
以上来自于百度翻译 以下为原文 bit 31 BGVRRDY: Band Gap Voltage/ADC Reference Voltage Status bit 1 = Both band gap voltage and ADC reference voltages (VREF) are ready 0 = Either or both band gap voltage and ADC reference voltages (VREF) are not ready Data processing is valid only after BGVRRDY is set by hardware, so the application code must check that the BGVRRDY bit is set to ensure data validity. This bit set to '0' when ON (ADCCON1<15>) = 0. I can not find any reference to "Band Gap Voltage" in the whole datasheet except for this register. So I am assuming there is nothing else for me to set with regards to band gap reference. So that leaves ADC Reference Voltage. I have VREF+ set to 3.2V. I have AVDD set to 3.3V. I think ADCCON3 VREFSEL <2:0> should be 0 if I want to use AVDD and AVSS or 1 if I want to use VRef+ and AVSS And in frustration I have tried all 8 numbers and still do not get the Status bit to go to 1 What else affects it? Here is my setup code to scan AN46, AN3, AN4, AN5, AN29. void InitAnalog(void) { /* Configure Analog Pins HARMony should have done it, just making sure. */ ANSELAbits.ANSA1 = 1; // RA1 AN29 PIN 38 Heater Voltage ANSELBbits.ANSB3 = 1; // RB3 AN3 Pin 22 Voltage In ANSELBbits.ANSB4 = 1; // RB4 AN4 Pin 21 PS1 ANSELBbits.ANSB6 = 1; // RB6 AN46 Pin 26 PS2 ANSELBbits.ANSB10 = 1; // RB10 AN5 Pin 34 POT ANSELAbits.ANSA10 = 1; // RA10 +Vref Pin 29 Reference voltage TRISAbits.TRISA1 = 1; // RA1 Input TRISBbits.TRISB3 = 1; // RB3 Input TRISBbits.TRISB4 = 1; // RB4 Input TRISBbits.TRISB6 = 1; // RB6 Input TRISBbits.TRISB10 = 1; // RB10 Input TRISAbits.TRISA10 = 1; // RA10 Input /* Configure ADCCON1 */ ADCCON1 = 0; // No ADCCON1 features are enabled including: Stop-in-Idle, turbo, // CVD mode, Fractional mode and scan trigger source. ADCCON1bits.SELRES = 3; // ADC7 resolution is 12 bits ADCCON1bits.STRGSRC = 1; // Select scan trigger. // ADC Calibration Data ADC0CFG = DEVADC0; ADC1CFG = DEVADC1; ADC2CFG = DEVADC2; ADC3CFG = DEVADC3; ADC4CFG = DEVADC4; ADC7CFG = DEVADC7; ADCEIEN1 = 0; // Interrupts Disabled ADCEIEN2 = 0; // Interrupts Disabled /* Configure ADCCON2 */ ADCCON2bits.SAMC = 13; // ADC7 sampling time = 5 * TAD7 ADCCON2bits.ADCDIV = 1; // ADC7 clock freq is half of control clock = TAD7 /* Initialize warm up time register */ ADCANCON = 0; ADCANCONbits.WKUPCLKCNT = 5; // Wakeup exponent = 32 * TADx /* Clock setting */ ADCCON3bits.ADCSEL = 0; // Select input clock source Peripheral Clock 100 MHz ADCCON3bits.CONCLKDIV = 1; // Control clock frequency is half of input clock 50 MHz //ADCCON3bits.VREFSEL = 0; // Select AVDD and AVSS as reference source 3.3V ADCCON3bits.VREFSEL = 1; // Select External VREF+ and AVSS as reference source 3.2V ADC0TIMEbits.ADCDIV = 1; // ADC0 clock frequency is half of control clock = TAD0 25 MHz ADC0TIMEbits.SAMC = 13; // ADC0 sampling time = 5 * TAD0 ADC0TIMEbits.SELRES = 3; // ADC0 resolution is 12 bits ADC1TIMEbits.ADCDIV = 1; // ADC1 clock frequency is half of control clock = TAD0 25 MHz ADC1TIMEbits.SAMC = 13; // ADC1 sampling time = 5 * TAD0 ADC1TIMEbits.SELRES = 3; // ADC1 resolution is 12 bits ADC3TIMEbits.ADCDIV = 1; // ADC3 clock frequency is half of control clock = TAD0 25 MHz ADC3TIMEbits.SAMC = 13; // ADC3 sampling time = 5 * TAD0 ADC3TIMEbits.SELRES = 3; // ADC3 resolution is 12 bits ADC4TIMEbits.ADCDIV = 1; // ADC4 clock frequency is half of control clock = TAD0 25 MHz ADC4TIMEbits.SAMC = 13; // ADC4 sampling time = 5 * TAD0 ADC4TIMEbits.SELRES = 3; // ADC4 resolution is 12 bits /* Select analog input for ADC modules, no presync trigger, not sync sampling */ ADCTRGMODE = 0; ADCTRGMODEbits.SH1ALT = 1; // ADC1 = AN46 /* Select ADC input mode */ ADCIMCON1 = 0; // All Unsigned Data and Single ended ADCIMCON2 = 0; // All Unsigned Data and Single ended /* Configure ADCGIRQENx */ ADCGIRQEN1 = 0; // No interrupts are used. ADCGIRQEN2 = 0; /* Configure ADCCSSx */ ADCCSS1 = 0; // Clear all bits ADCCSS2 = 0; ADCCSS1bits.CSS1 = 1; // AN46 (Class 1) set for scan ADCCSS1bits.CSS3 = 1; // AN3 (Class 1) set for scan ADCCSS1bits.CSS4 = 1; // AN4 (Class 1) set for scan ADCCSS1bits.CSS5 = 1; // AN5 (Class 1) set for scan ADCCSS1bits.CSS29 = 1; // AN29 (Class 3) set for scan /* Configure ADCCMPCONx */ ADCCMPCON1 = 0; // No digital comparators are used. Setting the ADCCMPCONx ADCCMPCON2 = 0; // register to '0' ensures that the comparator is disabled. ADCCMPCON3 = 0; // Other registers are ?don't care?. ADCCMPCON4 = 0; ADCCMPCON5 = 0; ADCCMPCON6 = 0; /* Configure ADCFLTRx */ ADCFLTR1 = 0; // No oversampling filters are used. ADCFLTR2 = 0; ADCFLTR3 = 0; ADCFLTR4 = 0; ADCFLTR5 = 0; ADCFLTR6 = 0; /* Set up the trigger sources */ ADCTRG1 = 0; ADCTRG1bits.TRGSRC1 = 3; // Set AN1 (Class 1) to trigger from scan source ADCTRG1bits.TRGSRC3 = 3; // Set AN3 (Class 1) to trigger from scan source ADCTRG2 = 0; ADCTRG2bits.TRGSRC4 = 3; // Set AN4 (Class 1) to trigger from scan source ADCTRG2bits.TRGSRC5 = 3; // Set AN5 (Class 2) to trigger from scan source ADCTRG3 = 0; // AN29 (Class 3) always uses scan trigger source /* Early interrupt */ ADCEIEN1 = 0; // No early interrupt ADCEIEN2 = 0; /* Turn the ADC on */ ADCCON1bits.ON = 1; /* Wait for voltage reference to be stable */ NOP; NOP; NOP; while(ADCCON2bits.REFFLT); // Wait if there is a fault with the reference voltage while(!ADCCON2bits.BGVRRDY); // Wait until the reference voltage is ready while(ADCCON2bits.REFFLT); // Wait if there is a fault with the reference voltage /* Enable clock to analog circuit */ ADCANCONbits.ANEN1 = 1; // Enable the clock to analog bias ADC1 ADCANCONbits.ANEN3 = 1; // Enable the clock to analog bias ADC3 ADCANCONbits.ANEN4 = 1; // Enable the clock to analog bias ADC4 ADCANCONbits.ANEN7 = 1; // Enable, ADC7 /* Wait for ADC to be ready */ while(!ADCANCONbits.WKRDY1); // Wait until ADC0 is ready while(!ADCANCONbits.WKRDY3); // Wait until ADC0 is ready while(!ADCANCONbits.WKRDY4); // Wait until ADC0 is ready while(!ADCANCONbits.WKRDY7); // Wait until ADC7 is ready /* Enable the ADC module */ ADCCON3bits.DIGEN1 = 1; // Enable ADC1 ADCCON3bits.DIGEN3 = 1; // Enable ADC3 ADCCON3bits.DIGEN4 = 1; // Enable ADC4 ADCCON3bits.DIGEN7 = 1; // Enable ADC7 } It stops forever at the line while(!ADCCON2bits.BGVRRDY); // Wait until the reference voltage is ready I took most of this from the example "22-3 Scanning Multiple Inputs" in the Section 22 12-bit High Speed SAR ADC of the family reference manual. | What am I missing or not setting or setting wrong to keep that bit from going high? Kip |
|
相关推荐
2个回答
|
|
|
情节越来越复杂。昨天的和声代码初始化了,但我不能让它运行。这就是为什么我去注册的路线。所以我切换到和声代码,它也停在这一点。今天我切换板怀疑我是否有一个HW问题,我仍然有错误。我想现在我必须回到另一个板,看看和声是否超过这一点。如果它是HW WHA。T可以吗?基普
以上来自于百度翻译 以下为原文 The plot thickens. The Harmony code initialized yesterday but I could not make it run. Which is why I went to the register route. So I switched back to the harmony code, and it also stops at that point. /* Enable ADC */ PLIB_ADCHS_Enable(DRV_ADC_ID_1); /* Check Vref to be ready */ while(!PLIB_ADCHS_VREFIsReady(DRV_ADC_ID_1)); /* Check for Vref Fault */ while(PLIB_ADCHS_VREFFaultHasOccurred(DRV_ADC_ID_1)); Today I switched boards wondering if I had a HW problem and I still got the error. I guess now I have to go back to the other board to see if Harmony gets past that point. If it is HW what could it be? Kip |
|
|
|
|
|
工作。如果你正在调试HW而不是在模拟器中,它会帮助你。所有的数据都不对,但是我已经超过了那个部分。
以上来自于百度翻译 以下为原文 Working. It helps if you are actually debugging the HW and not in the simulator. All the data is not right, but I am past that one part. Kip |
|
|
|
|
只有小组成员才能发言,加入小组>>
MPLAB X IDE V6.25版本怎么对bootloader和应用程序进行烧录
475 浏览 0 评论
5795 浏览 9 评论
2334 浏览 8 评论
2224 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3530 浏览 3 评论
1125浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
1098浏览 1评论
我是Microchip 的代理商,有PIC16F1829T-I/SS 技术问题可以咨询我,微信:A-chip-Ti
873浏览 1评论
MPLAB X IDE V6.25版本怎么对bootloader和应用程序进行烧录
475浏览 0评论
/9
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-12-2 19:27 , Processed in 0.663955 second(s), Total 74, Slave 57 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
930