Solved

save to .doc faster or more reliably

Posted on 2001-06-11
14
168 Views
Last Modified: 2010-05-02
I have a timer which over a 4 second period reads values and saves them to a document  at 1000 times per second:
Sadly the document only shows about 130 of those readings
I am using a pentium 266  
Can i without upgrading reach better results?
0
Comment
Question by:animazoo
14 Comments
 
LVL 1

Expert Comment

by:ShaneCourtrille
ID: 6177932
What kind of code are you using to save to the file?

Are you opening the file at the beginning and keeping it open the entire time?

0
 

Author Comment

by:animazoo
ID: 6177968
ShaneCourtrille
I'm reading values coming in from the lpt port which are coming in at 1000 per second. The code i put in a timer reads the port at a 1000 readings per second
Open ("c:\file.ini") For Output As #1
Print #1, Text1.Text
Close #1
0
 

Author Comment

by:animazoo
ID: 6178047
to be more accurate What i actually have is
Private Sub Timer2_Timer()
Open ("c:\test.ini") For Append As #1
Print #1, Text1.Text
Close #1
End Sub
0
 
LVL 1

Accepted Solution

by:
ShaneCourtrille earned 100 total points
ID: 6178184
Okay.. that makes a lil more sense.

I wouldn't be using Text1.Text as my data source.  Sure you can use it to show the user what the current value is but you're best bet is going to be to save your values to an array.. or queue of some kind would probably be better to actually store the values since you could add to it.  This way you can have the timer following (pseduo-code)

Timer2_Timer

If There are Values In My Queue
   Disable Me
   Figure out how many values to write from my queue
   Write Only those values to my queue
   Enable Me
End If

The only problem with this is that while you're writing the values out your code won't be doing its port readings.  Why not just write the values as you read them from the port?
0
 

Author Comment

by:animazoo
ID: 6178233
ShaneCourtrille
that makes sense
i will try that  and let you know how i get on tomorrow
Thanks for now
0
 

Author Comment

by:animazoo
ID: 6178246
ShaneCourtrille

before tomorrow
could you kindly give some pointers on writing directly from source to an array or queue?
0
 
LVL 1

Expert Comment

by:ShaneCourtrille
ID: 6178297
Unfortunately I don't have any code which I can provide you with.  There are a few articles on the subject available at DevX.Com under the Visual Basic Programmers Journal area IF you have a membership there.  Otherwise your best bet is going to be to do some searching online and see what people have come up with.  
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:animazoo
ID: 6178312
ShaneCourtrille
Thanks
0
 
LVL 1

Expert Comment

by:ShaneCourtrille
ID: 6178680
Go check out this for setting up a Linked List:  

http://support.microsoft.com/support/kb/articles/Q166/3/94.asp

You can use this to do queuing.  Add items to the list.. then remove them from it.  You could even add another field (as long as you were only adding to the end of the list) giving a 'stop' point to check against.
0
 

Author Comment

by:animazoo
ID: 6179037
ShaneCourtrille
Your help has put on the scent
0
 

Author Comment

by:animazoo
ID: 6180321
"I feel after reading the above link that i have the answer but now to understand the answer!"
0
 

Author Comment

by:animazoo
ID: 6180732
SimonCourtrille
If I could get to manipualate this part of the queuing

Set head = New Node          
        head.key = 0                
        Set curr = head              
        For i = 1 To 30  
          Set curr.pnext = New Node  
          Set curr = curr.pnext      
          curr.key = i              
        Next i
What i need to do is put my set of approx 4000 figures into this code e.g
For i = 1 to my set of figures?
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7135880
Hi animazoo,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will suggest to:

    Accept ShaneCourtrille@idg's comment(s) as an answer.

animazoo, if you think your question was not answered at all or if you need help, you can simply post a new comment here.  Community Support moderators will follow up.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
0
 
LVL 1

Expert Comment

by:Computer101
ID: 7168345
Comment from expert accepted as answer

Computer101
E-E Moderator
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now