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.

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

endif<br />

if ready = 1 then<br />

VA_Saccess(1,VC_HANDLE)= if<br />

0 then<br />

VA_Redraw (1,VC_HANDLE)<br />

VA_Srelease(1,VC_HANDLE)<br />

endif<br />

endif<br />

3.3.8.21.3 Example for C Programming<br />

#include <br />

#include <br />

#include <br />

UINT _GLOBAL ready;<br />

unsigned long VC_HANDLE;<br />

_CYCLIC void Cyclic(void)<br />

{<br />

if (!ready)<br />

{<br />

VC_HANDLE = VA_Setup(1 "vga"); ,<br />

if (VC_HANDLE)<br />

ready = 1;<br />

}<br />

if (ready)<br />

{<br />

if (!VA_Saccess(1,VC_HANDLE))<br />

{<br />

VA_Srelease(1,VC_HANDLE);<br />

}<br />

}<br />

}<br />

VA_Redraw (1,VC_HANDLE);<br />

3.3.8.22 Requirements and Initialization − VA_Saccess<br />

This is one of the most important functions in the VISAPI. VA_Saccess makes it possible to carry out drawing<br />

operations.<br />

Drawing is ONLY possible if this function returns ERR_OK. This means that this function has to be called before<br />

any drawing commands. If ERROR_BUSY is returned, the VA_Saccess function must be called again in the<br />

next cycle. This occurs until ERR_OK is returned.<br />

Important:<br />

No VISAPI function can be used until VA_Saccess(...) returns ERR_OK.<br />

After that, any number of VISAPI functions can be executed. After all of this, VA_Srelease must be called in<br />

each case.<br />

The following rules must absolutely be followed:<br />

• Drawing functions can only be written between a VA_Saccess and VA_Srelease block<br />

• VA_Srelease should only be called if VA_Saccess returned ERR_OK.<br />

3.3.8.22.1 Parameter<br />

I/O Parameter Type Meaning<br />

IN enable BOOL This function is only executed if enable is TRUE.<br />

IN VCHandle UDINT The handle returned by VA_Setup<br />

OUT Return Value UINT Not equal to 0 if error occurs<br />

3.3.8.22.2 Example for Automation Basic<br />

(* cyclic program *)<br />

if ready 1 then<br />

VC_HANDLE = VA_Setup(1 "vga") ,<br />

3.3.8.21 Graphics and Text Output − VA_Redraw 157

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

Saved successfully!

Ooh no, something went wrong!