2 function blocks, 2 function blocks -15 – Spectrum Controls 2080sc-BAC User Manual

Page 33

Advertising
background image

Chapter 3: Configuring the Module

3-15

User’s Manual Pub. 0300274-01 Rev. A.0

Similarly, for Analog Output, a read is performed to read the whole analog table
to

bac_raw_tbl

, defined in function block

bacnet_convert_fn

. Next,

individual AnalogOutput objects are to be written to the variable after conversion
from ULINT to a tag data type.

(* Read Output Table from Module *)

bacnet_module_read_fn(TRUE, BACNET_MODULE_SLOT,
bacnet_module_address, bacnet_module_datalen,
bacnet_convert_fn.bac_raw_tbl);

(* 0, AnalogOutput, ao0 *)

bacnet_convert_mode := 0;
bacnet_convert_offset := 0;
bacnet_convert_fn(bacnet_convert_offset,
bacnet_convert_var, bacnet_convert_mode);

tag4 := ANY_TO_INT(bacnet_convert_fn.tmp_raw_var);

3.5.2 Function Blocks

A user-defined function block has to be defined by the user (yourself if that is the
case). Local variables for this function block are similar to those shown below.

After creating the local variables, you need to create a function block called
BACNET_Convert and paste the code below to this function block.

(*
if param_mode = 0
convert byte array bac_raw_tbl to ULINT variable tmp_raw_var
This is for Analog Output Table
*)


IF

param_mode =

0

THEN

Advertising