![]() |
mình mới tìm thấy bài luận văn này hay lắm
2 Attachment(s)
các bạn xem thử nhé
|
Trích:
Cám ơn Cheers! hoanf |
em muốn tim đồ án đèn giao thông
các bác đã làm đồ án roi ơi?em đang làm đồ án mạch đèn giao thông,mà không có tài liệu,các bác có lai liệu thì giúp em với,thành thật cảm ơn các bác nhá
|
bác 111985 làm về lập trình API thì có 1 số tài liệu nào kô, nếu có post lên mọi người cũng xem với
|
dùng PIC làm mạng giao thông hay chi lam đèn giao thông vậy bồ
|
mình mới viết được chương trình dùng VDk Pic6f877a. Ở đây mình sử dụng bàn phím để chọn các kiểu sáng của đèn led đơn. Nhằm cho các bạn dễ hiểu. Bài sau mình sẽ post hẳn bài về giao tiếp bàn phím với LCD. Port d bàn phím, Port b điều khiển led.
#include <16F877A.h> #device *16adc=8 #fuses xt,nowdt,nolvp,noprotect #use delay(clock=4000000) #use fast_io(b) void main() { output_b(0b11111111); set_tris_b(0); output_d(0b11111111); delay_ms(10); while(true) { output_d(0b11111110); delay_ms(10); if(input(pin_d4)==0)//nhấn phim1 { while(true) { ////////////// kieu1 output_b(0x7f); delay_ms(150); output_b(0xBf); delay_ms(150); output_b(0xef); delay_ms(150); output_b(0xf7); delay_ms(150); output_b(0xfb); delay_ms(150); output_b(0xfd); delay_ms(150); output_b(0xfe); delay_ms(150); ////////////// output_b(0xfe); delay_ms(150); output_b(0xfd); delay_ms(150); output_b(0xfb); delay_ms(150); output_b(0xf7); delay_ms(150); output_b(0xef); delay_ms(150); output_b(0xbf); delay_ms(150); output_b(0x7f); delay_ms(150); if(input(pin_d5)==0||input(pin_d6)==0||input(pin_d 7)==0) break; } } if(input(pin_d5)==0)//nhấn phím 2 { while(true) { /////////// kieu 2 output_b(0x00); delay_ms(150); output_b(0xff); delay_ms(150); if(input(pin_d4)==0||input(pin_d6)==0||input(pin_d 7)==0) break; } } if(input(pin_d6)==0)//nhấn phím 3 { while(true) { //////////////kieu 3 output_b(0x55); delay_ms(150); output_b(0xaa); delay_ms(150); if(input(pin_d4)==0||input(pin_d5)==0||input(pin_d 7)==0) break; } } if(input(pin_d7)==0)//nhấn phím 4 { while(true) { /////////////kieu 4 output_b(0x7e); delay_ms(150); output_b(0xbd); delay_ms(150); output_b(0xdb); delay_ms(150); output_b(0xE7); delay_ms(150); output_b(0xdb); delay_ms(150); output_b(0xbd); delay_ms(150); output_b(0x7e); delay_ms(150); if(input(pin_d6)==0||input(pin_d4)==0||input(pin_d 5)==0) break; } } } } Bạn nào có thắc mắc liên hệ mình theo địa chỉ này nha: ngochai_dt06b@yahoo.com.vn chuc các bạn thành công với VDK PIC nha. |
Trích:
|
Múi giờ GMT. Hiện tại là 04:54 PM. |
Tên diễn đàn: vBulletin Version 3.8.11
Được sáng lập bởi Đoàn Hiệp.
Copyright © PIC Vietnam