Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Member Login

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Eng-Tips
*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...I am very impressed with the site and have already recommended it to one of my associates. I was truly impressed with the quickness in which someone actually responded to my question..."

Geography

Where in the world do Eng-Tips members come from?
bmoynihan (Electrical)
14 Feb 07 5:50
Hi,

I am looking at using access (using VBA) to recieve a text file from a data logger though the serial port.

In the past I have created a program using MSCOMM to recieve data from a bar code scanner, but the amount of data was small and im unsure how it would cope with a large amount of data.

I basically used a timer that checked the buffer, if it wasn't empty then it recieved the data into a function that used the data. But how big is the buffer etc?

The code is used was:-

If mscomm1.InBufferCount >= 1 Then
wait
found (mscomm1.Input)
End If

Anybody got any ideas?

Thanks

Ben
Helpful Member!  Proofseeker (Industrial)
15 Feb 07 12:08
Lucky,

Try something like these examples. You must trigger for individual sources. First see if you can get data to write to a file your ocx creates.
You will have to customize with your own variables in place of "DATA". These may not be functional as is and need to be massaged for your application. As far as the buffer size I'm not sure, maybe in hardware properties. It will help to keep data organized if you identify and write individual files created for each source. I'm no expert here but these examples have helped me in the past. Good Luck
Private Sub Timer1_Timer()

If MSComm1.PortOpen = False Then
    MSComm1.PortOpen = True
End If

If ReadData1 Then

    If MSComm1.InBufferCount >= 1 Then
        temp_data1 = MSComm1.Input
        lastword1 = temp_data1   Returns "Data"
        
        Open "c:\Data1" For Output As #1
        Print #1, "Data,Data1"
        Print #1, "Data1," + lastword1
        Close #1
    End If
        MSComm3.InputLen = 0
   
End If
End Sub

OR....

Private Sub Timer1_Timer()

If SAVEDATA Then    

Dim Fso As New FileSystemObject

    JULIANDATE = Format(Date, "Y")
    JULIANDATE3 = Format(JULIANDATE, "000")
    
        If Not Fso.FolderExists("c:\data") Then
            Fso.CreateFolder "c:\data\"
        End If
        If Not Fso.FolderExists("c:\data\" & DATA & "\") Then
            Fso.CreateFolder "c:\data\" & DATA & "\"
        End If
        FileName = "c:\data\"  & Date & ".csv"
        If Not Fso.FileExists(FileName) Then
            Open FileName For Append As #1
            Print #1, "Time, DATA,"
            Close #1
        End If
        Open FileName For Append As #1
        Print #1, JULIANDATE & "," & JULISNDATE3 & "," & Time & "," & DATA
        Close #1

Set Fso = Nothing
    
End If

End Sub
RajeevCell (Electrical)
16 Feb 07 11:22
bmoynihan,

What you did with a Timer is called hardware-polling.  Another approach is to use interrupts.  In VB it is done using "events".  Investigate about "OnComm" event in MSComm control.  There are examples in MSDN.

Yeasir Rahul
www.voltsmith.com

Yeasir Rahul
http://www.voltsmith.com

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!

Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close