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 27-02-2012, 10:22 AM   #1
yukul
Đệ tử 1 túi
 
Tham gia ngày: Aug 2010
Bài gửi: 22
:
[help me]mo phong khong chay ve hien thi led 7 thanh cho pic 18 dung ccs

ai biết vào giúp em với.e làm mà nó không chạy.đây là code của e.và dưới là file mô phông ạ.


#include <18f4520.h>
#FUSES NOWDT, HS, NOPUT, NOPROTECT, NODEBUG, NOBROWNOUT, NOLVP, NOCPD, NOWRT
#device *=16 adc=8
#use delay(clock=11059200)
char M[10]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x9 0};
int16 num;
int8 nghin,tram,chuc,donvi,i,j;
void hien_thi();

void main()
{
set_tris_c(0x00);
set_tris_d(0x00);
//output_c(0xff);
output_d(0x00);
while(true)
{
for(i=0;1<10000;i++) // dem 0000 den 9999
{
for(j=0;j<50;j++) // toc do dem
{
hien_thi();
}
}
}
}

void hien_thi()
{
nghin=num/1000;
tram=(num%1000)/100;
chuc=(num%100)/10;
donvi=num%10;

output_c(M[donvi]);
output_d(0xfe);
delay_ms(1000);
output_d(0xff);

output_c(M[chuc]);
output_d(0xfd);
delay_ms(1000);
output_d(0xff);

output_c(M[tram]);
output_d(0xfb);
delay_ms(1000);
output_d(0xff);

output_c(M[nghin]);
output_d(0xf7);
delay_ms(1000);
output_d(0xff);
}
File Kèm Theo
File Type: rar pic 18f.rar (43.0 KB, 14 lần tải)
yukul 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à 07:36 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