beautypg.com

Function library, Function library -8 – Sensaphone SCADA 3000 Users manual User Manual

Page 194

background image

16-8

SCADA 3000 User’s Manual

FUNCTION LIBRARY

In SCADA 3000’s C language there are five functions defined—Read, Write, Reset, Power, and

Write Record. These functions allow you to retrieve/assign certain values and incorporate them

into your C program. Most parameters within the SCADA 3000 are accessible via the UAF

(Universal Address Format). The Read and Write functions always include an associated UAF.

A function can be a statement by itself or it can be used to retrieve a value and return it.

READ FUNCTION - Used to read a value from the SCADA 3000 as described by its UAF.

Summary:

float read_uaf(t,g,e)

int t; UAF source type: input, output, timer, counter, bit,

ladder_variable,alarm,diagnostic

int g; UAF group number: 0-1023

int e; UAF element number: 0-255

Description
The read_uaf function returns the value of any UAF register that is specified by the three

parameters, The value of the specified UAF will always be returned by this function as a float

even if the real UAF register is an integer or bit. Note that there is no run time error checking

on this function. If a user requests an invalid register location, the function will not generate

an error, but will just return an invalid result.
RETURN VALUE - The read_uaf function returns the value of the specified UAF register.

Example:

float tank_high;

main ()

{

if (read_uaf(input,0,0)>100.0) /*If input 0 on main

board is greater than 100 */

{

tank_high=1;

/* then set the tank_high

variable equal to one */

}

}

WRITE FUNCTION - Used to write a value to the SCADA 3000 as described by its UAF.

Summary:

float write_uaf(t,g,e,d)

int t; UAF source type: output, bit, ladder_variable,

c_variable, alarm

int g; UAF group number: 0-1023

int e; UAF element number: 0-255

int d; New data for UAF: “on,” “off,” floating point number

Description
The write_uaf function is for changing the value in any of the UAF registers. The parameters

of the function specify the location of the UAF register to be changed as well as the new value

for the register.
RETURN VALUE - The write_uaf function always returns a zero.