![]() |
Port I/O của PIC18F4550
thưa bác namq e, sử dụng con 18f4550,mà sao viết chương trình test pic,portc có vấn đề
#include <18f4550.h> #fuses NOWDT,PUT,HS,NOPROTECT #use delay(clock=20000000) #byte porta=0xf80 #byte portb=0xf81 #byte portc=0xf82 #byte portd=0xf83 #byte porte=0xf84 ///khai bao dia chi port void main(void) {set_tris_a(0x00); set_tris_b(0x00); set_tris_c(0x00); set_tris_d(0x00); set_tris_e(0x00); while (1) { porta=0; delay_ms(250); porta=255; delay_ms(250); portb=0; delay_ms(250); portb=255; delay_ms(250); portb=0; delay_ms(250); portb=255; delay_ms(250); portc=0x00; delay_ms(250); portc=0xff; delay_ms(250); portd=0x00; delay_ms(250); portd=0xff; delay_ms(250); porte=0x00; delay_ms(250); porte=0xff; delay_ms(250); }} port c có 2 chân kô nháy led,các port khác bình thường,pic mới mua,bác namq xem thử |
PIC18F4550 không có chân RC3 (chân này đã được dành riêng để nối tụ ổn định điện áp cho module USB ngoại vi). Theo datasheet, các chân RC4 và RC5 khi dùng ở chế độ digital chỉ có thể hoạt động như ngõ vào. Do đó, bạn không thể dùng 2 chân này để điều khiển LED. Để xuất dữ liệu ra port I/O, nên dùng LATx thay vì PORTx với PIC18F.
Thân, |
thì ra bác trả lời ở đây,em hiểu rồi cảm ơn bác nhiều
|
Múi giờ GMT. Hiện tại là 10:25 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