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 09-06-2010, 03:48 PM   #6
longphi54
Nhập môn đệ tử
 
Tham gia ngày: May 2008
Bài gửi: 2
:
<code>
#include <16f877a.h>
#fuses noprotect,nowdt,nolvp,xt,put
#use delay(clock=4000000)
#use fast_io(a)
#use fast_io(c)
#use fast_io(b)
#use fast_io(d)
#use fast_io(e)
#byte porta=0x05
#byte portb=0x06
#byte portc=0x07
#byte portd=0x08
#byte porte=0x09
#bit d0=portd.0
#bit d1=portd.1
#bit d2=portd.2
#bit d3=portd.3
#bit d4=portd.4
#bit d5=portd.5
#bit d6=portd.6
#bit d7=portd.7
#bit b0=portb.0
#bit b1=portb.1
#bit b2=portb.2
#bit b3=portb.3
#bit b5=portb.4
#bit b4=portb.5
#bit b6=portb.6
#bit b7=portb.7
#bit a0=porta.0
#bit a1=porta.1
#bit a2=porta.2
#bit a3=porta.3
#bit a4=porta.4
#bit a5=porta.5
#bit c0=portc.0
#bit c4=portc.4
#bit c6=portc.6
#bit e0=porte.0
#bit e1=porte.1
#bit e2=porte.2
int8 speed=0;
void main()
{

set_tris_c(0b00000001);
output_c(0);
set_tris_a(0b010000);
output_a(0);
set_tris_d(0b00000000);
output_d(0);
set_tris_e(0b000);
output_e(0);
set_tris_b(0b00000000);
output_b(0);


/////////////////////////////////////
while(1)
{
setup_TIMER_1(T1_EXTERNAL|T1_DIV_BY_1);
set_TIMER1(0);
get_TIMER1();
delay_ms(1000);
setup_timer_1(T1_DISABLED);
speed=get_timer1();
portb=speed;
}
}
</code>
mình viết theo hướng dẫn ở trên. Đọc xung từ RC0 ở timer1 mà sao làm hoài ko chạy vậy ai giúp mình với
longphi54 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à 09:03 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