• slider image 442
  • slider image 497
  • slider image 498
  • slider image 499
  • slider image 500
  • slider image 502
:::


Browsing this Thread:   1 Anonymous Users






Re: PIC16F917 AD轉換問題
#3
中級會員
中級會員


查看用戶資訊
我是用PIC16F917 AD转换 ,IC的两组VDD VSS 我都接了 VDD接5V

我用RA0输入测试电压 将电压输出至RB1 RB2看输出

奇怪的是我的硬体在开机的时候RA0居然就有1.6V??这样是我硬体有接错吗??

另外我的RA1 RB2输出电压也跟RA0输入差很多??是否也是硬体问题??

附上电路图http://www.wretch.cc/album/show.php?i ... 123&b=10&f=1349080989&p=0

發表於: 2008/8/21 10:18
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: PIC16F917 AD轉換問題
#2
資深會員
資深會員


查看用戶資訊
試試把相關接腳共用的功能手動 initialize 一下,不必要的功能關掉。 16F917 內建有 LCD 驅動器,不曉得是不是它在作用。

發表於: 2008/8/20 17:03
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


PIC16F917 AD轉換問題
#1
中級會員
中級會員


查看用戶資訊
我使用PIC16F917做 AD转换 ,我的PIC两个VDD VSS 接5V, 利用RA0做AD电压值输入,然后用3个1K电阻接在RB1~RB3后 各接一个LED做输出,问题出现几点 在我烧录完成后,RA0居然自己出现1.6V电压??这边很奇怪。

然后我在RA0脚位输入不管几V ,RB1~RB3都是5V 令我百思不解。以下是我的程式 是否硬体有问题还是软体希望高手解答谢谢。


#include<pic.h>

typedef unsigned int Word;
#define u8 unsigned char
#define u16 unsigned int


u8 AD_Result_1;
u8 AD_Result_2;

void init(void)
{
TRISB=0X00;//
TRISA=0X3F;//
PORTB=0X0F;//
ADCON1 = 0x10; //选则转换时脉 2us
ADCON0 = 0x80; //选用通道 & 参考电压 选AN0
ANSEL = 0x00;


}


void delay22u(void) //22us
{
u8 i;
for(i=4;i>0;i--)
{
asm("clrwdt");
}
}

void delay_500ms(void)
{
u16 i;
for(i=45450;i>0;i--)
{
asm("clrwdt");
}
}

void delay_1ms(void)
{
u8 i;
for(i=255;i>0;i--)
{
asm("clrwdt");
}
}

void AD_Get(void)
{
ADON=1; //
delay22u(); //
GODONE=1; //
do
{
//
}
while(GODONE==1);

}

void putout_RD(void)
{
if(AD_Result_1 == AD_Result_2)
{
PORTB=~AD_Result_1;//
}
}


//主程序
void main(void)
{
init();
while(1)
{
Word temp;
AD_Get();
temp = ((Word)(ADRESH) << 8);
AD_Result_1=temp;//
delay_500ms();
AD_Get();
temp |= (Word)(ADRESL);
AD_Result_2=temp;//
putout_RD();
delay_1ms();
}
}

發表於: 2008/8/20 15:41
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部







You can view topic.
不可以 發起新主題
You cannot reply to posts.
You cannot edit your posts.
You cannot delete your posts.
You cannot add new polls.
You cannot vote in polls.
You cannot attach files to posts.
You cannot post without approval.
You cannot use topic type.
You cannot use HTML syntax.
You cannot use signature.
You cannot create PDF files.
You cannot get print page.

[進階搜尋]


:::

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... ]

教育訓練中心

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