Hi everyone
I could use some pointer on serial port programming. I haven’t done any hardware type programming as of yet. I have a Heidenhain Length gauge. It uses photoelectric linear encoders. This instrument has a digital readout with a RS232 output line. I’m looking to get the Value off the digital readout and bring it into my program.
I have put a mscomm32.ocx onto my application. I’ve been reading up on serial port stuff.
I have the input mode set to text because when it is set to binary i get nothing!
Code
Private Sub cmdHeidenhain_Click()
' Open the serial port
MSComm1.CommPort = 1
MSComm1.Settings = "9600,N,7,2"
MSComm1.PortOpen = True
' Tell the control to read entire buffer when Input is used.
MSComm1.InputLen = 0
If MSComm1.PortOpen Then
' Send the keystroke to the port.
' Now " Ctrl + B" to Buffer
MSComm1.Output = Chr$(2)
aaa = MSComm1.Input
Text1.Text = aaa
' I get a value here in the MSComm1.Input of
' -.37184 and three square boxes
' but i cannot assign it to my variable Text1
' This is my text box
' Unless Echo is on, there is no need to
' let the text control display the key.
' A modem usually echos back a character
If Not Echo Then
' Place position at end of terminal
txtTerm.SelStart = Len(txtTerm)
End If
End If
MSComm1.PortOpen = False
End Sub
Thanks for any help
reston
