• slider image 442
  • slider image 483
  • slider image 484
  • slider image 485
  • slider image 486
  • slider image 487
:::


Browsing this Thread:   1 Anonymous Users






Re: 請教10F220的A/D功能??
#9
資深會員
資深會員


查看用戶資訊
Hahaha..
有人要作東呀????
那我要去訂機票囉!!!!!
How about Thanksgiving holiday?
yeh yeh!!!火雞大餐耶!!!!
老先生笨鴨我.....來啦 .....
不知道您住那兒耶????Dear abe wu.

My e-mail ..... duck288@yahoo.com


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


Re: 請教10F220的A/D功能??
#8
初級會員
初級會員


查看用戶資訊
Dear Duck,
I was just aware that you are in LA.
If you back to TW, just let me know.
You are my guest.
BR
Abe Wu

發表於: 2005/11/9 11:25
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 請教10F220的A/D功能??
#7
初級會員
初級會員


查看用戶資訊
Hi! Dear Duck,
I should not say "reserve GP3 for power on reset".
The better statement should be "reserve GP3 for external reset or some other input application".

Yor are right! "POR" is one of internal reset fuction.
We may need external reset switch for just in case system is halted for some unexpected reason.
It is normally neglected if pin number is not afforable.
Nevertheless, If I have excess pin, my first ideal is keep MCRL pin as external reset.

BR
Abe Wu

發表於: 2005/11/9 11:13
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 請教10F220的A/D功能??
#6
資深會員
資深會員


查看用戶資訊
Hey ! You are so smart , Dear abewu.
It’s a very good idea to reverse programming use a 2.5V reference Voltage connect with AN0 input. 再來比較電池電壓.
笨鴨偶可是想了整晚 ,才想通 個中道理耶 ! Happy.
但是程式要如何呢? 還要琢磨琢磨囉!!!
讓我想一想囉.... 3Q 3Q ....

發表於: 2005/11/8 2:35
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 請教10F220的A/D功能??
#5
資深會員
資深會員


查看用戶資訊
Dear abewu 3Q again. 笨鴨偶受惠多多,下次回台北一定要請你吃飯喔!原本計劃X’mas假期回台北上W100的課,但是,好像沒有W100可以上?所以看看明年春季的課程吧?
10F220的A/D程式, 我沒有用到GP3, 我是用GREEN LED +RED LED產生混色類似ORANGE 您的方法很好又學到一招 Happy.謝啦
關於GP3留給MCLR? 不是10F220已有內建Power On Reset 還需要嗎?
By the way , A/D程式部份不知對不對耶?
請指正囉! 3Q ...

發表於: 2005/11/8 1:54
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 請教10F220的A/D功能??
#4
初級會員
初級會員


查看用戶資訊
Hi! Duck,
我要掃你興,再增你的興。

掃興點:GP3是輸入腳,不能做輸出,所以三個燈不能由三個各別接腳點亮。

增興點:
綠LED接法:電源 -> 330R電阻 -> LED綠 -> GP1。
黃LED接法:GP1 -> 330R電阻 -> LED黃 -> GP2。
紅LED接法:GP2 -> 330R電阻 -> LED紅 -> 0V。
此時,
GP1 = 0,GP2 = 0,=> 綠LED亮。
GP1 = 1,GP2 = 0,=> 黃LED亮。
GP1 = 1,GP2 = 1,=> 紅LED亮。
而且GP3還可以留給MCLR當Power On Reset用。
帥吧!

發表於: 2005/11/7 3:05
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 請教10F220的A/D功能??
#3
初級會員
初級會員


查看用戶資訊
Hi! Duck,
很高興又見到你了。
無論如何,你需要一個參考電壓,你的問題是,腳數不夠ㄚ。

哈!哈!別被騙了。
聽我道來!
你可以增加一個參考電源,例如:MCP1525,2.5V參考電源、甚或Zerner(只是需各別調整參數)。直接接到類比輸入,此時輸入電壓固定,但是ADC結果將因電源電壓不同而改變。亦即,電源越低,讀數越高;vice versa。
是不是就可以判斷電源電壓了?

當然還有別的辦法,不過這個方法的再製性較高,應該比較實用。

發表於: 2005/11/7 2:34
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 請教10F220的A/D功能??
#2
資深會員
資深會員


查看用戶資訊
哎....呀....呀.... 忙了半天, 原來10F220 還沒上市呀????
也好!!! 那就先規劃程式憋 ...
基本上我是不懂A/D程式 所以就東抄西湊 完成下面的程式 希望Dear 大哥哥大姐姐幫忙看一看 行不行的通囉!!

; PIC10F220 A/D TEST
#include <p10F220.inc> ; processor specific variables
; Configure: Controls the reset pin, code protect, oscillator selection, WDT.
__CONFIG _MCLRE_OFF & _CP_OFF & _WDT_OFF & _MCPU_ON & _IOFSCS_4MHZ
;-----[Defines & Variable Assignments]---------------------------------------
cblock 0x08 ; GP0=AN0,GP1=GREEN LED ,GP2=RED LED,,
count ; count buffer

;-----[Reset Vector]---------------------------------------------------------
ORG 0x000 ; PIC goes here (Origin of code) after reset.
movwf OSCCAL ; Load the oscillator calibration factor.
movlw b'10001111' ; Disable wake on pin change, Enable pull-up.
OPTION
movlw b'00001001' ; Set GP0=AN0 ,GP1,GP2=O/P, GP3 to an input .
TRIS GPIO ; Register 06h
movlw b'01000001' ; GP0 to an A/D input , ADC ON
movwf ADCON0 ;
goto init
;-----------------------------[Sub routine]-----------------------------------
dly_25us
movlw d'8'
movwf count
keep
decfsz count,f
goto keep
retlw 0


;-----[Main routine]---------------------------------------------------------
init
call dly_25us ; Wait for AN0 to set up .
bsf ADCON0, GO ; start A/D conversion for AN0
call dly_25us ; Wait for coversion .
wait
btfsc ADCON0,GO ; Conversion complete yet? GO=0= Done.
goto wait ; No,
movf ADRESH,W ; write A/D result into W.
sublw b'11100101' ; 4.5V- BATT ,
btfsc STATUS,Z ; If Z=1 then BATT = 4.5V
goto ....... ; goto Yellow LED routine.
btfss STATUS,C ; If C=0 then BATT > 4.5V,
goto...... ; goto Green LED routine.
sublw b'11001100' ; 4.0V- BATT ,
btfsc STATUS,Z ; If Z=1 then BATT = 4.0V
goto ....... ; goto Red LED routine.
btfss STATUS,C ; If C=0 then BATT > 4.0V,
goto...... ; goto Yellow LED routine.
goto..... ; If C=1 ,so , BATT < 4.0v then goto Red LED routine.
end

發表於: 2005/11/2 1:18
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


請教10F220的A/D功能??
#1
資深會員
資深會員


查看用戶資訊
又有個笨笨問題要請教大哥大姐....
如果10F220是用 5V電池供電, GP0設定為 A/D input;
請問是否可以用GP0腳來監測自己的電池電壓呢?
又因為電池電壓會慢慢改變, (VDD在改變)
是否會影響到實際要監測的電壓點呢?
我想設定三個監測的電壓點,
5-4.5V亮GREEN LED , 4.5-4V Yellow LED , 4V以下 Red LED. 3Q lor! Happy Halloween... Booooo

發表於: 2005/11/1 3:50
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... ]

教育訓練中心

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