View Single Post
Old 27-02-2007, 06:27 PM   #70
omen
Đệ tử 1 túi
 
Tham gia ngày: Jan 2006
Bài gửi: 18
:
Chào các bác
Em đang tập lập trình cho con 18f4550 nhưng chỉ định làm 1 cái ctrinh nhấp nháy led thôi mà mãi ko đc
Các chân set high a1 a3 thì sáng, nhưng ko nhấp nháy

Mạch của em chỉ có : chân 11-12 :vcc-gnd , 13-14 : thạch anh +tụ

Code sinh từ CCS C 3.227
Code:
#include "C:\Program Files\PICC\Examples\18f4550\Vinh.h"
#use delay(clock=4000000)
#use fast_io(a)
void main()
{
   setup_adc_ports(NO_ANALOGS|VSS_VDD);
   setup_adc(ADC_OFF);
   setup_psp(PSP_DISABLED);
   setup_spi(FALSE);
   setup_wdt(WDT_OFF);
   setup_timer_0(RTCC_INTERNAL);
   setup_timer_1(T1_DISABLED);
   setup_timer_2(T2_DISABLED,0,1);
   setup_timer_3(T3_DISABLED|T3_DIV_BY_1);
   setup_comparator(NC_NC_NC_NC);
   setup_vref(VREF_LOW|-2);
   setup_low_volt_detect(FALSE);
   setup_oscillator(False);
   set_tris_a(0x00);
   while(true)
   {
     output_high(pin_a1);
     output_low(pin_a2)
     output_high(pin_a3)
   delay_ms(500);
   delay_ms(500);
    output_low(pin_a1);
    output_high(pin_a2);
    output_low(pin_a3);    
    delay_ms(500);
   delay_ms(500);
     }
}
Em đã thử dùng cả dao động nội nhưng nó vẫn ko chịu chạy, bỏ delay, dùng vòng lặp cũng ko đc
Ko rõ là bị làm sao, mong các bác chỉ giáo, nếu có 1 ctrinh sample cho em thì tốt quá
Hình Kèm Theo
File Type: jpg new1.JPG (62.1 KB, 19 lần tải)
omen vẫn chưa có mặt trong diễn đàn   Trả Lời Với Trích Dẫn