Trích:
Nguyên văn bởi phamtrieu138
Code:
#include "C:\Documents and Settings\User\My Documents\thu pwm\hhff.h"
#byte portc=0x07
#use fast_io(c)
void bam()
{
set_pwm1_duty(800);
set_pwm2_duty(677);
}
void main()
{
setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_OFF);
setup_psp(PSP_DISABLED);
setup_spi(FALSE);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
setup_timer_1(T1_INTERNAL|T1_DIV_BY_1);
setup_timer_2(T2_DIV_BY_1,255,1);
setup_ccp1(CCP_PWM);
setup_ccp2(CCP_PWM);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
set_tris_c(0);
bam();
while (1)
{
}
}
sao c1,c2 ra toàn bằng 0 vậy. có khai báo gì đặc biệt hay phai treo trở ở chân c1,c2 vậyy??????
|
Bạn vẫn chưa cho biết bạn dùng PIC nào. Bạn chưa cho biết bạn chạy mô phỏng hay trên mạch thực. Nếu bạn thử trên mạch thực thì sơ đồ mạch của bạn ra sao? Nếu bạn mô phỏng thì sơ đồ mạch dùng để mô phỏng ra sao?
Thân,