IEC 61131-3 C Tools User Manual


Add to my manuals
501 Pages

advertisement

IEC 61131-3 C Tools User Manual | Manualzz

IEC 61131-3 C Tools Function Specifications

readBoolVariable

Read IEC 61131-3 Boolean Variable

Syntax

#include <ctools.h>

BOOLEAN readBoolVariable(unsigned char * varName, unsigned char *

value)

Description

This function returns the current value of the specified boolean variable.

The variable is specified by its name expressed as a character string. The name is case insensitive (The IEC 61131-3 Dictionary also treats variable names as case insensitive). If the variable is found, TRUE is returned and the variable value is written to the unsigned char value pointed to by value. If the variable is not found or if the IEC 61131-3 Symbols Status is invalid, FALSE is returned and the current value is left unchanged. The IEC 61131-3 Symbols Status is invalid if the Application TIC code download and Application Symbols download do not share the same symbols CRC checksum.

Notes

This function requires the IEC 61131-3 Application Symbols to be downloaded to the controller in addition to the Application TIC code. This function provides a convenient method to access IEC 61131-3 variables by name; however, because the variable name needs to be looked up in the IEC 61131-3 variable list each call, the performance of the function may be slow for large numbers of variables.

For better performance, use the variable‟s network address and the dbase function.

The IO_SYSTEM system resource needs to be requested before calling this function.

See Also

writeBoolVariable

Example

This pro gram displays the contents of the boolean variable named “Switch1”.

#include <ctools.h> void main(void)

{

BOOLEAN status; unsigned char value; request_resource(IO_SYSTEM); status = readBoolVariable("Switch1", &value); release_resource(IO_SYSTEM);

Document (Version 2.50) 5/12/2011 372 372

}

IEC 61131-3 C Tools Function Specifications printf("status = %u, Switch1 = %d\r\n", status, value);

Document (Version 2.50) 5/12/2011 373 373

advertisement

Was this manual useful for you? Yes No
Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Related manuals

advertisement

Table of contents