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 26-11-2009, 09:57 AM   #30
phuong_dtk4s
Nhập môn đệ tử
 
Tham gia ngày: Apr 2009
Bài gửi: 2
:
em có câu hỏi muốn mọi người giúp đỡ":đó là code của em viết để truyền nhận dữ liệu nhung ma sao nó mời chỉ truyền từ máy tính xuống nhưng tù vi điều khiên thì chưa có truyền lên máy tính được..
code VB:
Private Sub cmdexit_Click()
If MSComm1.PortOpen = True Then
MSComm1.PortOpen = False
End If
Unload Me
End Sub

Private Sub Cmdsend_Click()
MSComm1.Output = Text1.Text

End Sub

Private Sub Form_Load()
Dim t As Integer
Dim a As Integer
Me.BackColor = RGB(255, 155, 255) 'Returns Red
Label1.BackColor = RGB(255, 0, 0) 'Returns Red
Cmdsend.BackColor = RGB(255, 255, 0) 'Returns Red
MSComm1.CommPort = 1
MSComm1.Settings = "9600,o,8,1"
MSComm1.PortOpen = True
End Sub
Private Sub MSComm1_OnComm()
If MSComm1.CommEvent = comEvReceive Then
text2.Text = MSComm1.Input
End If
End Sub
CODE VI DIEU KHIỂN
#include <16f877.h>
#FUSES NOWDT, HS, NOPUT,NOPROTECT, NODEBUG, NOBROWNOUT, NOLVP, NOCPD, NOWRT
#use delay(clock=20000000)
#byte portb =0x06
#byte portc =0x07
#byte porta =0x05
#use rs232(baud=9600, parity=N, xmit=pin_C6, rcv=pin_C7, bits=8)
char t;
int8 i;
#INT_RDA
void rda_isr()
{
t=getc() ;
if (t==103)
{
porta=0xff;
delay_ms(300);
porta=0x00;
putc(T);
}
//putc(t);
}
void main()
{
set_tris_b(0);
set_tris_c(0x80);
set_tris_a(0);
enable_interrupts(INT_RDA) ;
enable_interrupts(GLOBAL) ;
while(1)
{
portb=t;
;
}
}
phuong_dtk4s 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:09 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