hi all:
I am trying to write a program using VB6. This program loops (well, not
yet) and reads a constant data stream from a serial port. Then it
outputs the "formatted" data to a textBox and writes it to a file. Well,
I have no Idea how to go about this because I have never used VB. I
think I am making some good progress so far but I need some help to keep
going. What I currently have pops a small window that has an OK button
(which I want to get rid off, but if I do the program does not print to
the textBox), depending on how long I take to click OK it puts different
amounts of streamed data in a buffer, then after I click OK it prints my
3 variables (coming in from the serial port) to the textBox in a
continuous line with many sets of data.
That is what I have, now what I want is a different thing. I want to be
able to print my three variables (x, y, and z axis) separated by a space
on one line for one reading, then the next reading on the next line and
so on. At the same time write to a file with the same format. I think
the main thing for me is to get the input in the right format before
sending it to the textBox or to write to a file.
The data that I have coming in from the serial port is coming at
intervals of 4 sets of data per second (adjustable), there is a space
between the second an third pieces of data per set and a carriage return
after the third. Each set of data contains three values.
My main thing right now is to format the input and print to the textBox
one set of data per line. I gave you all the extra info just in case you
needed it.
This is my code:
Private Sub Command1_Click(Index As Integer)
MSComm1.CommPort = 5
MSComm1.Settings = "9600,N,8,1"
MSComm1.PortOpen = True
MsgBox MSComm1.InBufferCount
MSComm1.InputMode = comInputModeText
Text1.Text = MSComm1.Input
MsgBox MSComm1.Input
MSComm1.PortOpen = False
End Sub
Please advise.