PIC Vietnam

Go Back   PIC Vietnam > Microchip PIC > PIC - Thiết kế và Ứng dụng

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

PIC - Thiết kế và Ứng dụng Ý tưởng cho các sản phẩm sử dụng PIC/dsPIC và các sản phẩm của Microchip

 
 
Ðiều Chỉnh Xếp Bài
Prev Previous Post   Next Post Next
Old 08-03-2012, 10:39 PM   #1
vietnamese177
Nhập môn đệ tử
 
Tham gia ngày: Mar 2012
Bài gửi: 2
:
Cần giúp đỡ về code điều khiển dùng PIC 16F877A

#include <barie.h>
#use rs232(baud=9600,parity=n,xmit=pin_C6,rcv=pin_C7,bi ts=8)
#use fast_io(B)
#byte portB=0x06
#bit lade=portB.0
#bit tren=portB.7
#bit duoi=portB.6
#bit bit1=portB.1
#bit bit2=portB.2
#bit led_dung=portB.4
#bit led_len=portB.5
#bit led_xuong=portB.3
char command='0';// =0 dong barie,=1 mo barie
#INT_RDA
void Receive_isr()
{
command=getc();
}


void main()
{

set_tris_B(0b11000000);
bit1=0;
bit2=0;
setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_OFF);
setup_psp(PSP_DISABLED);
setup_spi(SPI_SS_DISABLED);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
ENABLE_INTERRUPTS(INT_RDA);
ENABLE_INTERRUPTS(INT_RB);
enable_interrupts(global);
// TODO: USER CODE!!
// ban dau dong barie
delay_ms(1000);

led_xuong=0;
lade=0;
do// dong barie 01
{
bit1=0;
bit2=1;
}
while (duoi==1);
//dung 00
bit1=0;
bit2=0;
led_xuong=1;
led_dung=0;
lade=1;
loop:........
.....................

.......................các bác cho em hỏi đoạn code trên sai ở đâu ạ, e test trên proteus ổn, trên PIC thì đo tín hiệu đầu ra các chân RB0 đến RB7 của PIC thì trạng thái của nó ko giống như trong mô phỏng help me!
vietnamese177 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à 02:03 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