:::

論壇索引


Board index » All Posts (qqaf9915)




a/d轉換問題
#1
新會員
新會員


各位先進好...
小弟最近使用CCS編譯器來寫C程式燒入18F452
以下是程式部份..
但在 AD轉換使用時卻發現電壓讀取時有雜訊??
雜訊約在0.XXV
請問該如何解決呢??
謝謝 歐....
void main()
{
long i=0;
float vol;
float data;
float a;
float b;
set_tris_c(0x9E); // RC5 for D/O, debugging
set_tris_a( 0b11101111 );
setup_adc_ports(RA0_RA1_RA3_ANALOG);
setup_adc(ADC_CLOCK_DIV_32);
set_tris_b(0);
while(1)
{
i=i+1;
set_adc_channel(0);
delay_us(50);
b=read_adc();
//c=(float)(A*5.09)/1024;

set_adc_channel(1);
delay_us(50);
data=read_adc();
delay_ms(250);
output_low ( PIN_A4 );
delay_ms(250);
output_high ( PIN_A4 );

發表於: 2009/9/29 1:42
頂部






:::

Microchip連結

https://www.facebook.com/microchiptechnologytaiwan/
http://www.microchip.com.tw/modules/tad_uploader/index.php?of_cat_sn=13
https://mu.microchip.com/page/tmu
http://elearning.microchip.com.tw/modules/tad_link/index.php?cate_sn=1
https://page.microchip.com/APAC-PrefCenters-TW.html
http://www.microchip.com/
http://www.microchip.com/treelink
http://www.microchipdirect.com/
http://www.microchip.com.cn/newcommunity/index.php?m=Video&a=index&id=103
http://www.microchip.com.tw/modules/tad_uploader/index.php?of_cat_sn=2
http://www.microchip.com.tw/Data_CD/eLearning/index.html
http://www.microchip.com.tw/RTC/RTC_DVD/
https://www.microchip.com/development-tools/
https://www.youtube.com/user/MicrochipTechnology
[ more... ]

教育訓練中心

!開發工具購買
辦法說明 [業界客戶] [教育單位]
----------------------------------
!校園樣品申請
辦法說明 [教師資格] [學生資格]
----------------------------------