Ðề tài: PIC18F2620 + rs232
View Single Post
Old 17-12-2006, 09:11 PM   #7
littlephoc
Đệ tử 3 túi
 
Tham gia ngày: Dec 2006
Bài gửi: 60
:
board của mình đã được hàn con thạch anh 4Mhz vào rồi. thấy đề là OSC-2003 4.000MHZ BURNON (vị trí số 10 như trong user guide)
Đây là đoạn code mình viết và bấm theo đồng hồ thể thao thì mỗi cái nhấp nháy nó chính xác 1 giây:

#include <18F2620.h>

#fuses HS,NOWDT,PUT,NOPROTECT,NOLVP
#use delay(clock=20000000)
#define preload 57723
static int counter =0;
#int_timer0
void intval()
{
static unsigned char i=0xBB;
static int flag = 0;
rotate_right(&i,1);
output_b(i);
}



void main()
{
int status;
char value;
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_16);
set_timer0(preload);
enable_interrupts(INT_TIMER0);
enable_interrupts(GLOBAL);
output_b(0xff);
status=1;
while(1)
;

}
littlephoc vẫn chưa có mặt trong diễn đàn