Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27411

RS 232 Send and receive.

$
0
0
I already got a great tip in https://www.vbforums.com/showthread....10#post5556110

So i'm back again with a new question.

in the G-Code Editor i'm writing for my EMCOturn 120 CNC Lathe, i have the Editor part more or less sorted out.

I now am facing the challenge of sending and receiving programs.

Sofar i have made a new project, just for testing, and as soon as i have figured everything out, i will copy that code to the Editor project.

What i have sofar:

Code:

Imports System
Imports System.Threading
Imports System.IO
Imports System.IO.Ports
Imports System.IO.Ports.SerialPort


Public Class Form1
    Dim EMCOmport As SerialPort
    Dim EMCOmport_DataReceived As String

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Try
            EMCOmport = New SerialPort()
            With EMCOmport
                .PortName = "Com1"
                .BaudRate = 2400
                .Parity = 2
                .StopBits = 1
                .DataBits = 7
                EMCOmport.Open()
            End With
        Catch
        End Try

    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

        EMCOmport.Write(TextBox1.Text)
    End Sub

End Class

For Testing i have hooked up my Trusty old Psion Series 5.. and whatever Code i put in the textbox on the Form is transmitted to the Psion as soon as i hit that Button1.

That all works fine and dandy.

I could already use that to transmit programs to the Lathe
(By the way.. here she is.. ain't she pretty? :bigyello:
Name:  EMCO6.jpg
Views: 43
Size:  15.6 KB

I now need to figure out how to get a program from the machine to the PC, because sometimes i need to make an adjustment in the program, which i do with the editor of the CNC Control (the left part of the machine), and in order to have my backup the same as the programs in the machine, i want to be able to send the program back to the machine.
This will also enable me to do bigger changes in the program, like changing the order of operations, by selecting parts of the program, and moving them to another place in the program.

Do i have to make some sort of "Event" that monitors any incoming data?..and how do i do that?..
Any help would be greatly appreciated
Attached Images
 

Viewing all articles
Browse latest Browse all 27411


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>