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’m getting an error on the readout.

Code
Private Sub cmdHeidenhain_Click()

Dim Buffer As Variant
Dim Arr() As Byte

' Set and open port
MSComm1.CommPort = 1
MSComm1.PortOpen = True

' Set InputMode to read binary data
MSComm1.InputMode = comInputModeBinary

' Wait until 10 bytes are in the input buffer
Do Until MSComm1.InBufferCount < 10
DoEvents
Loop

' Store binary data in buffer
Buffer = MSComm1.Input

' Assign to byte array for processing
Arr = Buffer

End Sub

This is the code that I found in the help file.

I’m not sure what to do with the Variable Arr ?? My plan is to input data and put it into a text box so my app. can use it in my equation.

Thanks for any help

Reston