05-29-2014 02:24 PM
i'm trying to make a program that creates images of a square scanning across a black background. so far all i have is a program that makes one image where i can alter the size of the square and its position. I'm very very new to labview and i need help with the structure that would create all the images of the square scanning across and then shift down and scan across again.
thank you very much,
Joseph Sadler
05-29-2014 03:23 PM
05-29-2014 03:36 PM
I'm having issues figuring out how to open the block diagram of that vi. There is no Window tab on the front pannel of that program.
05-29-2014 07:27 PM
Place the snowflake VI on the block diagram of a new VI so that it appears as a subVI. Then you can open the front panel without the VI running. From there you can open the block diagram.
You might want to go to VI properties >> Execution and uncheck Run when opened. Then save.
Lynn
05-30-2014 03:07 AM
Hi Joseph,
Attached is an example (in LV12) using a 2D picture indicator.
Maybe it will give you some ideas.
An array is created that contains the target locations and size of the squares.
A For Loop iterates through the array to draw (and erase) the squares.
steve
05-30-2014 03:45 PM
Thank you very much, the Squares vi helped a lot. i made some changes to it but now I'm running into an issue. if i, for example set the columns and rows to 100 (and the grid number to 10000) increase the speed of the scan (by making the time delay smaller to say around 200ms or 10ms) the scan becomes increasingly choppy as the program continues to run. if it is set to 500ms the it starts to lag around the 500-600th cycle and then it gets worse from there. At 100ms it starts at around the 150th cycle and at 10ms it starts almost immediately. any idea what would cause this, and how to fix it?
thank you,
Sadler
05-30-2014 04:05 PM
I do not have a fix but can identify the problem. Each time through the loops the size of the "picture" data increases. The picture data is a special kind of string (note the wire type). When I place a String Length function and indicator on that line it starts at 38 and increases to over 750000 for the 100x100 image.
Lynn
05-31-2014 05:11 AM
As Lynn found, there is a memory problem with the vi which didn't show up in my limited testing.
Using Shift Registers with Picture Controls can cause problems.
Try the attached "mod" version.
Then I got to thinking, why redraw the box (2x with "erase") - when you could just move a box around?
(Note: I used a picture for the box, but you could use other objects.)
The "mod1" version does it this way.
steve