• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

vb6 serial communication

Status
Not open for further replies.

lish

New Member
Hi
im doin a project which i need to transmit and receive data from vb interface. im using max232 ic and pic 16f84 and vb6.
i need a help to how to use "mscom" command?
what is the purpose of sending ASCII values?

and to start with if anyone can help me writig a simple vb code to turn on a LED by pressing a command button in VB interfac please
thank you
 

Pommie

Well-Known Member
Most Helpful Member
Have a look at this thread. The VB code in that thread displays any received characters. To send characters add a button and code mscomm1.output = "A" to send character A etc.

Mike.
 
Last edited:

lish

New Member
vb communication

yeah
thanx for repling me as soon as possible.
i will try the code you send.
but i need to know that is it only possible to send ASCII charactors trough VB? can i send some control information or some number of bits directly from VB? for an example when a command button is pressed,
11001010 bits should be transmitted via serial port to the microcontroller
can this be done without sending ASCII values?
any example codes please send
thanx again
 

Pommie

Well-Known Member
Most Helpful Member
Just do mscomm1.output = chr(&hca). Or, mscomm1.output = chr(202)

11001010 = 202 decimal = 0xca in hexadecimal.

Mike.
 

lish

New Member
need to connect max232 ic for a com port by using a virtual serial port driver in proteus 7. then short the Tin and Rout pins of the IC to get the sent charactor again in VB interface. seems that the max232 is not working as intended. anyone can help me with the scematic?
thanx
 

ericgibbs

Well-Known Member
Most Helpful Member

Attachments

Last edited:

lish

New Member
thanx for the reply
i have changed the wiring. but no output.
when i short the pins rxd and txd of P1, i can get the sent charactor through the VB interface. but i cant get thet when the IC is connected. is there anyrhin else wrong?
 
Last edited:

ericgibbs

Well-Known Member
Most Helpful Member
thanx for the reply
i have changed the wiring. but no output.
when i short the pins rxd and txd of P1, i can get the sent charactor through the VB interface. but i cant get thet when the IC is connected. is there anyrhin else wrong?
hi,
Do you have pin16 to +5V and pin15 to 0V.?

Measure the voltages on pin2 approx +9V,,, and pin6 approx -9V

Also is pin5 of the 9pin connector used as 0V.

Please post your new circuit.
 
Last edited:

lish

New Member
no.
still i dont use any hardware
i wanted to simulate it on proteus with the virtual serial port emulator and VB interface. need to know why the 232 IC is not working in proteous?
thanx
 

ericgibbs

Well-Known Member
Most Helpful Member
no.
still i dont use any hardware
i wanted to simulate it on proteus with the virtual serial port emulator and VB interface. need to know why the 232 IC is not working in proteous?
thanx
Sorry, I dont use proteus.:)
 

lish

New Member
i need to do data exchange via USART. When PIC MCU receives data, it immediately sends the same data back. If PIC is connected to the PC i can get them back via a vb interface. im using microC and use the example code given in microC. but seems not working. complilng is ok. atachted the code here. if anyqne can help me??
is there anything wrong or need to add somethin more
 

Attachments

  • 21.5 KB Views: 123

lish

New Member
hi

I m tryng to send data from VB through serial communication using MAX232 and read them in a microcontroller. sofar i could manage to send ASCII charactores through VB. I need to send binary value through VB.Lets say if i press a command button i need to send '10001110' value to the microcontroller. what are the changes that i need to make in VB. if anyone can help me please.

my VB code is below





Private Sub Form_Load()
MSComm1.Settings = "2400,N,8,1"
MSComm1.InputLen = 1
MSComm1.CommPort = 2
MSComm1.PortOpen = True
MSComm1.RThreshold = 1
End Sub



Private Sub Form_Unload(Cancel As Integer)
Close #1
End Sub



Private Sub MSComm1_OnComm()
If MSComm1.CommEvent = comEvReceive Then
txtRx.Text = txtRx.Text & MSComm1.Input
End If

End Sub



Private Sub cmdtx_Click()

MSComm1.Output = txtTx.Text (123)

End Sub
 

ericgibbs

Well-Known Member
Most Helpful Member
hi,
You may find this subr easier to follow, note the 'open as Binary'.
 

Attachments

lish

New Member
slider

hi
i need to use the slider bar in VB6. i use min = 0 and max = 10. when drag the slider bar anong 0 to 10 i need different ten binary values to store in a variable.if anyone can help me what event i should use and how to use it wit a sample code
thanx
 
Status
Not open for further replies.

EE World Online Articles

Loading
Top