Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

visual basic 6 with pic microcontroller

Status
Not open for further replies.

kotsam

Member level 1
Joined
Nov 16, 2005
Messages
37
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,606
HI ALL,

Can anybody tell me how can I send ascii code from the visual basic to the pic microcontroller, by using rs232 and max232 from com1, for example I want to send ‘0’ to the pic which d’48’ how can I do that


thanks all
 

kotsam

Member level 1
Joined
Nov 16, 2005
Messages
37
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,606
yes, i've seen this website ... but as you can see it's sending command just data ...
what i mean is to use the ascii code
 

dipal_z

Full Member level 5
Joined
Apr 21, 2005
Messages
278
Helped
37
Reputation
74
Reaction score
7
Trophy points
1,298
Location
India
Activity points
3,008
First you need to configure PIC UART to connect to PC serial port. Then using the MSComm ActivX control in VB you can send anything you want to your PIC board.
 

kotsam

Member level 1
Joined
Nov 16, 2005
Messages
37
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,606
hello to you all,

first thanks alot for the reply,

let have example to understand that better , to create command button in the visual basic and lets say if i press this button it's gonna send the character '0' which is d'48'(ACSII CODE) to the pic first i've to configure the MScomm

i did that so far :

Option Explicit

Private Sub cboBaud_Click()

On Error GoTo BaudErr

If MSComm1.PortOpen Then
MSComm1.PortOpen = False
End If
MSComm1.Settings = cboBaud.Text & ",n,8,1"
MSComm1.PortOpen = True

BaudErr:

If Err <> 0 Then
MsgBox Error$(Err)
End If

End Sub

so now, the problem how i'm going to send the d'48' to the pic,

thanks
 

Moof

Full Member level 2
Joined
Nov 21, 2003
Messages
149
Helped
7
Reputation
14
Reaction score
3
Trophy points
1,298
Location
Argentina
Activity points
1,230
to write the character that you want to send, just make this:


mscomm1.output='0'

thats all you have to do

and for read the buffer
dim x as string
x=mscomm1.input

if you have more problems, go to msdn and look for mscomm control
 

kotsam

Member level 1
Joined
Nov 16, 2005
Messages
37
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,606
i've question it this command mscomm1.output='0' going to send d'48' to the serail port or just character
 

Moof

Full Member level 2
Joined
Nov 21, 2003
Messages
149
Helped
7
Reputation
14
Reaction score
3
Trophy points
1,298
Location
Argentina
Activity points
1,230
it is the same, character 0 is equal decimal 48 or hexadecimal 30, just look into the ascii code!!.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top