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

IN pcAlarmLine DINT Text array to be used as the alarm line<br />

IN plLen DINT<br />

IN iFunction UINT<br />

Address of a DINT variable which contains the length of the text field.<br />

After the function is called, this variable is set to the actual length.<br />

1 ..... Read first current alarm<br />

2 ..... Read next current alarm<br />

IN cSeperator USINT Separation character to be inserted into the alarm line<br />

IN cDateTimeFormat USINT<br />

Desired format for date and time output in the alarm list<br />

0 ... DD.MM.YY_HH:MM:SS<br />

1 ... DD.MM.YY_HH:MM:SSa<br />

2 ... HH_MM_SS<br />

3 ... HH_MM_SSa<br />

4 ... HH_MM<br />

5 ... HH_MMa<br />

6 ... NO_TIME_NO_DATE<br />

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

3.3.8.6.2 Example for Automation Basic<br />

if ready = 0 then<br />

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

VC_HANDLE if 0 then<br />

ready = 1<br />

endif<br />

else<br />

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

if Access_Status = 0 then<br />

case step of<br />

action 1:<br />

Alarmlen = 80<br />

;Hyphen Seperator = 45<br />

;Read first Alarmtype alarm = 1<br />

;DD.MM.YY TimeDateForm HH.MM.SS = 0<br />

GetActAL_Status = VA_GetActAlarmList UDINT(ADR(Alarmstring)),UDINT(ADR(Alarmlen)),Alarmtype,Sepe<br />

(1,VC_HANDLE,<br />

if GetActAL_Status = 0 then<br />

step = 2<br />

endif<br />

endaction<br />

2: action<br />

Alarmlen = 80<br />

;Hyphen Seperator = 45<br />

;Read next Alarmtype alarm = 2<br />

;DD.MM.YY TimeDateForm HH.MM.SS = 0<br />

GetActAL_Status = VA_GetActAlarmList UDINT(ADR(Alarmstring)),UDINT(ADR(Alarmlen)),Alarmtype,Sepe<br />

(1,VC_HANDLE,<br />

if GetActAL_Status = 240 then<br />

step = 1<br />

endif<br />

endaction<br />

endcase<br />

VA_Srelease(1,VC_HANDLE)<br />

endif<br />

endif<br />

3.3.8.6.3 Example for C Programming<br />

#include <br />

#include <br />

#include <br />

_GLOBAL USINT ready;<br />

_GLOBAL UDINT VC_HANDLE;<br />

_LOCAL UINT Access_Status, GetActAlarmList_Status;<br />

_LOCAL char AlarmString[80];<br />

_LOCAL UINT Alarmlen;<br />

_LOCAL USINT Seperator,step;<br />

_LOCAL USINT TimeDateForm;<br />

_LOCAL USINT Alarmtype;<br />

3.3.8.6 Read Current Alarm List − VA_GetActAlarmList 141

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

Saved successfully!

Ooh no, something went wrong!