![]() |
|
|
#11 | |
|
Đệ tử 3 túi
Tham gia ngày: Feb 2009
Bài gửi: 47
: |
Trích:
Code:
#include<16f877a.h>
#fuses nowdt,hs,noprotect,nodebug
#use delay(clock=20M)
#bit button2 =0x008.2
#bit button1 =0x008.0
void main()
{
int a=5;
set_tris_b(0x00);
set_tris_d(0xff);
output_b(0);
while(true)
{
if(button1) {delay_ms(40); while(button1){}; a++;}
if(button2) {delay_ms(40); while(button2){}; a--;}
output_b(a);
}
}
thay đổi nội dung bởi: nhamdtk4, 18-11-2009 lúc 09:37 AM. |
|
|
|
|
|
|