PIC Vietnam

Go Back   PIC Vietnam > Microchip PIC > Các ngôn ngữ lập trình khác (CCS C, HT PIC,...)

Tài trợ cho PIC Vietnam
Trang chủ Đăng Kí Hỏi/Ðáp Thành Viên Lịch Bài Trong Ngày Vi điều khiển

 
 
Ðiều Chỉnh Xếp Bài
Prev Previous Post   Next Post Next
Old 05-11-2008, 01:34 PM   #1
nguyenquoctoan
Đệ tử 6 túi
 
Tham gia ngày: Nov 2007
Nơi Cư Ngụ: BK TP HCM
Bài gửi: 136
:
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ử
nguyenquoctoan vẫn chưa có mặt trong diễn đàn   Trả Lời Với Trích Dẫn
 


Quyền Sử Dụng Ở Diễn Ðàn
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is Mở
Smilies đang Mở
[IMG] đang Mở
HTML đang Tắt

Chuyển đến


Múi giờ GMT. Hiện tại là 04:07 AM.


Được sáng lập bởi Đoàn Hiệp
Powered by vBulletin®
Page copy protected against web site content infringement by Copyscape
Copyright © PIC Vietnam