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.

void _CYCLIC test( void )<br />

{<br />

if (ready == 0)<br />

{<br />

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

if (VC_HANDLE != 0)<br />

ready = 1;<br />

}<br />

else<br />

{<br />

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

if (Access_Status == 0)<br />

{ switch (step)<br />

{<br />

case 1:<br />

{<br />

Alarmlen = 80;<br />

Seperator = 45; /*Hyphen*/<br />

Alarmtype /*First alarm*/ = 1;<br />

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

GetActAlarmList_Status = VA_GetActAlarmList (1, unsigned VC_HANDLE, int)AlarmString,(unsigned (<br />

int) &Alarmlen<br />

,Alarmtype,Seperator,TimeDateForm);<br />

if (GetActAlarmList_Status == 0)<br />

step = 2;<br />

break;<br />

}<br />

case 2:<br />

{<br />

Alarmlen = 80;<br />

Seperator = /*Hyphen*/<br />

45;<br />

Alarmtype = /*First 2; alarm*/<br />

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

GetActAlarmList_Status = VA_GetActAlarmList (1, unsigned VC_HANDLE, int)AlarmString,(unsigned (<br />

int) &Alarmlen<br />

if (GetActAlarmList_Status == 240)<br />

step = 1;<br />

break;<br />

}<br />

}/*step switch*/<br />

VA_Srelease (1,VC_HANDLE);<br />

}/*VA_Saccess == 0*/<br />

}/*Visapi initialized, ready != 0*/<br />

}/* end cyclic*/<br />

3.3.8.7 Reading Alarm Lists − VA_GetAlarmList<br />

,Alarmtype,Seperator,TimeDateForm);<br />

Two functions can be used to read the alarm history VA_GetAlarmList and VA_GetExAlarmList. Both<br />

functions return a result string which must then be evaluated.<br />

It is important to call VA_Setup once before alarm system functions are called and to execute VA_Saccess<br />

before each use of Visapi alarm functions.<br />

To format the alarm line, the function VA_GetExAlarmList can be used.<br />

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

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

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

4 ..... Read previous alarm<br />

8 ..... Read last alarm<br />

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

142 3.3.8.7 Reading Alarm Lists − VA_GetAlarmList

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

Saved successfully!

Ooh no, something went wrong!