| Datenblatt-Suchmaschine für elektronische Bauteile |
|
SN8P1602AX Datenblatt(PDF) 64 Page - SONiX Technology Company |
|
|
|||||||||||||||||||||||||||||
SN8P1602AX Datenblatt(HTML) 64 Page - SONiX Technology Company |
|
64 / 94 page ![]() SN8P1600 8-bit micro-controller SONiX TECHNOLOGY CO., LTD Page 64 Revision 1.94 PWM PROGRAM DESCRIPTION Example: Setup PWM1 output from TC1 to PWM1OUT (P5.3). 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. TC1 rate is Fcpu/4. The TC1RATE2~TC1RATE1 = 110. TC1C = TC1R = 30. MOV A,#01100000B B0MOV TC1M,A ; Set the TC1 rate to Fcpu/4 MOV A,#0x00 ;First Time Initial TC0 B0MOV TC1C,A MOV A,#30 ; Set the PWM duty to 30/256 B0MOV TC1R,A B0BCLR FTC1OUT ; Disable TC1OUT function. B0BSET FPWM1OUT ; Enable PWM1 output to P5.3 and disable P5.3 I/O function B0BSET FTC1ENB ; Enable TC1 timer Note1: The TC1R is write-only register. Don’t process them using INCMS, DECMS instructions. Note2: Set TC1C at initial is to make first duty-cycle correct. After TC1 is enabled, don’t modify TC1R value to avoid duty cycle error of PWM output. Example: Modify TC1R registers’ value. MOV A, #30H ; Input a number using B0MOV instruction. B0MOV TC1R, A INCMS BUF1 ; Get the new TC1R value from the BUF1 buffer defined by B0MOV A, BUF1 ; programming. B0MOV TC1R, A Note3: 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 TC1OUT function must be set “0” when PWM1 output enable. Note5: The PWM can work with interrupt request. |
|
Link URL |
| War ALLDATASHEET hilfreich? [ DONATE ] |
Über Alldatasheet | Werbung | Kontakt | Privatsphäre und Datenschutz | Link zum Datenblatt | Linktausch | Hersteller 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 |