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.

3.3.8.35.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_StopProject function.<br />

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

CASE selection OF<br />

ACTION 1:<br />

ENDACTION<br />

Status = VA_StopProject(1,VC_HANDLE)<br />

ACTION 2:<br />

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

IF AccessStatus = 0 THEN<br />

VA_Line(1,VC_HANDLE, 10,10,100,100,1)<br />

VA_Srelease(1,VC_HANDLE)<br />

ENDIF<br />

ENDACTION<br />

ACTION 3:<br />

ENDACTION<br />

ELSEACTION :<br />

ENDACTION<br />

ENDCASE<br />

ENDIF<br />

selection = 0<br />

3.3.8.35.3 Example for C Programming<br />

#include <br />

#include <br />

#include <br />

_GLOBAL UINT ready;<br />

_GLOBAL USINT Type;<br />

_GLOBAL UINT selection;<br />

_GLOBAL UDINT Status;<br />

_GLOBAL UDINT VC_HANDLE;<br />

_GLOBAL UDINT AccessStatus;<br />

_INIT void InitSp(void)<br />

{<br />

ready=0;<br />

selection=0;<br />

}<br />

_CYCLIC void Cyclic(void)<br />

{<br />

Status = VA_StartProject(1,VC_HANDLE)<br />

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

170 3.3.8.35 Manual Project Control − VA_StopProject

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

Saved successfully!

Ooh no, something went wrong!