![]() |
![]() |
#11 |
Đệ tử 1 túi
Tham gia ngày: Feb 2009
Bài gửi: 13
: |
Code:
#include <16F877a.h> #fuses NOWDT,PUT,HS,NOPROTECT #use delay(clock=4000000) ////#use fast_io(b) #byte portc=0x07 ///khai bao dia chi portb #byte portb=0x06 ////#define led pin_B0 int16 count; int8 a; //Chuong trinh ngat TMR0 #int_timer0 void interrupt_timer0() { set_timer0(0); ++count; if(count==560) { count=0; a=a<<1; // dich trai a 1bit } if(a==256) { a=1; count=0; } } //Chuong trinh chinh main() { set_tris_c(0); set_tris_b(0); enable_interrupts(global); enable_interrupts(int_timer0); setup_timer_0(RTCC_INTERNAL|RTCC_DIV_2); set_timer0(0); count=0; a=1; while(true) { portc=a; portb=0x01010101; } } nhưng mình thử chèn thêm một đoạn code cho cổng b sáng theo ý mình thì portc đèn chạy chậm lại .vậy là sao nhỉ , thay đổi nội dung bởi: namqn, 23-02-2009 lúc 04:35 PM. |
![]() |
![]() |
Ðiều Chỉnh | |
Xếp Bài | |
|
|