Results 1 to 7 of 7

Thread: RS232 communications with VB6

  1. #1
    Registered
    Join Date
    Jul 2003
    Location
    Glenville, NY
    Posts
    2
    Downloads
    0
    Uploads
    0

    RS232 communications with VB6

    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


  2. #2
    Registered
    Join Date
    Aug 2005
    Location
    Australia
    Posts
    1
    Downloads
    0
    Uploads
    0
    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


  3. #3
    Registered
    Join Date
    May 2004
    Location
    Sweden
    Posts
    5
    Downloads
    0
    Uploads
    0

    VB -> RS-232

    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...


  4. #4
    Registered Rekd's Avatar
    Join Date
    Apr 2003
    Location
    teh Debug Window
    Posts
    1,876
    Downloads
    0
    Uploads
    0
    Quote Originally Posted by nickz
    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. 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...

    Code:
    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
    Matt
    San Diego, Ca

    ___ o o o_
    [l_,[_____],
    l---L - □lllllll□-
    ( )_) ( )_)--)_)

    (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)


  • #5
    Registered
    Join Date
    Jul 2003
    Location
    Glenville, NY
    Posts
    2
    Downloads
    0
    Uploads
    0
    thanks guys,
    I appreciate the feedback.


  • #6
    Registered ghyman's Avatar
    Join Date
    Feb 2005
    Location
    USA
    Posts
    221
    Downloads
    0
    Uploads
    0
    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!
    Attached Files Attached Files


  • #7
    Registered
    Join Date
    Dec 2005
    Location
    Canada
    Posts
    31
    Downloads
    0
    Uploads
    0
    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...
    http://smackaay.com
    Visit my site


  • Posting Permissions


     


    About CNCzone.com

      We are the largest and most active discussion forum from DIY CNC Machines to the Cad/Cam software to run them. The site is 100% free to join and use, so join today!

    Follow us on

    Facebook Dribbble RSS Feed


    Search Engine Friendly URLs by vBSEO ©2011, Crawlability, Inc.