23.11.2012 Views

2 Visual Components Manuals

2 Visual Components Manuals

2 Visual Components Manuals

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

esponsible for managing access.<br />

4.11.11.2 Requirements<br />

There are a few rules concerning the VISAPI that must absolutely be observed.<br />

4.11.11.2.1 1. Screen Access<br />

Each VISAPI function which draws something on the screen must be called between the VA_Saccess and<br />

VA_Srelease functions. Several VISAPI drawing functions may be called in one block.<br />

VA_Saccess attempts to reserve access to the screen for the task. If successful, the function returns 0.<br />

Otherwise, it returns a corresponding error code. Drawing functions can only be used if VA_Saccess was called<br />

successfully.<br />

VA_Srelease gives up access to the screen again so it can be used by other tasks or the <strong>Visual</strong> <strong>Components</strong><br />

interpreter.<br />

Warning:<br />

If VA_Srelease is not called after VA_Saccess was successfully called, then other tasks (or the <strong>Visual</strong><br />

<strong>Components</strong> interpreter) cannot access the screen.<br />

If your visualization project uses VISAPI and suddenly 'freezes', then make sure that you have correctly called<br />

VA_Srelease!<br />

Example in the C Programming Language:<br />

if (!VA_Saccess(TRUE, handle))<br />

{<br />

VA_Line(......);<br />

VA_Rect(......);<br />

VA_Srelease(TRUE, handle);<br />

}<br />

4.11.11.2.2<br />

Cyclic Operation<br />

The VISAPI library is designed to operate in cyclic tasks. In particular, this should be considered when using the<br />

VA_Saccess function. If this function returns an error stating that access to the screen is not possible at the<br />

moment, then a new attempt is made in the next cycle.<br />

It usually doesn't make sense to try reserving the screen in the same cycle. An exception might be if VISAPI<br />

drawing functions are carried out in a higher priority task class.<br />

Example in the C Programming Language:<br />

_CYCLIC void main(void)<br />

{<br />

if (!VA_Saccess(TRUE, handle))<br />

{<br />

VA_Line(......);<br />

VA_Rect(......);<br />

VA_Srelease(TRUE, handle);<br />

}<br />

}<br />

4.11.11.2.3 Cycle Times<br />

Like every other control task, a VISAPI task runs during a fixed cycle time. This should be considered when<br />

programming with the VISAPI. Functions which require longer times to carry out drawing functions (i.e. ellipse)<br />

can cause cycle time violations under certain circumstances if they are placed in faster task classes.<br />

If necessary, place the task in a slower task class of use fewer functions in one cycle.<br />

Introduction to <strong>Visual</strong> <strong>Components</strong> 2.3<br />

424 4.11.11.2 Requirements

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!