|
Tài trợ cho PIC Vietnam |
Cơ bản về vi điều khiển và PIC Những bài hướng dẫn cơ bản nhất để làm quen với vi điều khiển PIC |
|
Ðiều Chỉnh | Xếp Bài |
13-05-2013, 02:54 PM | #4 | |
Nhập môn đệ tử
Tham gia ngày: Jan 2013
Bài gửi: 2
: |
Trích:
#include "C:\Documents and Settings\haphong computer\Desktop\css\timer0.h" #use delay(clock=20000000) #int_RTCC void RTCC_isr(void) // chuong trinh ngat { output_b(0xff); // port b =0 } void main() { setup_adc_ports(NO_ANALOGS); setup_adc(ADC_CLOCK_DIV_2); setup_psp(PSP_DISABLED); setup_spi(SPI_SS_DISABLED); setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1); setup_timer_1(T1_DISABLED); setup_timer_2(T2_DISABLED,0,1); setup_comparator(NC_NC_NC_NC); setup_vref(FALSE); enable_interrupts(INT_RTCC); enable_interrupts(GLOBAL); set_tris_b(0); while(1) { output_b(0x00); enable_interrupts(int_timer0); // cho phep ngat timer0 enable_interrupts(GLOBAL);//cho phep nhat toan cuc setup_timer_0(RTCC_DIV_64|RTCC_EXT_L_TO_H) ; // set bo chia tan so va xung tac dong set_rtcc(6); // gia tri trong ngoac cung chua hieu cacch tinh . } } |
|
|
|