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 21-02-2008, 02:52 AM   #13
anh_gioi
Đệ tử 6 túi
 
Tham gia ngày: Oct 2006
Bài gửi: 147
:
cach dieu xung

Trích:
#include "C:\Documents and Settings\anh gioi\Desktop\dieu xung\dieu xung02.h"
#use fast_io(b)
#byte portb = 0x06
void ccp1(){
int8 a;
setup_timer_2(T2_DIV_BY_1,255,1);
SETUP_CCP1(CCP_PWM);

while(true){
for(a=1;a<1024;a++){
set_pwm1_duty(a);
delay_ms(2);
}
delay_ms(20);
for(a=1023;a>1;a--){
set_pwm1_duty(a);
delay_ms(2);
}}}

void ccp2(void){
int b;

setup_timer_2(T2_DIV_BY_1,255,1);
SETUP_CCP2(CCP_PWM);

while(true){
for(b=1;b<1024;b++){
set_pwm1_duty(b);
delay_ms(2);
}
delay_ms(20);
for(b=1023;b>1;b--){
set_pwm1_duty(b);
delay_ms(2);
}}}
void main(){

void ccp1(void);
void ccp2(void);
set_tris_b(0xff);
while(true){
if(input(pin_b0)==0)
ccp1();
else
ccp2();
}


}
code này có chỗ nào sai vậy anh? em ko cho hiển thi ccp2 được???
anh_gioi 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à 10:37 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