LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

I need help making a square that scans across a screen.

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

0 Kudos
Message 1 of 8
(2,671 Views)

See if this gives you any ideas on a direction to take.

 


"Should be" isn't "Is" -Jay
Message 2 of 8
(2,650 Views)

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.

0 Kudos
Message 3 of 8
(2,635 Views)

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

Message 4 of 8
(2,595 Views)

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

--------------------------------------------------------------------------------------------------------------------------
Help the forum when you get help. Click the "Solution?" icon on the reply that answers your
question. Give "Kudos" to replies that help.
--------------------------------------------------------------------------------------------------------------------------
Message 5 of 8
(2,564 Views)

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

0 Kudos
Message 6 of 8
(2,538 Views)

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

0 Kudos
Message 7 of 8
(2,531 Views)

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.

See this thread.

 

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

--------------------------------------------------------------------------------------------------------------------------
Help the forum when you get help. Click the "Solution?" icon on the reply that answers your
question. Give "Kudos" to replies that help.
--------------------------------------------------------------------------------------------------------------------------
Download All
0 Kudos
Message 8 of 8
(2,514 Views)