• slider image 514
  • slider image 516
  • slider image 517
  • slider image 518
  • slider image 519
:::


Browsing this Thread:   2 Anonymous Users






Re: PWM
#4
版主
版主


查看用戶資訊
基本上將AD最高的8位元取出後直接傳給PR2來設定Period,然後將AD值又轉一位後傳給 CCPR1L 設定Duty

發表於: 2006/10/25 10:46
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: PWM
#3
新會員
新會員


查看用戶資訊
那如果我這樣寫可以嗎?
LIST P=16F873A
#INCLUDE <P16F873A.INC>
CBLOCK 0X20
ENDC
CBLOCK
Count
ENDC
ORG 0
NOP
GOTO MAIN

MAIN:
BANKSEL ADCON1
MOVLW B'00001110'
MOVWF ADCON1
BANKSEL ADCON0
MOVLW B'10000001'
MOVWF ADCON0
BANKSEL PR2
MOVLW ADRESH
MOVWF PR2
BCF TRISC,2
BANKSEL CCP1CON
MOVLW B'00001111'
MOVWF CCP1CON
MOVLW B'00000101'
MOVWF T2CON
CALL DELAY20

DELAY20:
movlw 0x64
movwf Count
D20Loop:
decfsz Count,F
goto D20Loop
return

MAIN1:
BSF ADCON0,GO
MAIN2:
BTFSC ADCON0,GO
GOTO MAIN2
MOVF ADRESH,W
MOVWF CCPR1L
GOTO MAIN1
END

發表於: 2006/10/23 14:29
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: PWM
#2
高級會員
高級會員


查看用戶資訊
把AD值 經過查表或是轉換 在放在一各暫存器

而這各暫存器就是PWM的DUTY CYCLE 的寬度



而這各暫存器就是PWM的PERIOD 的寬度

發表於: 2006/10/22 16:56
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


PWM
#1
新會員
新會員


查看用戶資訊
請問一下我要如何寫一個程式能讓pwm的頻率因為AD值的輸入不同來改變呢?

發表於: 2006/10/22 15:04
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... ]

教育訓練中心

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