beautypg.com

Baumer GK473 User Manual

Page 27

background image

Manual_GK473_S7_Profibus_EN.doc 27/32

Baumer IVO GmbH & Co. KG

04.05.11

Villingen-Schwenningen,

Germany

0 4

000

0

010

0


To achieve number 5 the first 4 bits are masked out using an UND link. 1111 is loaded into the battery
and linked to 0100 0101 UND.

010

0

010
1

UND-
Linked to

000
0

111
1

Result 000

0

010
1


To both numbers the ASCII offset is added what equals 0x34 and 0x35 that is written into the DB.

4.6 FC 10 – Read current value

The function ”read current value” is reading the current value off the SPA addressed. The function is
given the SPA identifier as integer number (1,2,3 ...). The function then is converting the SPA identifier
into the format required by the gateway. Returned is the current SPA value in real format. Furthermore
the function outputs a Busy bit, a Timeout bit and an Error bit.

Call function:

CALL FC 10

SPA ID:

INT;

Time_Out:

BOOL;

Error:

BOOL;

Busy:

BOOL;

Current value_Real:

REAL;

First the function calls SFC14 for reading in the current count byte to be stored in MW1. Second step is
generating the command to be sent to the gateway. To do so, MW1 is incremented and the SPA
identifier converted into ASCII. MW1, SPA identifier and command byte are then written into DB96.
Remaining digits are filled by zeroes.
The command is sent to the gateway by SFC15 with subsequent start of a timer. Also the Busy bit is
set to prevent the command from being resent to the gateway during repeated function call. Only the
read in routine of the function will be proceeded again.
Prior to the read-in operation the timer is checked. When having expired, the program directly skips to
label/mark Timeout. The Timeout bit is set whereas the Busy bit is reset.
If the timer has not yet expired the read-in operation will be proceeded by SFC14. The count bytes are
compared to reckon whether new data are provided. The “ancient” count byte was stored in DB99 and
compared with the recent count byte provided by DB95 prior to sending the command. In case the
count bytes are not identical the gateway is in receipt of the SPA reply and the function will reset the
Busy bit.
The new data are processed by aid of FC1 that is converting the current value provided in ASCII
format by DB95 into a floating point number. Returned is FC10. The Busy memory word is reset and it
is checked whether there has any error occurred in system functions SFC14 and SFC15 what is
registered by the error bit.