![]() |
Hỏi Về potscaler TMR2
Xin các bạn cho hỏi công dụng của postscaler trong module TMR2 (PIC 12F683) và cách sử
dụng nó như thế nào |
Trích:
Bộ chia sau dùng để đếm số lần tràn timer (với timer 2 là số lần TMR2 = PR2) trước khi set cờ ngắt. VD: bạn set postscaler của timer2 là 1:4 tức là cần xảy ra 4 lần liên tiếp (TMR2 = PR2) thì cờ ngắt mới được set. |
Bạn đọc hết đoạn này sẽ hiểu ngay.
Syntax: setup_timer_2 (mode, period, postscale) Parameters: mode may be one of: T2_DISABLED, T2_DIV_BY_1, T2_DIV_BY_4, T2_DIV_BY_16 period is a int 0-255 that determines when the clock value is reset, postscale is a number 1-16 that determines how many timer overflows before an interrupt: (1 means once, 2 means twice, and so on). Returns: undefined Function: Initializes timer 2. The mode specifies the clock divisor (from the oscillator clock). The timer value may be read and written to using GET_TIMER2() and SET_TIMER2(). Timer 2 is a 8 bit counter/timer. Availability: This function is only available on devices with timer 2 hardware. Requires: Constants are defined in the devices .h file. Examples: setup_timer_2 ( T2_DIV_BY_4, 0xc0, 2); // At 20mhz, the timer will increment every 800ns, // will overflow every 154.4us, // and will interrupt every 308.8us. |
tiếng anh kém wá,đọc song không hiểu
|
mong anh em giúo đỡ thêm nhá
|
éc , học VDK mà kém Eng. xem như ít có khả năng code tốt . Hầu hết code source đều từ các trang nc ngoài
|
Múi giờ GMT. Hiện tại là 03:46 AM. |
Tên diễn đàn: vBulletin Version 3.8.11
Được sáng lập bởi Đoàn Hiệp.
Copyright © PIC Vietnam