23.11.2012 Views

2 Visual Components Manuals

2 Visual Components Manuals

2 Visual Components Manuals

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

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

endif<br />

endif<br />

3.3.8.32.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 />

3.3.8.33 Manual Project Control − VA_StartProject<br />

A stopped project can be started again with the VA_StartProject command.<br />

A project can be stopped from the PLC program by the VA_StopProject function, or the 'Manual Project Start'<br />

option could have been transferred. Starting a project manually allows driver parameters to be changed with<br />

VA_SetUserParam, as well as other preparatory measures like variable initialization.<br />

Using this, it is also possible to determine exactly when the visualization project is started. This can guarantee<br />

that the machine can be operated immediately. In other words, the PLC program is finished initializing as soon<br />

as the visualization application appears.<br />

3.3.8.33.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 />

Warning:<br />

VA_Saccess cannot be called before the VA_StartProject function.<br />

3.3.8.33.2 Example for Automation Basic<br />

(* init program *)<br />

ready = 0<br />

(* cyclic program *)<br />

IF ready 1 THEN<br />

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

IF VC_HANDLE 0 THEN<br />

ready = 1<br />

ENDIF<br />

ENDIF<br />

IF ready = 1 THEN<br />

3.3.8.32 Requirements and Initialization − VA_Srelease 167

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

Saved successfully!

Ooh no, something went wrong!