Đoạn code này đơn giản chớp tắt cả port B thôi,
Nếu chỉ đơn giản là bật tắt port thì không cần phải setup ADC,SPI... nó chẳng liên quan gì cả.
Hy vọng giúp ích cho bạn!
//Start of code
#include <16F877A.h>
#fuses NOWDT, HS, NOPUT, NOPROTECT, NOLVP
#use delay(clock=20000000)
#use fast_io(b)//dùng port B
void main()
{
set_tris_b(0); //set Port B ở chế độ output
While(1)
{
output_b(0x00);
delay_ms(200);
output_b(0xff);
delay_ms(200);
} //end of while
}//end of void main()
//-----End of code
|