| データシートサーチシステム |
|
SN8A1702AX データシート(PDF) 89 Page - SONiX Technology Company |
|
|
|||||||||||||||||||||||||||||
SN8A1702AX データシート(HTML) 89 Page - SONiX Technology Company |
|
89 / 145 page ![]() SN8P1700 8-bit micro-controller build-in 12-bit ADC SONiX TECHNOLOGY CO., LTD Page 89 Revision 1.94 PWM PROGRAM DESCRIPTION Example: Setup PWM0 output from TC0 to PWM0OUT (P5.4). The external high-speed oscillator clock is 4MHz. The duty of PWM is 30/256. The PWM frequency is about 1KHz. The PWM clock source is from external oscillator clock. TC0 rate is Fcpu/4. The TC0RATE2~TC0RATE1 = 110. TC0C = TC0R = 30. MOV A,#01100000B B0MOV TC0M,A ; Set the TC0 rate to Fcpu/4 B0MOV TC0M,A ; Set the TC0 rate to Fcpu/4 MOV A,#0x00 ;First Time Initial TC0 MOV A,#30 ; Set the PWM duty to 30/256 B0MOV TC0R,A B0BCLR FTC0OUT ; Disable TC0OUT function. B0BSET FPWM0OUT ; Enable PWM0 output to P5.4 and disable P5.4 I/O function B0BSET FTC0ENB ; Enable TC0 timer Note1: The TC0R and TC1R are write-only registers. Don’t process them using INCMS, DECMS instructions. Note2: Set TC0C at initial is to make first duty-cycle correct. After TC0 is enabled, don’t modify TC0R value to avoid duty cycle error of PWM output. Example: Modify TC0R/TC1R registers’ value. MOV A, #30H ; Input a number using B0MOV instruction. B0MOV TC0R, A INCMS BUF0 ; Get the new TC0R value from the BUF0 buffer defined by B0MOV A, BUF0 ; programming. B0MOV TC0R, A Note3: That is better to set the TC0C and TC0R value together when PWM0 duty modified. It protects the PWM0 signal no glitch as PWM0 duty changing. That is better to set the TC1C and TC1R value together when PWM1 duty modified. It protects the PWM1 signal no glitch as PWM1 duty changing. Note4: The TC0OUT function must be set “0” when PWM0 output enable. The TC1OUT function must be set “0” when PWM1 output enable. Note5: The PWM can work with interrupt request. |
|
リンク URL |
| ALLDATASHEETはお客様のビジネスに役立ちますか? [ DONATE ] |
Alldatasheetは | 広告 | お問い合わせ | プライバシーポリシー | データシートへのリンク | リンク交換 | メーカーリスト All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |