View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default Mscomm1 buffer problem

In the userform there is a caption and a name. the name needs be changed to
match the code. The name is the first line in the userform properties
windows and is what the code actually uses to identify the userrform. the
caption is just a text string for display puposes only. The name and the
caption can be different.

"gtslabs" wrote:

I have the following code that reads a Data Acquisition system. It is
suppose to put the data from CALL 1 into textbox1 and CALL 2 into
textbox2. However they are comming back reversed. I checked my
userform and I have the textboxs labeled correctly (not reversed)

When I comment out either channel it put the data in the correct
textbox.
I eventually need 5 channels. My system will not read all the
channels simultaneously so I have to loop thru each channel to get its
value.
I have tried varying a delay to see if the buffer is getting updated
too fast but I have not had luck with that approach.

I was looking for a feedback to know the buffer is complete before
outputing to the form. I have my bufferlength set to 0 so it brings it
in all at once instead of each bite.

What can I do here to correct this problem?
Thanks in advance.

BTW: Netcomm1.ocx is the free version of MSCOMM1.ocx. The only
difference is the "input" needs the "data" added.


Private Sub CommandButton21_Click() ' Stream Data into Channels

CommandButton21.Enabled = False
CommandButton23.Enabled = True

C1 = True

Do While C1 = True

Buffer1$ = ""
NETComm1.Output = "CALL 1" & Chr(13) ' retrieve reading
from Serial Device
Buffer1$ = Buffer1$ & NETComm1.InputData
TextBox1 = Application.Clean(Buffer1$)
TimedDelay (0.5)

Buffer2$ = ""
NETComm1.Output = "CALL 2" & Chr(13) ' retrieve reading
from Serial Device
Buffer2$ = Buffer2$ & NETComm1.InputData
TextBox2 = Application.Clean(Buffer2$)
TimedDelay (0.5)
Loop
End Sub