Basic Interfacing from PIC to PC via Serial Communication

Status
Not open for further replies.

pengasus

Newbie
Joined
Sep 25, 2012
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Philippines
Activity points
1,329
Greetings... We are to establish basic communication between a PC and a Microcontroller using Visual Basic 6.0...

in our microcontroller program... once it received "1", "2", "A", or "B" it will transmit Strings to the PC that says...

"I Have received (1, 2, A or B)"

NOw we are trying it using VB 6.0...

here is our prgram...


Code Visual Basic - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Private Sub Command1_Click()
MSComm1.Output = Text1.Text [I]'send 1, 2, A, or B[/I]
End Sub
 
Private Sub Command2_Click()
End
End Sub
 
Private Sub Form_Load()
MSComm1.CommPort = 1
MSComm1.Settings = "9600, N, 8, 1"     [I]'Port Settings[/I]
MSComm1.InputLen = 0
MSComm1.PortOpen = True
End Sub
 
'Now this is the problem we can't see the reply from the MCU... but we tried it in MikroC UART Terminal and its working... we're having problems in VB 6... what are the right codes to be used to make it work?? 
 
Private Sub MSComm1_OnComm()
 If (MSComm1.CommEvent = comEvRecieve) Then    
  Text2.Text = Val(MSComm1.Input)
  
 End If
 End Sub

 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…