Test and Measurement Forum

Samples and drawing lines

Post general discussions on using our drivers to write your own software here

Samples and drawing lines

Postby Martijn » Mon Nov 10, 2003 7:36 am

Hellow,

I'm writing my own software in VisualBasic and i'm using the ADC212. The project i'm using this ADC is to measure a signal and visualize these samples on the comuters monitor.

This visualisation is done with lines, drawn om a form (in VB). So, for eatch sample that is taken, i draw a line on my form. The startpoint is the endpoint of the previous sampleline, the end point is the new samplevalue.

What i want to know is: What is the fastest way to take samples and draw them on a form. As you may know, visualisation is very slow. So i want to do it the fastest way possible.

Anybody who has done this before or knows some kind of sollution for this problem?

Thanks,
Martijn
Martijn
 

Postby markspencer » Mon Nov 10, 2003 8:18 am

Hi,

Unfortunately, I am unalbe to advise on this issue but hopefully, someone else on the forum can point you in the right direction.

Best regards,
Regards,

Mark Spencer
User avatar
markspencer
Site Admin
Site Admin
 
Posts: 598
Joined: Wed May 07, 2003 9:45 am

VB - Speed - it's all relative

Postby guest » Wed Nov 12, 2003 4:41 pm

Microsoft operating environments are very dependant on the performance of the graphics card for overall system performance and your graphics card will actually have more determination over the performance than anything you will probably do. However here are a couple of the more obvious pieces of advice:-

1) Make all calculations Integer using % and explicitly declare them.

2) Limit use of arrays and definitaly don't use RE-DIM.

3) Don't use Procedure / Function calls in time critical sections.

4) Use Local Variables if possible.

I am sure there are more and I remember articles on the Microsoft web site on these issues (I have been using VB since Rev 1 and have forgotten more than I would like)..

How do you decide how long something takes ?

Benchmark

e.g.
1) Create a form
2) Attach some code to it e.g.
3) Time it


Sub Form_MouseDown (Button As Integer, Shift As Integer, X As Single, Y As Single)
Print Time
For I = 1 To 1000000
Picture1.Line (0, 0)-(1000, 1000)
Next I
Print Time
End Sub

The example assumes that you have a FORM with a PICTURE control and that there is some room around the PICTURE control.

Click on the form and it will perform 1 millon line draw operations. As there are no variable or calculations involved this is about as quick as you are going to get for line drawing operations.

Run the code and click on the FORM, two times should print out. I get about 71,000 line draw operations per second using VB3 on a 450Mhz Windows 2000 P.C.


Good luck

P.S.
I live in hope of a fix for Labview internal temperature reference access.
Driver Rev 5.08 to ???
guest
 

Postby Guest » Mon Nov 24, 2003 10:04 am

Sorry for the very late reaction, but THANKS!
I will try your advises...

Greets,
Martijn
Guest
 


Return to General Software Discussions

Who is online

Users browsing this forum: No registered users and 1 guest