#include "C:\Program Files\PICC\Projects\main.h"
#include "def_877a.h"
#use delay(clock=12000000) //dung thach anh 12Mhz
#use rs232(baud=9600, xmit=PIN_c6, rcv=PIN_c7) //khoi tao truyen thong RS232)
void main()
{ set_tris_b(0x00);
set_tris_d(0x00);
portb=0x55;
//tại sao thêm đoạn code này thì pic lại đơ,portb=0x55, rồi chẳng làm gì nữa
/*
enable_interrupts(GLOBAL); // Cho phep tao ngat
enable_interrupts(INT_EXT); // Cho phep ngat ngoai tai chan RB0/INT
enable_interrupts(INT_RDA); // Cho phep ngat ngoai tai chan RB0/INT
*/
while(true)
{ portb=~portb;
delay_ms(250);
}
}
|