完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
大家好,我有一个问题,配置PIC18F85 J94ADC。在第22.3.2页中,从PIC18F97 J95家庭数据表中得知,内部带隙基准电压可用于ADC正基准电压。然而,在寄存器描述中没有提到这样的选项。有可能使用内部带隙电压基准作为ADC正电压基准吗?谢谢:
以上来自于百度翻译 以下为原文 Hi all, I have a problem to configure the PIC18F85J94 ADC. In chapter 22.3.2 from the PIC18F97J94 family data-sheet is told that the internal band gap reference voltage may be used for the ADC positive reference voltage. However, in the register description there is no such option mentioned. Is it possible to use the internal band gap voltage reference as ADC positive voltage reference? Thank you :) |
|
相关推荐
1个回答
|
|
你好,还没有解决问题的办法,但有一个想法:1。配置ADC参考电压为AVdd。2。将ADC输入通道配置为Vbg(内部带隙基准电压源)并测量它。比我独立于AVDD振荡,可以安全地测量。但是现在面对VBG错误测量的问题,用AVdd(AVDD=3.6V)的参考电压和12位模式I测量VBG并获得2416,当3.6V为4095时。这意味着VBG=2.12V,我认为这是不对的吗?我认为VBG=1.2V或1.8V,对吗?PIC18F8J94ADC文档似乎没有完全描述。请给我一些引导线。
以上来自于百度翻译 以下为原文 Hello, still have not a solution to the problem but have an idea :) 1. Configure the ADC reference voltage to be AVdd. 2. Configure the ADC input channel to be Vbg (The internal band gap voltage reference) and measure it. Than I am independent from the AVdd oscillations and can measure safely. But now face the problem with wrong measurement of Vbg. With reference voltage taken from AVdd (AVdd = 3.6V) and 12 bit mode I measure the Vbg and get 2416, when 3.6V is 4095. This means that Vbg = 2.12V which I suppose is not correct? I think that Vbg=1.2V or 1.8V, am I right? The PIC18F85J94 ADC documentation seems not fully described. Please, give me some guide lines. #include #include #include "../inc/main.h" #define ADC_T 500UL // The period of the A/D conversion clock in nano seconds. #define ADCS_VALUE (ADC_T * F_OSC / 1000 / 2 - 1) // From the device data-sheet, equation 22-1. // Configure the MUX A positive channel only. #define ADC_CONF_MUXA(value) (ADCHS0Lbits.CH0SA = value) typedef enum { // Describe the available options for the MUX A positive input. // ADC_MUXA_CHANNEL_VDD_CORE = 0b, ADC_MUXA_CHANNEL_AVDD = 0b11110, // The voltage present on the AVdd pin. ADC_MUXA_CHANNEL_VBG = 0b11100, // The internal precision voltage reference. ADC_MUXA_CHANNEL_AN7 = 0b00111, // AN7 - the ADC input to measure the battery voltage. } adc_muxa_channel_t; void adc_init(void) { ADCON1Hbits.ADON = 0; // If previously was ON, because at some kind of resets the register is not cleared! ADCON1Hbits.FORM = 0b00; // Absolute decimal result, unsigned, right-justified. ADCON1Hbits.MODE12 = 1; // 12 bits conversion mode select. ADCON1Lbits.ASAM = 0; // Sampling begins when SAMP bit is manually set. ADCON1Lbits.SAMP = 0; // A/D Sample-and-Hold amplifiers are holding. // The SAMP bit is cleared after SAMC<4:0> number of TAD clocks following the SAMP bit being set (Auto-Convert mode) ADCON1Lbits.SSRC = 0b0111; // Select the AVdd pin for positive voltage reference and AVss for negative voltage reference. // Inputs are not scanned. ADCON2H = 0x00; // Always uses channel input selects for Sample A. // The conversion results will always be written to the ADCBUF0 because SMPI<4:0> = 0. ADCON2L = 0x00; ADCON3Hbits.ADRC = 0; // A/D Conversion Clock Source is the system clock. ADCON3Hbits.SAMC = 0b11111; // After 31 * Tad, the sampling is stopped and conversion begins automatically. ADCON3Lbits.ADCS = ADCS_VALUE; // Set the prescaler for appropriate ADC period clock. ADC_CONF_MUXA(ADC_MUXA_CHANNEL_VBG); // Initially measure the band gap reference voltage. ANCFGbits.VBGEN = 1; // Reference voltage on. while (!HLVDCONbits.BGVST) ; ADCON1Hbits.ADON = 1; // Enable the module. } uint16_t adc_measure() { ADCON1Lbits.SAMP = 1; // Start the ADC sampling process. The conversion is started automatically after. while (!ADCON1Lbits.DONE) ; return ADCBUF0; } |
|
|
|
只有小组成员才能发言,加入小组>>
5150 浏览 9 评论
1994 浏览 8 评论
1923 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3164 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2221 浏览 5 评论
716浏览 1评论
602浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
488浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
616浏览 0评论
515浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-14 14:08 , Processed in 1.815471 second(s), Total 77, Slave 61 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号