You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
jianglk.darker
7ee447c011
|
4 months ago | |
---|---|---|
.. | ||
Android.bp | 4 months ago | |
BUILD.gn | 4 months ago | |
Makefile | 4 months ago | |
product_package.mk | 4 months ago | |
readme.txt | 4 months ago | |
readme_cn.txt | 4 months ago | |
sample_moto_pwm.c | 4 months ago | |
sample_pwm.c | 4 months ago | |
sample_pwm.h | 4 months ago |
readme.txt
Purpose: to demonstrate how to implements independent PWM signal output. . Command: Usage: usage: ./sample_pwm PwmNum Freq DutyRatio Parameter: PwmNum: pwm number Freq: pwm frequency DutyRatio:pwm duty ratio (range:0-1000) Notice: 1.when gpio_pwm used for pwm function, the pin direction must be output. 2.The frequency and duty cycle parameters set by the interface may be different from those obtained by the interface. Cause: The frequency is divided by using the frequency divider on the 54 MHz basic clock. The frequency divider is the value in the frequency control register. When the frequency is set, the value obtained by dividing the set frequency by 54 MHz needs to be written to the frequency control register. For example, to set the 10 MHz clock, the coefficient value in the frequency control register is 5 (54 MHz/10 MHz = 5.4). Read the frequency control register through the interface for reading the frequency. The coefficient value in the read frequency control register is 5. 54M/5 = 10.8M, rounded off to 11M. The duty cycle is divided into 1000 equal parts in the 255th period. The DutyRatio parameter indicates the high-level time. The value written to the duty cycle control register is DutyRatio/1000 x 255. For example, if the duty cycle to be set is 700, the value written to is 178 (700/1000 x 255 = 178.5). Then, read the data through the interface for reading the duty cycle. The coefficient value in the duty cycle control register is 178. 178 / 255 * 1000 = 698.03. The value is 698.