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

endif<br />

if ready = 1 then<br />

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

0 then<br />

status = VA_GetCalStatus (1,VC_HANDLE)<br />

VA_Srelease(1,VC_HANDLE)<br />

endif<br />

endif<br />

3.3.8.9.3 Example for C Programming<br />

#include <br />

#include <br />

#include <br />

UINT _GLOBAL ready;<br />

unsigned long VC_HANDLE;<br />

UDINT _GLOBAL status;<br />

_CYCLIC void Initialization (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 />

status = VA_GetCalStatus (1,VC_HANDLE);<br />

VA_Srelease(1,VC_HANDLE);<br />

}<br />

}<br />

}<br />

3.3.8.9.4 Example of a complete touch calibration program<br />

#include <br />

#include <br />

#include <br />

_GLOBAL UINT stat,CalibStatus;<br />

_GLOBAL UINT calib;<br />

_GLOBAL UDINT VCHandle;<br />

_GLOBAL UINT MeinStatus;<br />

_INIT void init(void)<br />

{<br />

calib = 0;<br />

MeinStatus = 0;<br />

VCHandle=0;<br />

}<br />

_CYCLIC void Touchcalib(void)<br />

{<br />

if (!VCHandle)<br />

{<br />

}<br />

else<br />

{<br />

VCHandle = VA_Setup(1, "vis2");<br />

calib = 0;<br />

MeinStatus = 0;<br />

switch (calib)<br />

{<br />

case 0: /* Touch is calibrated */ break;<br />

case 1: calib = 2;break;<br />

case 2:<br />

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

{<br />

CalibStatus=VA_StartTouchCal(1, VCHandle);<br />

3.3.8.9 Touch Screen Calibration − VA_GetCalStatus 145

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

Saved successfully!

Ooh no, something went wrong!