Pages: [1]   Go Down
Author Topic: COM Port Communication with VB  (Read 2108 times)
0 Members and 1 Guest are viewing this topic.
Magdeburg
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey Guys,

i'm working for a few hours at the communication between my PC and a Leonardo, but I have a big problem to send data from Arduino to the PC. At first I thought I did a mistake at the serial-read or event function in visual basic. But now I figured out, that the Arduino doesn't send data, if I activate the com-port from my VB-program. However, if I use the standard Arduino serial monitor, I get sent data and the TX LED is blinking. If I'm using my VB script, I can't get a blinking LED, however, the communication in the other direction works well. For example I can send data to the Arduino and the RX LED blinks.

Now the question: Is there any function, I have activate to get the Arduino in a sending mode. I could imagine, It could something have to do with “handshaking”???


Thanks for the help.
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The Leonardo requires that the DtrEnable flag be true. Are you setting it?
Logged

Magdeburg
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

No!
I'll test it in the evening.

Thank you.
Logged

Magdeburg
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

works perfectly,

mille grazie!
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

For future reference, perhaps you could post your VB code for opening the port.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 20
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If I try to use a Terminal program with an Arduino Uno (R3 SMD) under windows 7, I get the message: "The port is not available".

However, when I use the Monitor Serial, I don't get the error and all the data flow fine, so nothing is locking the port....is this the same issue?

Thank you
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
is this the same issue?
No.

Quote
However, when I use the Monitor Serial, I don't get the error and all the data flow fine, so nothing is locking the port
You aren't trying to use the Terminal program at the same time as the Serial Monitor, are you? Have you closed the IDE?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 20
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
is this the same issue?
No.

Quote
However, when I use the Monitor Serial, I don't get the error and all the data flow fine, so nothing is locking the port
You aren't trying to use the Terminal program at the same time as the Serial Monitor, are you? Have you closed the IDE?

Yes, of course I have tried to connect via Terminal after closing the IDE.
It happens the same to me, when using the programming port with the Arduino Due, I can only connect to the Native USB.

What is it then?

Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
It happens the same to me, when using the programming port with the Arduino Due, I can only connect to the Native USB.
That would be logical. The programming port is for, well, programming the Arduino. You aren't programming the Arduino from the Terminal application, are you?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 20
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
It happens the same to me, when using the programming port with the Arduino Due, I can only connect to the Native USB.
That would be logical. The programming port is for, well, programming the Arduino. You aren't programming the Arduino from the Terminal application, are you?

I am not, but wouldn't I be able to communicate to Arduino Uno via Serial.print() and Serial.read() commands?

I don't understand why the port is not available when I try to open it from another program different from Serial Monitor (which is supposed to be the same).
Logged

0
Offline Offline
Tesla Member
***
Karma: 141
Posts: 9470
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
communication between my PC and a Leonardo

Just from looking at other code, the leonardo has some special requirements as to its serial port. probably nothing to do with the comport issue on your pc, but there is something different. If you are using windows, have you looked in device manager at the comport settings for different comports and such? 
Logged

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   smiley-cool

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
the leonardo has some special requirements as to its serial port.
The only difference is that DtrEnable must be set to true.
Logged

Indonesia
Offline Offline
Newbie
*
Karma: 0
Posts: 6
Great Man, Comes great responsibility
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi

I have the same problem
arduino leonardo cant send data to VB 6
but I usually use arduino uno and its perfectly works wether its code or its parameter

I have set DTR enable = true (this is usually for uno)
and set RTS enable = true (after googling this for VB net, )

my code
++++++++++++++++++++++++++++++++++++++++++++++
Private Sub Form_Load()
MSComm1.RThreshold = 1
MSComm1.InputLen = 1
MSComm1.Settings = "9600,n,8,1"
MSComm1.CommPort = 1
MSComm1.PortOpen = True
MSComm1.DTREnable = True
End Sub
Private Sub Form_Unload(Cancel As Integer)
MSComm1.PortOpen = False
End Sub


Private Sub MSComm1_OnComm()
If MSComm1.CommEvent = comEvReceive Then
    Label2.Caption = MSComm1.Input
If Label2.Caption = "1" Then
    Shape4.FillColor = vbRed
    Label3.Caption = "1"
ElseIf Label2.Caption = "2" Then
    Shape5.FillColor = vbRed
    Label3.Caption = "1"
ElseIf Label2.Caption = "3" Then
    Shape4.FillColor = vbRed
    Shape5.FillColor = vbRed
    Label3.Caption = "0"
Else
    Shape4.FillColor = vbGreen
    Shape5.FillColor = vbGreen
    Label3.Caption = "2"

End If
End If
End Sub

++++++++++++++++++++++++++++++++++++++++++++++

any more suggestion ?
Logged

Pages: [1]   Go Up
Jump to: