PIC Vietnam

Go Back   PIC Vietnam > Microchip PIC > Cơ bản về vi điều khiển và PIC > Những câu hỏi thường gặp

Tài trợ cho PIC Vietnam
Trang chủ Đăng Kí Hỏi/Ðáp Thành Viên Lịch Bài Trong Ngày Vi điều khiển

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
Prev Previous Post   Next Post Next
Old 07-11-2008, 11:00 PM   #22
dientudong
Đệ 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 !
dientudong vẫn chưa có mặt trong diễn đàn   Trả Lời Với Trích Dẫn
 


Quyền Sử Dụng Ở Diễn Ðàn
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is Mở
Smilies đang Mở
[IMG] đang Mở
HTML đang Tắt

Chuyển đến

Similar Threads
Ðề 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


Múi giờ GMT. Hiện tại là 12:21 PM.


Được sáng lập bởi Đoàn Hiệp
Powered by vBulletin®
Page copy protected against web site content infringement by Copyscape
Copyright © PIC Vietnam