March 15th, 2009, 09:47 PM
[VB 2008] Merging Different Concepts Together
This is my first post as I don't like to ask questions without making sure I've exhausted all other means. I'm new to VB2008 and programming in general but I'm learning. I want to do several simple tasks. Doing each separately is easy but when I put them together I don't know what to do. For one thing to work all the code must be changed and everything else doesn't work. I hope you guys can help me out as I'm really lost. I want to:
1. Plot a graph of data from a DAQ. I can do this by using a Timer1_tick method and displaying the data on the linegraph as long as the timer is turned on. I've decided to stick with this method of acquisition. I want to acquire data for long periods of time (perhaps 3 hours) so a timer is pretty good. No problems here.
2. Apply a filter to remove noise from the plot dynamically as the data comes in so that I get a smooth curve instead of a jagged graph. I know I can do this with for loops if I'm using an array. But how do I do it since I'm using a timer? Here the problem begins.
3. Log every piece of the filtered data that the timer is getting to be exported to a CSV file. I learned how to do this with do loops but not with a timer or array. But I really need to use the timer this time.
4. Acquire statistics for the data like maximum value, minimum value, and average value dynamically as the data changes. I know how to do this with an array of data after all the data is acquired. But How do I do this with a timer while the data is still being collected?
5. Monitor the data coming in to execute an alarm (Or event, like stopping the acquisition) when the data coming in has plateaued and is constant (eg: The voltage I'm monitoring starts to become constant and becomes one constant value) - Ok I don't know anything about this.
6. Execute a mathematical operation on the data that has been acquired (post acquisition) like finding gradients and such. Basically this means "How do I now manipulate the data I have and where is this data stored?"
7. Know any good free linegraphs with autoscaling?
I know these things must be a cakewalk for you guys but I'm still clueless about them as I learn bits and pieces but It's hard to put them together.
Here's my starting code that gathers data with a timer. How do I work from here?:
Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As
System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
Timer1.Enabled = False
Private Sub Form1_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
Timer1.Enabled = True
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Timer1.Tick
Dim volt, Temp As Double
volt = DAQ.ReadAnalog(Positive Input Terminal, Negative Input Terminal)
Temp = 50 * volt
LineGraph1.Value = Temp
Label1.Text = Temp.ToString("0.0 Farenheit")
Thanks In Advance!
Tags for this Thread
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.