|
Tài trợ cho PIC Vietnam |
Cơ bản về vi điều khiển và PIC Những bài hướng dẫn cơ bản nhất để làm quen với vi điều khiển PIC |
|
Ðiều Chỉnh | Xếp Bài |
09-06-2013, 12:10 AM | #2 | |
Đệ tử 7 túi
Tham gia ngày: May 2005
Bài gửi: 258
: |
Trích:
Code:
#include <16f877.h> #use delay (clock = 16000000) #use rs232 (uart1, baud=9600,parity=n,xmit=pin_c6,rcv=pin_c7 ) #include <string.h> #byte portd=0x08 #byte portb=0x06 #bit t0=portd.0 #bit t1=portd.1 #bit t2=portd.2 #bit t3=portd.3 #bit t4=portd.4 #bit t5=portd.5 #bit t6=portd.6 #bit t7=portd.7 char a[]="sd1"; void main() { char test[3]; int i; set_tris_d (0x00) ; portd = (0x00); while (1) { for (i = 0; i < 3; i++) { test[i] = getc () ; printf ("%c",test[i]) ; } if (strncmp (test, a,3) == 0) portd = 0x01; } }
__________________
viết chương trình cho vdk chạy ổn định là cả một vấn đề. |
|
|
|