troiuuuu
29-12-2010, 03:21 PM
Chào anh em!Mình vừa mới viết ccs nên nhiều điều chưa hiểu mong ae help jum,đoạn code của mình sao nó không vào dc chương trình ngắt khi có sự thay đổi ở PortB(RB4-->RB7)
Đây là code mọi người xem rồi cho ý kiến nha.
Thanks!
#include<16f877a.h>
#include<def_877a.h>
#fuses NOWDT,PUT,XT,NOPROTECT
#use delay(clock=4000000)
#use fast_io(b)
#int_RB
int a;
void ngat_RB()
{
delay_ms(1000);
portd=0;
}
main()
{
set_tris_b(0b11110000);
set_tris_d(0);
enable_interrupts(global);
enable_interrupts(int_RB);
ext_int_edge(H_to_L);
a=0b10000000;
while(1)
{
portd=a;
delay_ms(10);
rotate_right( &a, 1);
delay_ms(100);
portd=a;
}
}
Đây là code mọi người xem rồi cho ý kiến nha.
Thanks!
#include<16f877a.h>
#include<def_877a.h>
#fuses NOWDT,PUT,XT,NOPROTECT
#use delay(clock=4000000)
#use fast_io(b)
#int_RB
int a;
void ngat_RB()
{
delay_ms(1000);
portd=0;
}
main()
{
set_tris_b(0b11110000);
set_tris_d(0);
enable_interrupts(global);
enable_interrupts(int_RB);
ext_int_edge(H_to_L);
a=0b10000000;
while(1)
{
portd=a;
delay_ms(10);
rotate_right( &a, 1);
delay_ms(100);
portd=a;
}
}