Cảm ơn anh,
E vừa đọc phần setup_PWM1_duty() (trang 236).
Writes the 10-bit value to the PWM to set the duty. An 8-bit value may be use
if the most significant bits are not required. The 10 bit value is then used to
determine the duty cycle of the PWM signal as follows:
%duty cycle = value / [ 4 * (PR2 +1 ) ]
Theo như trong đó, e cần đặt duty = 50% = 0.5 thì giá trị value phải nạp là:
value = 4* duty* (PR2 + 1) = 4* 0.5* (15+1) = 32
Hình như có chỗ nào đó e chưa hiểu đúng thì phải (10bits- 8bits ???), hic. Nhờ a chỉ e thêm "tí manh mối" nữa đi. Cảm ơn a nhiều lắm.
|