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.

VC_HANDLE if 0 then<br />

ready = 1<br />

endif<br />

endif<br />

if ready = 1 then<br />

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

....<br />

....<br />

endif<br />

endif<br />

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

....<br />

....<br />

}<br />

}<br />

}<br />

Here are some typical errors associated with VA_Saccess and VA_Srelease:<br />

• VA_Saccess(1, VC_HANDLE);<br />

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

VA_Srelease(1,VC_HANDLE);<br />

This is incorrect! VA_Srelease is called even if VA_Saccess fails.<br />

• ...<br />

...<br />

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

{<br />

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

}<br />

...<br />

...<br />

This is incorrect! VA_Srelease has been left out.<br />

• CYCLIC void test(void)<br />

{<br />

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

}<br />

This is incorrect! VA_Saccess hasn't been called here.<br />

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

158 3.3.8.22 Requirements and Initialization − VA_Saccess

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

Saved successfully!

Ooh no, something went wrong!