CCS bị lỗi ?
Anh chị ơi, e chỉ muốn thử tạo xung 120khz ra ở chân ccp1. Xung tạo ra không đúng với ý của e chút nào. E dùng bản CCS4.104. nhưng thử lại các bản cũ khác cũng vẫn vậy (chu kì xung đều lớn hơn gấp đôi). E hết cách rồi.
#include <16F877A.h>
#device adc=8
#FUSES NOWDT //No Watch Dog Timer
#FUSES HS //High speed Osc (> 4mhz for PCM/PCH) (>10mhz for PCD)
#FUSES NOPUT //No Power Up Timer
#FUSES NOPROTECT //Code not protected from reading
#FUSES NODEBUG //No Debug mode for ICD
#FUSES NOBROWNOUT //No brownout reset
#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOCPD //No EE protection
#FUSES NOWRT //Program memory not write protected
#FUSES RESERVED //Used to set the reserved FUSE bits
#use delay(clock=7680000)
void main()
{
setup_timer_2(T2_DIV_BY_1,15,1);
setup_ccp1(CCP_PWM);
set_pwm1_duty(32);
while (1){}
}
|