![]() |
|
Tài trợ cho PIC Vietnam |
Những câu hỏi thường gặp Những lỗi cơ bản thường gặp khi làm việc với PIC hoặc những vấn đề cơ bản nhất thường được hỏi trong những năm qua |
|
Ðiều Chỉnh | Xếp Bài |
![]() |
#22 |
Đệ tử 5 túi
Tham gia ngày: Oct 2008
Bài gửi: 95
: |
thắc mắc
Syntax:
set_pwm1_duty (value) set_pwm2_duty (value) set_pwm3_duty (value) set_pwm4_duty (value) set_pwm5_duty (value) Parameters: value may be an 8 or 16 bit constant or variable. Returns: undefined Function: Writes the 10-bit value to the PWM to set the duty. An 8-bit value may be used if the least significant bits are not required. If value is an 8 bit item it is shifted up with two zero bits in the lsb positions to get 10 bits. The 10 bit value is then used to determine the amount of time the PWM signal is high during each cycle as follows: Ton = value*(1/clock)*t2div Where clock is oscillator frequency and t2div is the timer 2 prescaler (set in the call to setup_timer2). Availability: This function is only available on devices with CCP/PWM hardware. Requires: Nothing Examples: // For a 20 mhz clock, 1.2 khz frequency, // t2DIV set to 16 // the following sets the duty to 50% (or 416 us). long duty; duty = 520; // .000416/(16*(1/20000000)) set_pwm1_duty(duty); Các bạn vui lòng cho mình hỏi : nếu value là 16 bit thì sao,trong khi ở trên nói rằng ghi vào PWM 10 bit . Với lại "t2div is the timer 2 prescaler (set in the call to setup_timer2)." mình chưa biết dịch ra tiếng Việt thế nào .Rất cảm ơn các bạn chỉ bảo ! |
![]() |
![]() |
|
|
![]() |
||||
Ðề tài | Người gửi | Chuyên mục | Trả lời | Bài mới |
Xin tập lệnh của PIC16F877 | thanhdt | Cơ bản về vi điều khiển và PIC | 12 | 13-01-2011 09:37 PM |
Nguồn chuẩn cho ADC của PIC16F877 | mamen2006 | PIC - Thiết kế và Ứng dụng | 0 | 13-09-2006 05:23 PM |