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.

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

IN percent UDINT<br />

Contrast intensity<br />

000 dark<br />

500 standard<br />

100 light<br />

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

3.3.8.26.2 Example for Automation Basic<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 />

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

0 then<br />

endif<br />

3.3.8.26.3 Example for C Programming<br />

#include <br />

#include <br />

#include <br />

UINT _GLOBAL ready;<br />

UDINT _GLOBAL percent;<br />

unsigned long VC_HANDLE;<br />

VA_SetContrast(1,VC_HANDLE,percent)<br />

VA_Srelease(1,VC_HANDLE)<br />

endif<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_SetContrast(1,VC_HANDLE,percent);<br />

VA_Srelease(1,VC_HANDLE);<br />

}<br />

}<br />

}<br />

3.3.8.26.4 Example: Setting Contrast/Brightness<br />

#include<br />

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

#include #include #define VC_SETUP 0 #define VC_WAIT 10<br />

#define VC_SETCONTRAST 30 #define VC_SETBRIGHTNESS 40 _GLOBAL UDINT VC_Handle; _LOCAL UINT Step,<br />

ContrastValue, OldContrastValue, BrightnessValue, OldBrightnessValue; _INIT void Init_Routine(void)<br />

{ VC_Handle=0; if (ContrastValue == 0) ContrastValue = 60; else if (BrightnessValue==0)<br />

BrightnessValue=60; Step = VC_SETUP; } _CYCLIC void Cyclic_Routine(void) { switch (Step) { case<br />

VC_SETUP: VC_Handle = VA_Setup(1, "visu"); if (VC_Handle != 0) Step = VC_WAIT; break; case VC_WAIT: if<br />

(ContrastValue != OldContrastValue) { OldContrastValue = ContrastValue; Step = VC_SETCONTRAST; } if<br />

(BrightnessValue != OldBrightnessValue) { OldBrightnessValue=BrightnessValue; Step=<br />

VC_SETBRIGHTNESS; } break; case VC_SETCONTRAST: if (!VA_Saccess(1,VC_Handle)) {<br />

VA_SetContrast(1,VC_Handle,ContrastValue); VA_Srelease(1,VC_Handle); } Step = VC_WAIT; break; case<br />

VC_SETBRIGHTNESS: if (!VA_Saccess(1,VC_Handle)) { VA_SetBrightness(1,VC_Handle,BrightnessValue);<br />

VA_Srelease(1,VC_Handle); } Step = VC_WAIT; break; } }<br />

162 3.3.8.26 Setting Contrast and Brightness − VA_SetContrast

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

Saved successfully!

Ooh no, something went wrong!