完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
电子发烧友论坛|
我有一些问题,ADC收购。我注意到ADC值具有“阶跃”特性。我的软件是:电压桥:649欧姆到3.6V,连接到CTN500欧姆到GND,一个100pF的电容器,用来过滤输入。我的配置:ADC开关50us的延迟和在ADCON1寄存器MEASURE_TEMPERATURE(){PIN_MEASUSUSU()中获取Fosc/32的数据。RE_TERATURE=1;//为温度测量ADRESH=0;//Init ADRESH ADRESL=0;//Init ADRESL ADC=0;//Init ADC变量ADC_Initialize();//配置ADC通道并接受中断ADCON0bits.ADON=1;//将adc连接到VSS_._us(50);ADCON0bits.GO_nDONE=1;//Start conv通过设置GOandDone变量.(ADCON0bits.GO_nDONE){}//等待转换结束ADC=(ADRESH<2)+(ADRESL>6);/(ADRESH<8)+ADRESL;PIN_MEASURE_TEMPERATURE=0;//关闭用于温度测量的MOS FRAME_ADAPTA.();//转换温度ADC值到帧温度格式}void ADC_Initialize(void){ADCON0=0b00010100;//RC1=AN5 ADCON1=0b00100000;//ADFM.;ADPREF VDD;ADCS FOSC/32;ADCON2=0b00000000;//TRIGSEL no_auto_.;ADRESL=0x00;//ADRESL 0x0;//ADRESH 0x0;}
以上来自于百度翻译 以下为原文 I have some problems with ADC acquisition. I notice that the ADC value has a "step" behaviour. My harware: Voltage bridge: 649Ohms to 3.6V connected to CTN500Ohms to GND, a capacitor of 100pF to filter the input. My configuration: Delay of 50us betwen ADC switch ON and data acquire Fosc/32 in the ADCON1 register MEASURE_TEMPERATURE() { PIN_MEASURE_TEMPERATURE=1; //Put the MOS ON for the temperature measure ADRESH=0; //Init ADRESH ADRESL=0; //Init ADRESL ADC =0; //Init ADC variable ADC_Initialize(); //Configure ADC Channel and accept interrupt ADCON0bits.ADON = 1; //Connect adc to VSS __delay_us(50); ADCON0bits.GO_nDONE = 1; // Start conversion by setting the GOandDone variable while (ADCON0bits.GO_nDONE){} // Wait end of conversion ADC = (ADRESH << 2) + (ADRESL >> 6); //(ADRESH << 8) + ADRESL; PIN_MEASURE_TEMPERATURE=0; //Switch off the MOS used for temperature measurement FRAME_ADAPTATION(); //Conversion of the temperature ADC value to frame temperature format } void ADC_Initialize(void) { ADCON0 = 0b00010100; // RC1=AN5 ADCON1 = 0b00100000; // ADFM left; ADPREF VDD; ADCS FOSC/32; ADCON2 = 0b00000000; // TRIGSEL no_auto_trigger; ADRESL = 0x00; // ADRESL 0x0; ADRESH = 0x00; // ADRESH 0x0; } |
|
相关推荐
6个回答
|
|
|
这是正确的吗?ADC=(ADRESH<<2)+(ADRESL>>6);//(ADRESH<8)+ADRESL;我发现它很奇怪(或者可能只是太早了)。我是说,对于左对齐和右对齐模式都很奇怪(不确定哪一个在使用)
以上来自于百度翻译 以下为原文 Is this correct? ADC = (ADRESH << 2) + (ADRESL >> 6); //(ADRESH << 8) + ADRESL; I find it strange (or maybe it's just too early in the morning.. I mean, it's strange for both left and right justified mode (not sure sure which one is in use) |
|
|
|
|
|
我也想对此进行评论,但是想找出哪个编译器正在使用。它使用左对齐模式,并试图重新构造10位值。使用右对齐模式(因为需要较少的移位)更为常见,但是这种技术在XC8中应该可以正常工作。它在C18、d中将失败。UE对其缺乏自动的整数提升。
以上来自于百度翻译 以下为原文 I was going to comment on that too, but wanted to find out which compiler is in use. It's using left justified mode, and trying to reconstruct the 10 bit value. It's more common to use right justified mode (as less shifting is required), but this technique should work ok in XC8. It will fail in C18, due to its lack of automatic integer promotion. |
|
|
|
|
|
如果ADC是16位变量,ADC=ADRES;//应该在这里工作(我从未见过ADRESx寄存器被初始化)
以上来自于百度翻译 以下为原文 ADC = ADRES; // should work here if ADC is a 16bit variable (I have never seen ADRESx registers being initialized) |
|
|
|
|
|
我有,但只有人们四处游荡,尝试一切和任何事情来解决ADC问题;
以上来自于百度翻译 以下为原文 I have, but only by people flailing around trying everything and anything to solve an ADC problem ;) |
|
|
|
|
|
我明白了,是的,不知何故…也许AdRESX COIULD可以用作一个便笺簿?
以上来自于百度翻译 以下为原文 I see, yeah, somehow... And maybe ADRESx coiuld be used as a scratchpad? |
|
|
|
|
|
您好,您还可以使用MCP3551进行更精确的测量。http://ww1.micro..com/...en/AppNotes/01154a.pdf-Karan
以上来自于百度翻译 以下为原文 Hi, You can also use MCP3551 for more precise measurement. http://ww1.microchip.com/...en/AppNotes/01154a.pdf -- Karan |
|
|
|
|
只有小组成员才能发言,加入小组>>
MPLAB X IDE V6.25版本怎么对bootloader和应用程序进行烧录
501 浏览 0 评论
5808 浏览 9 评论
2350 浏览 8 评论
2237 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3543 浏览 3 评论
1156浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
1119浏览 1评论
我是Microchip 的代理商,有PIC16F1829T-I/SS 技术问题可以咨询我,微信:A-chip-Ti
887浏览 1评论
MPLAB X IDE V6.25版本怎么对bootloader和应用程序进行烧录
501浏览 0评论
/9
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-12-12 08:57 , Processed in 0.872762 second(s), Total 54, Slave 47 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
717