View Full Version : RS232 communications with VB6


nickz
08-03-2005, 08:02 AM
Looking for a jumpstart to create a "simple" VB program to send and receive G- code files, (from a PC to a CNC machine). Any help would be appreciated.
Thanks

1234marko
08-29-2005, 06:08 PM
To Nickz,

I think you will be better using a PIC on board the CNC if using RS232. Have a look for Milinst (I think it's www.milinst.com,just go to the download area) They have a CNC kit there (not very good) but you can download some VB and PIC source which will get you started...

regards

1234marko

jaako16
08-30-2005, 02:48 PM
Hi

I think there is a good example of serial communication in the vb examples folder, I belive it's called vbterm which is a simple terminal program.

I can also recommend the book, The complete serial port by Mr. Jan Axelson, it is awsome and contains a ton of examples.

That was my two cents on the subject...

Rekd
08-30-2005, 03:25 PM
Looking for a jumpstart to create a "simple" VB program to send and receive G- code files, (from a PC to a CNC machine). Any help would be appreciated.
Thanks

I made one a while back in VB6. It's called SComm (http://cnczone.com/forums/showthread.php?t=939). I won't give you the code, but if you have specific questions I'll be glad to help.

The VBterm is a good place to start but does not cover some of the things you'll need for this type of RS232 communications.

In it's very simplest form, you could use something like what I've done inside a Microsoft Access database...

Private Sub cmdSend_Click()
Dim strNCLink As String
Me.txtCustomer.SetFocus
strNCLink = "C:\Foldername\" & Me.txtCustomer.Text & "\" & Me.NCName
On Error GoTo Hell
Open strNCLink For Input As #1
MSComm1.InputLen = 0
MSComm1.PortOpen = True
Do While Not EOF(1)
Line Input #1, Rec
CharSent = CharSent + Len(Rec)
MSComm1.Output = Rec & vbCrLf
lblBytes.Caption = CharSent & " bytes"
DoEvents
Loop
Hell:
On Error Resume Next
Close
MSComm1.PortOpen = False
MsgBox "Oh, crap. Something bad just happened...", vbCritical, "Error Hit While Transferring"
End Sub

nickz
09-12-2005, 01:30 PM
thanks guys,
I appreciate the feedback.

ghyman
10-20-2005, 06:20 PM
I was given the attached VB files in response to a similar question.

The code is standard VB, but the comments are in French.

Still, a good tutorial!

Tarkus
12-13-2005, 09:24 PM
The only problem with the Comm Control is the fact that it only supports up to Port 16... while this is OK for most things, if you ever want to use it in a modern serial hub, you're outta luck.

I'm not sure what the solution is to that...