Compiler Error 1402

# Compiler Error 1402

assignment error:  Variable can only be used for assignment: '\<identifier\>'

STRING_OUTPUT variables can only have their values read.  Once assigned a value, that value is immediately acted upon by the control system, and the value is assumed to be unknown thereafter.

The following are examples of this error:

STRING_OUTPUT sOut;

STRING str[100];

FUNCTION MyFunc()

{

   str = “abc”;                // ok

   sOut = str;                 // ok – sOut can be assigned a value

   sOut = “abc”;               // ok – sOut can be assigned a value

   str = sOut;                 // error – the value of sOut is lost

   Print( “str = %s”, str );   // ok – STRINGs can be read and written

   Print( “sOut = %s”, sOut ); // error – the value of sOut is unknown

}

Language Constructs & Functions
Compiler Errors & Warnings
Compiler Error 1402

Compiler Error FUNCTION MyFunc Print STRING STRING_OUTPUT


Compiler Error 1500

# Compiler Error 1500

function argument error: Argument \<arg_num\> cannot be passed by reference

A variable was being passed that can either only have a value assigned to it, or it’s value be copied into another variable or used within an expression.  An example of this is trying to pass a STRING_INPUT variable as a function argument; the STRING_INPUT must first be copied into a STRING variable and then passed.

Pass by Reference – The function will act directly on the variable that was passed as the argument.  Any changes to the variable within the called function the will be reflected within the calling function.

Pass by Value – The function creates a local copy of the source variable.  Any changes to this local copy are not reflected in the source variable that was originally passed to the function.  The source variable will still retains its original value from before the function was called.

The following are examples of this error:

INTEGER i;

STRING str[100];

STRING_INPUT strIn[100];

STRING_OUTPUT strOut;

DIGITAL_INPUT di;

FUNCTION MyFunc( STRING s )

{

   str = strIn;

   Call MyFunc( str );      // ok – the previous statement copied

                            //      ‘strIn’ into ‘str’

   Call MyFunc( “abc” );    // ok

   Call MyFunc( strIn );    // error – strIn is a STRING_INPUT and

                            //         cannot be passed by reference

   Call MyFunc( strOut );   // error – strIn is a STRING_OUTPUT and

                            //         cannot be passed by reference

}

FUNCTION MyFunc2( ByRef STRING s ) // error – STRINGs cannot be

                                   //         passed by reference

{

   Call MyFunc2( str );            // error – STRINGs cannot be

                                   //         passed by reference

}

FUNCTION AnotherFunc( ByRef INTEGER x )

{

   Call AnotherFunc( 1 );   // ok

   Call AnotherFunc( di );  // error – di is a DIGITAL_INPUT and

                            //         cannot be passed

                            //         by reference

}

Language Constructs & Functions
Compiler Errors & Warnings
Compiler Error 1500


Compiler Error 1501

# Compiler Error 1501

function argument error: Argument \<arg_num\> cannot be passed by value

In SIMPL+, arrays can only be passed by reference.  The keyword, ByVal, cannot be used within a function’s argument list in conjunction with arrays.  A copy of an individual element within an array must first be copied into an INTEGER or STRING variable and then that variable can be passed.

Pass by Reference – The function will act directly on the variable that was passed as the argument.  Any changes to the variable within the called function the will be reflected within the calling function.

Pass by Value – The function creates a local copy of the source variable.  Any changes to this local copy are not reflected in the source variable that was originally passed to the function.  The source variable will still retains it’s original value from before the function was called.

The following are examples of this error:

FUNCTION MyFunc( ByVal INTEGER intArr[] )   // error – arrays cannot be

                                            //         passed by value

{

}

FUNCTION MyFunc( ByVal STRING strArr[] )    // error – arrays cannot be

                                            //         passed by value

{

}

FUNCTION MyFunc( ByVal INTEGER intArr[][] ) // error – arrays cannot be

                                            //         passed by value

{

}

FUNCTION MyFunc( ByVal STRING strArr[][] )  // error – arrays cannot be

                                            //         passed by value

{

}

Language Constructs & Functions
Compiler Errors & Warnings
Compiler Error 1501

Compiler Error FUNCTION INTEGER MyFunc STRING


Compiler Error 1502

# Compiler Error 1502

function argument error:  Function contains incomplete number of arguments

                                                 Function call contains an unmatched number of

                                                  arguments

When calling a function that contains parameter lists, the number of arguments passed to the function must match the number of parameters defined for that function.

The following are examples of this error:

FUNCTION MyFunc( INTEGER x, STRING str )

{

   Call MyFunc( 1, “abc” ); // ok

   Call MyFunc();           // error – 2 arguments are expected

   Call MyFunc( 1 );        // error – argument 2 is missing

}

Language Constructs & Functions
Compiler Errors & Warnings
Compiler Error 1502


Compiler Error 1503

# Compiler Error 1503

function argument error:  Input or Output signal expected:  '\<identifier\>'

The expected identifier must be of an Input or Output signal datatype (i.e.:  DIGITAL_INPUT, ANALOG_OUTPUT, STRING_INPUT, etc.).

The following are examples of this error:

DIGITAL_INPUT digIn, digInArr[10];

DIGITAL_INPUT digIn;

ANALOG_INPUT anlgIn;

ANALOG_OUTPUT anlgOut;

STRING_INPUT strIn[100];

STRING_OUTPUT strOut;

BUFFER_INPUT buffIn[100];

INTEGER i;

STRING str[100];

FUNCTION MyFunc()

{

   i = IsSignalDefined( digIn );       // ok

   i = IsSignalDefined( digInArr[5] ); // ok

   i = IsSignalDefined( digOut );      // ok

   i = IsSignalDefined( anlgIn );      // ok

   i = IsSignalDefined( anlgOut );     // ok

   i = IsSignalDefined( strIn );       // ok

   i = IsSignalDefined( strOut );      // ok

   i = IsSignalDefined( buffIn );      // ok

   digOut = IsSignalDefined( i );      // error – ‘i’ is not an Input

                                       //         or Output signal

   i = IsSignalDefined( str );         // error – ‘i’ is not an Input

                                       //         or Output signal

   digOut = IsSignalDefined( 5 );      // error – ‘5’ is not an Input

                                       //         or Output signal

}

Language Constructs & Functions
Compiler Errors & Warnings
Compiler Error 1503


Compiler Error 1504

# Compiler Error 1504

function argument error:  Incomplete number of format string arguments

                                                 Format string contains an unmatched number

                                                     of arguments

                                                 Argument \<arg_num\> is missing or invalid.

                                                     Format Specifier expected

                                                  Argument \<arg_num\> is missing or invalid.

                                                     \<decl_type\> expected

Format lists contain format specifiers that tell the compiler to replace a given specifier with the value or result given in the argument list that follows.  A format list is analogous to a function parameter list in that the format specifier tells the compiler what type of argument to expect.  For each format specifier, their must be a corresponding value or result in the argument list that follows.  This value or result must also be of the same datatype.

NOTE: Format strings contain specifications that determine the output format for the arguments.  The format argument consists of ordinary characters, escape sequences, and (if arguments follow format) format specifications  Format Specifications always begin with a percent sign (%) and are read left to right. When the first format specification is encountered (if any), it converts the value of the first argument after format and outputs it accordingly. The second format specification causes the second argument to be converted and output, and so on.

The following are examples of this error:

FUNCTION MyFunc()

{

   INTEGER x, intArr[100];

   STRING str[100], strArr[100][100];

   Print( “Hello World” );                                    // ok

   Print( “My name is %s.  My age is %d”, “David”, 33 );      // ok

   Print( “My name is %s.  My age is %d”, str, x );           // ok

   MakeString( str, “Hello World” );                          // ok

   MakeString( str, “My name is %s.  My age is %d”, str, x ); // ok

   Print( “My name is %s.  My age is %d”, “David” );     // error –

                        // %d format specifier does not have a

                        // corresponding value

   Print( “My name is %s.  My age is %d”, 33, “David” ); // error -

                        // both format specifiers contain corresponding

                        // values of different datatypes

   SetArray( strArr, 1 );     // ok

   SetArray( strArr, “abc” ); // ok

   SetArray( intArr, 0 );     // ok

   SetArray( “abc”, 1 );      // error – “abc” is not an array

   SetArray( 1, “abc” );      // error – 1 is not an array

}

Language Constructs & Functions
Compiler Errors & Warnings
Compiler Error 1504

Compiler Error FUNCTION INTEGER MakeString MyFunc Print STRING SetArray


Compiler Error 1505

# Compiler Error 1505

function argument error:  Format string contains invalid format specifier

An invalid format specifier was used within a format string.

Format strings contain specifications that determine the output format for the arguments.  The format argument consists of ordinary characters, escape sequences, and (if arguments follow format) format specifications  Format Specifications always begin with a percent sign (%) and are read left to right. When the first format specification is encountered (if any), it converts the value of the first argument after format and outputs it accordingly. The second format specification causes the second argument to be converted and output, and so on.

The following are examples of this error:

FUNCTION MyFunc()

{

   Print( “Hello World” );                                    // ok

   Print( “My name is %s.  My age is %d”, “David”, 33 );      // ok

   Print( “My name is %xs”, “David” ); // error - %xs is an invalid

                                       //         format specifier

}

Language Constructs & Functions
Compiler Errors & Warnings
Compiler Error 1505


Compiler Error 1506

# Compiler Error 1506

function argument error:  0, 1 or 2 constant expected for argument 1

The function, MakeString, can contain a 0, 1, 2 as the first argument.  This tells the control system to output the resulting string to a specific destination.  An integer value other than 0, 1 or 2 was encountered as the first argument of MakeString().

The different destinations are as follows:

   0:  Computer Port, same as PRINT.

   1:  CPU (same functionality as the SendPacketToCPU function)

   2:  Cresnet Network (same functionality as the SendCresnetPacket function).

The following are examples of this error:

FUNCTION MyFunc( INTEGER x, STRING str )

{

   Call MyFunc( 1, “abc” ); // ok

   Call MyFunc();           // error – 2 arguments are expected

   Call MyFunc( 1 );        // error – argument 2 is missing

}

Language Constructs & Functions
Compiler Errors & Warnings
Compiler Error 1506

CPU Compiler Error FUNCTION INTEGER MakeString MyFunc Network PRINT STRING


Compiler Error 1507

# Compiler Error 1507

function argument error:  Argument \<arg_num\>:  Missing or invalid array

An integer or string variable array was expected and was not encountered.

The following are examples of this error:

FUNCTION MyFunc( INTEGER x[], STRING str[] )

{

   INTEGER i;

   STRING strArr[100][100];

   SetArray( x, 1 );         // ok

   Call MyFunc( x, StrArr ); // ok

   SetArray( i, 1 );         // error – i is not an array

   Call MyFunc( 1, “abc” );  // error – 1 is not an array

}

Language Constructs & Functions
Compiler Errors & Warnings
Compiler Error 1507

Compiler Error FUNCTION INTEGER MyFunc STRING SetArray


Compiler Error 1508

# Compiler Error 1508

function argument error:  Variable cannot be passed to read file functions: '%1':                                                 '\<identifier\>'

Read file functions (ReadInteger, ReadString, etc.) can only contain variables that can be written to for the function’s resulting read buffer.

The following are examples of this error:

DIGITAL_OUTPUT digOut;

STRING_OUTPUT strOut;

INTEGER_PARAMETER intParam;

FUNCTION MyFunc( SIGNED_INTEGER nHandle )

{

   STRING str[100];

   INTEGER x;

   ReadInteger( nHandle, x );      // ok

   ReadString( nHandle, str );     // ok

   ReadInteger( nHandle, digOut ); // error

   ReadString( nHandle, strOut );  // error

   ReadString( nHandle, intParam );  // error

}

Language Constructs & Functions
Compiler Errors & Warnings
Compiler Error 1508

Compiler DIGITAL_OUTPUT Error FUNCTION INTEGER INTEGER_PARAMETER MyFunc ReadInteger ReadString SIGNED_INTEGER STRING STRING_OUTPUT


Compiler Error 1509

# Compiler Error 1509

**function argument error: Class variable name expected: '\<variable\>'**

A valid class name was expected for a function argument and was not found.

The following are examples of this error:

MyClass class1;  // MyClass is defined within a SIMPL# Library

// ok – class1 is defined

RegisterEvent( class1, mySimplSharpEvent, mySPlusEventHandler );

// error – someclass is not defined

RegisterDelegate( someclass, myDelegateProp, myDelegateCallbackFn );

// error – only valid variables are allowed

RegisterEvent( “event”, mySimplSharpEvent, mySPlusEventHandler );

Language Constructs & Functions
Compiler Errors & Warnings
Compiler Error 1509

Compiler Error RegisterDelegate RegisterEvent


Compiler Error 1510

# Compiler Error 1510

**function argument error: Class event handler expected: '\<variable\>'**

**A** valid class event handler was expected for a function argument and was not found.

The following are examples of this error:

MyClass class1;  // MyClass is defined within a SIMPL# Library

// ok – class1 is defined

RegisterEvent( class1, mySimplSharpEvent, mySPlusEventHandler );

// error – someSimplSharpEvent is not defined within SIMPL# Library

RegisterEvent( class1, someSimplSharpEvent, mySPlusEventHandler);

Language Constructs & Functions
Compiler Errors & Warnings
Compiler Error 1510


Compiler Error 1600

# Compiler Error 1600

construct  error:  'Function Main' cannot contain function parameters

                               'Function Main' cannot return a value

Function Main is the starting point of a SIMPL+ program.  It is automatically called once when the system startup or is reset.  Since this function is invoked by a method outside of the SIMPL+ module, no arguments can be included in it’s argument list and no value can be returned from it.

The following are examples of this error:

Function Main()                     // ok

{

}

INTEGER_FUNCTION Main()             // error – Main() cannot return

                                    //         a value

{

}

Function Main( INTEGER cmdLineArg ) // error – Main() cannot contain

                                    //         a parameter list

{

}

Language Constructs & Functions
Compiler Errors & Warnings
Compiler Error 1600

Compiler Error INTEGER INTEGER_FUNCTION Main


Compiler Error 1601

# Compiler Error 1601

construct  error:  Duplicate CASE Statement

                                Constant expected: '\<identifier\>'

Unlike the Switch Statement the CSwitch statement’s case statements must consist of unique values.  Expressions are not permitted within the case statements.  Instead, each case statement must contain a unique integer value for the CSwitch’s comparison.

The following are examples of this error:

FUNCTION MyFunc( INTEGER x )

{

   STRING str[100];

   CSwitch( x )

   {

      case (1):     // ok – 1 has not been used yet

      {

      }

      case (2):     // ok – 2 has not been used yet

      {

      }

      case (2):     // error – 2 has been previously used

      {

      }

      case (5+6):   // error – expressions are not allowed

      {

      }

      case (x):     // error – variables are not allowed

      {

      }

      case (“abc”): // error – strings are not allowed

      {

      }

      case (str):   // error – strings are not allowed

      {

      }

   }

}

Language Constructs & Functions
Compiler Errors & Warnings
Compiler Error 1601

CASE CSwitch Compiler Error FUNCTION INTEGER MyFunc STRING


Compiler Error 1602

# Compiler Error 1602

construct  error:  Switch statement contains 'default' without 'case' labels

The Switch and CSwitch constructs must contain ‘case’ statements if the ‘default’ statement is to be used.  The ‘default’ statement is optional.

The following are examples of this error:

FUNCTION MyFunc( INTEGER x )

{

   Switch ( x )

   {

      case (1):  // ok

      {

      }

      default:   // ok

      {

      }

   }

   CSwitch ( x )

   {

      case (1):  // ok

      {

      }

      default:   // ok

      {

      }

   }

   Switch ( x )

   {

      default:   // error – no Case statement in Switch

      {

      }

   }

   CSwitch ( x )

   {

      default:   // error – no Case statement in Switch

      {

      }

   }

}

Language Constructs & Functions
Compiler Errors & Warnings
Compiler Error 1602

CSwitch Compiler Error FUNCTION INTEGER MyFunc Switch


Compiler Error 1603

# Compiler Error 1603

construct  error:  #CATEGORY does not exist: '\<categorgy_number\>'.

                                   Defaulting to Category Type, ""32"" (Miscellaneous).

The category number for this compiler directive was not found or was not a valid category number within the Symbol Tree Category List within SIMPL.  The category number must be enclosed in quotation marks.

Selecting Edit | Insert Category from the SIMPL+ menu will display the list of valid category numbers and give the option for this compiler directive to be automatically inserted into the SIMPL+ module.

The following are examples of this error:

#CATEGORY “6”                 // ok – “6” is the category number

                              //       for Lighting

#CATEGORY “Lighting”          // error – the category number, “6”,

                              //         should be used instead of

                              //         the category symbol name

#CATEGORY 6                   // error – the category number should

                              //         be enclosed in quotation marks

#CATEGORY 99                  // error – invalid category number

#DEFINE_CONSTANT MyCategory 6

#CATEGORY MyCategory          // error – cannot substitute category

                              //         number with #DEFINE_CONSTANTs

Language Constructs & Functions
Compiler Errors & Warnings
Compiler Error 1603


Compiler Error 1604

# Compiler Error 1604

construct  error:  'EVENT' already has a body

The EVENT statement can only be defined once per SIMPL+ module.  A previously defined definition of EVENT was already encountered by the compiler.

The following are examples of this error:

EVENT  // ok

{

}

EVENT  // error – EVENT is already defined

{

}

Language Constructs & Functions
Compiler Errors & Warnings
Compiler Error 1604


Compiler Error 1605

# Compiler Error 1605

construct  error:  Function can only be contained within an event

The function, TerminateEvent, can only be used within a PUSH, CHANGE, RELEASE or EVENT statement.  The compiler encountered this function outside of one of these event functions.

The following are examples of this error:

DIGITAL_INPUT digIn;

EVENT

{

   TerminateEvent;    // ok

}

PUSH digIn

{

   TerminateEvent;    // ok

}

RELEASE digIn

{

   TerminateEvent;    // ok

}

CHANGE digIn

{

   TerminateEvent;    // ok

}

FUNCTION MyFunc()

{

   while (1)

   {

      TerminateEvent; // error – TerminateEvent is not within

                      //         an event function

   }

}

Language Constructs & Functions
Compiler Errors & Warnings
Compiler Error 1605

CHANGE Compiler DIGITAL_INPUT EVENT Error FUNCTION MyFunc PUSH RELEASE


Compiler Error 1606

# Compiler Error 1606

construct  error:  Statement must be contained within a loop statement

The ‘break’ and 'continue' statements can only be used with a loop construct.  Valid loop constructs are While loops, Do-While loops and For loops.  The compiler encountered this function outside of one of these event functions.

The following are examples of this error:

FUNCTION MyFunc()

{

   INTEGER I;

   for ( i = 1 t 10 )

   {

      break;    // ok

   }

   while (1)

   {

      continue;    // ok

   }

   do

   {

      break;    // ok

   } until (1);

   if (1)

   {

      break;    // error – break cannot exist within an ‘if’ statement

   }

}

EVENT

{

   break;       // error – TerminateEvent should be used instead

}

Language Constructs & Functions
Compiler Errors & Warnings
Compiler Error 1606

Compiler EVENT Error FUNCTION INTEGER MyFunc


Compiler Error 1607

# Compiler Error 1607

construct  error:  GetLastModifiedArrayIndex may return an ambiguous

                                   signal index

If an event function (EVENT, PUSH, CHANGE, RELEASE) is acting on more than one input array signal, the specific array will not be able to be determined based on the index returned from GetLastModifiedArrayIndex().  In order to use GetLastModifiedArrayIndex() for multiple input signal arrays, a separate event function will have to be defined for each array.

The following are examples of this error:

DIGITAL_INPUT digIn[10];

ANALOG_INPUT anlgIn[10];

PUSH digIn

{

   INTEGER i;

   i = GetLastModifiedArrayIndex();  // ok – index from digIn

}

PUSH anlgIn

{

   INTEGER i;

   i = GetLastModifiedArrayIndex();  // ok – index from anlgIn

}

CHANGE digIn, anlgIn

{

   INTEGER i;

   i =  GetLastModifiedArrayIndex(); // error – ambiguous result

}

Language Constructs & Functions
Compiler Errors & Warnings
Compiler Error 1607

ANALOG_INPUT CHANGE Compiler DIGITAL_INPUT EVENT Error GetLastModifiedArrayIndex INTEGER PUSH RELEASE


Compiler Error 1608

# Compiler Error 1608

construct  error:  Missing library file name

A filename was not found following the compiler directive, #USER_LIBRARY or #CRESTRON_LIBRARY.  This filename must be enclosed within quotation marks.  The file extension (.usl or .csl) should NOT be used when specifying the filename.

The following are examples of this error:

#USER_LIBRARY “MyUserLib”     // ok

#CRESTRON_LIBRARY “EvntSched” // ok

#USER_LIBRARY MyUserLib       // error – missing quotation marks

#USER_LIBRARY MyUserLib.usl   // error – missing quotation marks and

                              //         extension is not allowed

Language Constructs & Functions
Compiler Errors & Warnings
Compiler Error 1608


Compiler Error 1609

# Compiler Error 1609

construct  error:  Function can only be contained within Function Main

The function can only be used within the Function Main.  The compiler encountered this function call outside of this function

The following are examples of this error:

DIGITAL_INPUT digIn;

PUSH digIn

{

   WaitForInitializationComplete();    // error – not in Function Main

}

FUNCTION MyFunc()

{

   WaitForInitializationComplete();    // error – not in Function Main

}

FUNCTION MyFunc()

{

   if( WaitForInitializationComplete() \< 0 )    // ok

   {

      print(Error waiting for initialization complete\n");

      return;

   }

}

Language Constructs & Functions
Compiler Errors & Warnings
Compiler Error 1609

Compiler DIGITAL_INPUT Error FUNCTION MyFunc PUSH WaitForInitializationComplete


Compiler Error 1610

# Compiler Error 1610

construct error: GetLastModifiedArrayIndex cannot be used within a Wait Statement

The compiler encountered this function call within a Wait Statement.

The following are examples of this error:

ANALOG_INPUT AnlgIn;

INTEGER i;

CHANGE AnlgIn

{

   i = GetLastModifiedArrayIndex();    // ok

}

CHANGE AnlgIn

{

   Wait( 100 )

      i = GetLastModifiedArrayIndex();    // error

}

CHANGE AnlgIn

{

   Wait( 100 )

   {

      i = GetLastModifiedArrayIndex();    // error

   }

}

Language Constructs & Functions
Compiler Errors & Warnings
Compiler Error 1610

ANALOG_INPUT CHANGE Compiler Error GetLastModifiedArrayIndex INTEGER Wait


Compiler Error 1611

# Compiler Error 1611

construct  error:  Invalid Structure type.  Expected Structure(s): '\<identifier\>'

An invalid structure type was encountered within a construct.

The following are examples of this error:

ANALOG_INPUT AnlgIn;

TCP_CLIENT tcpClient[1024];

TCP_SERVER tcpServer[1024];

UDP_SOCKET udpSocket[1024];

CONNECT tcpClient // ok

{

}

DISCONNECT tcpServer // ok

{

}

RECEIVE udpSocket // ok

{

}

CONNECT AnlgIn // error – AnlgIn is not a socket type

{

}

Language Constructs & Functions
Compiler Errors & Warnings
Compiler Error 1611


Compiler Error 1612

# Compiler Error 1612

construct  error:  Category Name can only be assigned to custom category #46.  Category #\<category_number\> found"

Custom category names can only be assigned to category “46”.   A different category number was found.

The following are examples of this error:

#CATEGORY “46” “My Custom Category”// ok – “46” is the custom category number

#CATEGORY 6 “My Custom Category”// error – 6 is not the custom

                                   category number

Language Constructs & Functions
Compiler Errors & Warnings
Compiler Error 1612


Compiler Error 1613

# Compiler Error 1613

construct  error:  SocketGetSenderIPAddress can only be used with a SOCKETRECEIVE event.

SocketGetSenderIPAddress can only be used within the SOCKETRECEIVE event.  It cannot be used inside any other declared function or event type.

The following are examples of this error:

SOCKETRECEIVE MyUDP

{

    SIGNED_INTEGER Status;

    STRING IPAddress[32];

    Status = SocketGetSenderIPAddress(MyUDP, IPAddress ); // ok

}

SOCKETDISCONNECT MyUDP

{

    SIGNED_INTEGER Status;

    STRING IPAddress[32];

    Status = SocketGetSenderIPAddress(MyUDP, IPAddress ); // error

}

Function MyFunc()

{

    SIGNED_INTEGER Status;

    STRING IPAddress[32];

    Status = SocketGetSenderIPAddress(MyUDP, IPAddress ); // error

}

Language Constructs & Functions
Compiler Errors & Warnings
Compiler Error 1613

Compiler Error MyFunc SIGNED_INTEGER STRING SocketGetSenderIPAddress


Compiler Error 1614

# Compiler Error 1614

construct  error:  SocketGetStatus can only be used with a SOCKETSTATUS event.

SocketGetStatus can only be used within the SOCKETSTATUS event.  It cannot be used inside any other declared function or event type.

The following are examples of this error:

SOCKETSTATUS MyServer

{

    SIGNED_INTEGER Status;

    Status = SocketGetStatus(); // ok

}

SOCKETRECEIVE MyServer

{

    SIGNED_INTEGER Status;

    Status = SocketGetStatus(); // error

}

Function MyFunc()

{

    SIGNED_INTEGER Status;

    Status = SocketGetStatus(); // error

}

Language Constructs & Functions
Compiler Errors & Warnings
Compiler Error 1614

Compiler Error MyFunc SIGNED_INTEGER SocketGetStatus


Compiler Error 1615

# Compiler Error 1615

construct  error:  GetExceptionMessage/GetExceptionCode can only be used within a CATCH statement block

The functions, GetExcpetionMessage and GetExceptionCode can only be used within the CATCH portion of a TRY-CATCH statement block.  It cannot be used inside any other type of statement block or event handler.

The following are examples of this error:

Function MyFunc()

{

   string str[100];

   integer result;

   TRY

   {

      // some code…

   }

   CATCH

   {

      str = GetExceptionMessage(); // ok – GetExceptionMessage is within the CATCH block.

   }

   result = GetExceptionCode();  // error – GetExceptionCode is outside of the CATCH block.

}

Language Constructs & Functions
Compiler Errors & Warnings
Compiler Error 1615

Compiler Error GetExceptionCode GetExceptionMessage MyFunc


Compiler Error 1616

# Compiler Error 1616

**construct error:Callback function missing or has an unmatched argument list:**

**                                 ‘\<splus_callback_function\>’**

When registering delegates, the callback function specified must be valid and exist within the SIMPL+ module. The delegate callback function’s signature must match the signature within the SIMPL# Library.

The following are examples of this error:

// SimplSharpLibrary.clz

public delegate int DelegateIntFn(int value);

SPlusModule.usp

// UserModule.usp

#USER_SIMPLSHARP_LIBRARY "SimplSharpLibrary"

MyClass class1;  // MyClass is defined within a SIMPL# Library

callback signed_long_integer_function MyIntDelegateCallbackFn(

                             signed_long_integer value )

callback string_function MyStringDelegateCallbackFn()

{

   return (0);

}

// ok – MyIntDelegateCallbackFn is defined and has a matching signature

RegisterDelegate( class1, myDelegateFn, MyIntDelegateCallbackFn);

// error – MyStringDelegateCallbackFn is defined, but does not have a

           matching signature

RegisterDelegate( class1, myDelegateFn, MyStringDelegateCallbackFn);

// error – someDelegateCallbackFn is not defined

RegisterDelegate( class1, myDelegateFn, someDelegateCallbackFn);

Language Constructs & Functions
Compiler Errors & Warnings
Compiler Error 1616

Compiler DelegateIntFn Error MyIntDelegateCallbackFn MyStringDelegateCallbackFn RegisterDelegate


Compiler Error 1700

# Compiler Error 1700

file error:  End of file reached

The compiler reached the end of file before all functions or statements were completed.

- Make sure all functions have matching opening and closing braces.

- Make sure all statement expressions have matching opening and closing parenthesis.

Language Constructs & Functions
Compiler Errors & Warnings
Compiler Error 1700


Compiler Error 1701

# Compiler Error 1701

file error:  Error writing header file: '\<file_name\>'

                   Error writing file: '\<file_name\>'

                   Error writing library file

                   Error writing output file

                   Error creating compiler makefile: '\<file_name\>'

                   Error opening compiler source makefile: '\<file_name\>'

                   Error opening source file: '\<file_name\>'

The specified file could not be opened or created.

- Make sure there is sufficient disk space for the file to be written.

- If including a User or Crestron Library (#USER_LIBRARY or #CRESTRON_LIBRARY), make sure the library file name is valid, spelled properly and does not contain the file extension (.usl or .csl).

- Make sure the latest version of the Crestron Database is installed.

- Make sure the path for the Crestron Database and User SIMPL+ files have been specified within SIMPL.

- Make sure the file does not exist with a Read-Only attribute.

- Make sure another application (i.e.: another instance of SIMPL+) is not currently running with this file open.

Language Constructs & Functions
Compiler Errors & Warnings
Compiler Error 1701


Compiler Error 1702

# Compiler Error 1702

file error:  Error extracting library, '\<file_name\>', from archive: '\<archive_file\>'

The specified file was not found within the Crestron Library archive.

- Make sure the library file name is valid, spelled properly and does not contain the file extension (.csl).

- Make sure the latest version of the Crestron Database is installed.

- Make sure the path for the Crestron Database has been specified within SIMPL.

Language Constructs & Functions
Compiler Errors & Warnings
Compiler Error 1702


Compiler Error 1703

# Compiler Error 1703

library error:  Error:  Library names cannot contain path

When including User or Crestron libraries, only the library name is needed within the functions, #USER_LIBRARY and #CRESTRON_LIBRARY.   Passing in a fully qualified path is not allowed.

The following are examples of this error:

#USER_LIBRARY “MyLibrary” // ok – no path is given

#USER_LIBRARY “C:\MyPath\MyLibrary” // error – C:\MyPath\\ should not be specified

Language Constructs & Functions
Compiler Errors & Warnings
Compiler Error 1703


Compiler Error 1704

# Compiler Error 1704

library error:  Error:  Library name cannot be the same as the module symbol name

Library names must be unique.  They cannot have the same name as the SIMPL+ module.

The following are examples of this error:

#SYMBOL_NAME “CommonFns”

#USER_LIBRARY “CommonFns” // error – same name as #SYMBOL_NAME

#USER_LIBRARY “LibraryFns” // ok

Language Constructs & Functions
Compiler Errors & Warnings
Compiler Error 1704


Compiler Error 1705

# Compiler Error 1705

**library error: Error generating header file for SIMPL# Library: ‘\<clz_name\>’**

**F**atal Error. SIMPL+ does not recognize a construct within the SIMPL# Library.

Please report this issue to Crestron.

Language Constructs & Functions
Compiler Errors & Warnings
Compiler Error 1705


Compiler Error 1706

# Compiler Error 1706

**library error: Error including SIMPL# Library: ‘\<clz_name\>’**

A problem exists within a SIMPL# Library. This could be due to a signing issue or the SIMPL# Library being built incorrectly. The SIMPL# Library should be rebuilt again.

Language Constructs & Functions
Compiler Errors & Warnings
Compiler Error 1706


Compiler Error 1707

# Compiler Error 1707

**library error:  Error:  Library path cannot contain relative or absolute paths: '\<library_name\>'.  (use #INCLUDEPATH instead)**

Fully-qualified paths and relative paths cannot be used when including SIMPL# Libraries.  Only the library name can be specified within the include directive.

The following are examples of this error:

// Module1.usp

`#USER_SIMPLSHARP_LIBRARY “MyLibrary” // ok – no path is given`

`#USER_SIMPLSHARP_LIBRARY “C:\MyPath\MyLibrary” // error – fully-qualified path specified`

`#USER_LIBRARY “..\..\MyPath\MyLibrary” // error – relative path specified`

`// Module2.usp`

`#INCLUDEPATH “C:\\MyLibraries”`

`#INCLUDEPATH “..\\..\\Projects”`

`#USER_SIMPLSHARP_LIBRARY “MySSharpLibrary” // ok`

`#USER_LIBRARY “MySPlusLibrary” // ok`

Language Constructs & Functions
Compiler Errors & Warnings
Compiler Error 1707


Compiler Errors and Warnings Overview (Part 1)

# Compiler Errors and Warnings Overview

Of all the possible problems that a program can have, compiler errors and warnings may be the easiest to remedy. This is because the compiler reveals both the nature and location of the problems it encounters. The only task left to the developer is to recognize exactly what the compiler means and make the necessary changes.

The following list provides the most common causes of compiler errors:

- Missing a semi-colon at the end of a statement

- Having a semi-colon where it does not belong (e.g., before an opening brace of a compound statement)

- Trying to use a variable that has not been declared, or misspelling a variable

- Attempting to assign a value to an input variable (digital, analog, string, or buffer)

- Syntax errors

If multiple error messages are received when compiling the program, it is recommended that you work with the first one before attempting to fix the rest. Many times, a missing semi-colon at the beginning of a program can confuse the compiler enough that it thinks there are many more errors. Fixing the first error may clear up the rest.

The SIMPL+ program compiler errors and warnings are grouped into several categories, as shown in the following table. Errors are listed in numerical order; the numbers are linked to detailed descriptions of the errors.

Compiler Errors and Warnings

Language Constructs & Functions
Compiler Errors & Warnings
Compiler Errors and Warnings Overview
Compiler Errors and Warnings Overview

Compiler Errors Overview Part Warnings and


Compiler Errors and Warnings Overview (Part 2)

| CATEGORY                 | NUMBER                                                                                | MESSAGE TEXT                                                                                |
| ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------- |
| Syntax Errors            | 1000                                                                                | '<identifier>' already defined                                                                          |
| 1001                     | Undefined variable: '<identifier>' Undefined function ‘<identifier>’                                                                                |                                                                                |
| 1002                     | Missing '<token>'                                                                                |                                                                                |
| 1003                     | Incorrect type '<decl_type>', expected type(s): '<decl_type1[,decl_type2] [,decl_typen]>' Incorrect type, expected type(s): '<decl_type1[,decl_type2][,decl_typen]>'                                                                                |                                                                                |
| 1004                     | Unmatched symbol: '<identifier>'                                                                                |                                                                                |
| 1005                     | Unexpected symbol in compiler directive: '<identifier>'                                                                                |                                                                                |
| 1006                     | Invalid #DEFINE_CONSTANT value: '<identifier>'                                                                                |                                                                                |
| 1007                     | Missing array index: '<identifier>'                                                                                |                                                                                |
| 1008                     | Invalid integer argument or undefined variable: '<identifier>'                                                                                |                                                                                |
| 1009                     | Missing structure member: '<identifier>' Structure does not contain member: '<identifier>'                                                                                |                                                                                |
| 1010                     | Symbol Name contains illegal character: ';'                                                                                |                                                                                |
| 1011                     | Missing return value                                                                                |                                                                                |
| 1012                     | Unterminated string constant                                                                                |                                                                                |
| 1013                     | Source code does not evaluate to anything                                                                                |                                                                                |
| 1014                     | The compiler was expecting a parameter type variable and another declaration type or token was found.                                                                                |                                                                                |
| 1015                     | The compiler was expecting a parameter unit and another token or type was found.                                                                                |                                                                                |
| 1016                     | The compiler was expecting a parameter property and another token or type was found.                                                                                |                                                                                |
| 1017                     | Syntax error: SIMPL# Classes and Structures are case-sensitive: ‘<variable_name>’                                                                                |                                                                                |
| Fatal Errors             | 1100                                                                                | Statement outside of function scope                                                                     |
| 1101                     | Abort - Error count exceeded <max_errors>                                                                                |                                                                                |
| Expression Errors        | 1200                                                                                | Invalid numeric expression: '<expression>' Invalid string expression Invalid expression: '<expression>' |
| 1201                     | Invalid \\x sequence Invalid \\x sequence: '<expression>'                                                                                |                                                                                |
| Declaration Errors       | 1300                                                                                | Array size missing Array size invalid                                                                   |
| 1301                     | Invalid array index                                                                                |                                                                                |
| 1302                     | Variable name, ‘<identifier>’, exceeds maximum length of <max> characters                                                                                |                                                                                |
| 1303                     | Declaration type not allowed within structure: '<identifier>' Structure cannot contain String Arrays or Structure variables: '<identifier>' Structure definitions not allowed within other structures Local Structure declarations are not allowed                             |                                                                                |
| 1304                     | Local variables must be declared at top of function                                                                                |                                                                                |
| 1305                     | Local functions not supported                                                                                |                                                                                |
| 1306                     | Declaration type can only be used globally: '<identifier>'                                                                                |                                                                                |
| 1307                     | Variables must be declared before array declarations: '<identifier>'                                                                                |                                                                                |
| 1308                     | Global variable declaration cannot be declared in library file: '<identifier>' I/O Declaration cannot be declared in library file: '<identifier>'                                                                                |                                                                                |
| 1309                     | Compiler Directive must be set before all global variable declarations #DEFAULT_NONVOLATILE Compiler Directive already set #DEFAULT_VOLATILE Compiler Directive already set                                                                                |                                                                                |
| 1310                     | Compiler directive cannot be in function scope                                                                                |                                                                                |
| 1311                     | Undefined Wait Label: '<identifier>' Missing, invalid or already defined Wait label: '<identifier>'                                                                                |                                                                                |
| 1312                     | Array boundary exceeded maximum size of ‘num_bytes’ bytes                                                                                |                                                                                |
| 1313                     | Minimum array size invalid                                                                                |                                                                                |
| 1314                     | Minimum array size is not allowed for this datatype: '<identifier>' Minimum array size for this datatype has already been declared: '<identifier>                                                                                |                                                                                |
| 1315                     | The receiving buffer size was not specified within the socket declaration. All socket declarations must contain a buffer size.                                                                                |                                                                                |
| 1316                     | An invalid Parameter Type was specified within a parameter declaration.                                                                                |                                                                                |
| 1317                     | A variable was found trying to be declared with the NONVOLATILE keyword.                                                                                |                                                                                |
| 1318                     | A parameter was being assigned a value that was either out of range or of the wrong type.                                                                                |                                                                                |
| 1319                     | A parameter was being assigned a value that was either out of range or of the wrong type.                                                                                |                                                                                |
| 1320                     | The property unit, unitString, cannot be combined with any other property unit (i.e., unitDecimal,unitCharacter, etc).                                                                                |                                                                                |
| 1321                     | The declaration keyword, Dynamic, can only be used when #DEFAULT_VOLATILE is specified for the program module.                                                                                |                                                                                |
| 1322                     | The declaration keyword, Dynamic, can only be used with string or array declarations. I/O declarations are not allowed to be declared as dynamic.                                                                                |                                                                                |
| 1323                     | In order to declare Strings and Arrays dynamically, the compiler directive, #ENABLE_DYNAMIC, must be specified beforehand within the module.                                                                                |                                                                                |
| 1324                     | propList cannot be used in conjunction with propBounds. propBounds cannot be used in conjunction with propList.                                                                                |                                                                                |
| 1325                     | Default values, if specified, must be specified before a propList declaration. If using propBounds, the Default Value must be defined beforehand. If a default value is specified, the propList must contain at least one element that contains this default value.            |                                                                                |
| 1326                     | The Default Value must be within the bounds specified in propBounds. The compiler will also enforce that the lower bound is less than the upper bound. All values specified must also be of the type indicated within propValidUnits.                                          |                                                                                |
| 1327                     | Variables that are declared as volatile are only allowed to be resized. Either the global compiler directive, #VOLATILE, or the declaration modifier, “VOLATILE”, may be used to declare a variable as volatile.                                                               |                                                                                |
| 1328                     | Encoding only applies to strings. The declaration modifiers, ASCII, UTF16 and INHERIT can only be used with variables of type STRING.                                                                                |                                                                                |
| 1329                     | Declaration error: Class name exists in one or more namespaces. Fully-qualified name must be specified: ‘<class_name>’                                                                                |                                                                                |
| Assignment Errors        | 1400                                                                                | Illegal Assignment                                                                                |
| 1401                     | Variable cannot be used for assignment: '<identifier>'                                                                                |                                                                                |
| 1402                     | Variable can only be used for assignment: '<identifier>'                                                                                |                                                                                |
| Function Argument Errors | 1500                                                                                | Argument <arg_num> cannot be passed by reference                                                        |
| 1501                     | Argument <arg_num> cannot be passed by value                                                                                |                                                                                |
| 1502                     | Function contains incomplete number of arguments Function call contains an unmatched number of arguments                                                                                |                                                                                |
| 1503                     | Input or Output signal expected: '<identifier>'                                                                                |                                                                                |
| 1504                     | Incomplete number of format string arguments Format string contains an unmatched number of arguments Argument <arg_num> is missing or invalid. Argument <arg_num> is missing or invalid. <decl_type> expected                                                                  |                                                                                |
| 1505                     | Format string contains invalid format specifier                                                                                |                                                                                |
| 1506                     | 0, 1 or 2 constant expected for argument 1                                                                                |                                                                                |
| 1507                     | Argument <arg_num>: Missing or invalid array                                                                                |                                                                                |
| 1508                     | I/O variable cannot be passed to read file functions: '<identifier>'                                                                                |                                                                                |
| 1509                     | A valid class name was expected for a function argument and was not found.                                                                                |                                                                                |
| 1510                     | A valid class event handler was expected for a function argument and was not found.                                                                                |                                                                                |
| Construct Errors         | 1600                                                                                | 'Function Main' cannot contain function parameters 'Function Main' cannot return a value                |
| 1601                     | Duplicate CASE Statement Constant expected: '<identifier>'                                                                                |                                                                                |
| 1602                     | Switch statement contains 'default' without 'case' labels                                                                                |                                                                                |
| 1603                     | #CATEGORY does not exist: '<categorgy_number>' Defaulting to Category Type, ""32"" (Miscellaneous).                                                                                |                                                                                |
| 1604                     | 'EVENT' already has a body                                                                                |                                                                                |
| 1605                     | Function can only be contained within an event                                                                                |                                                                                |
| 1606                     | Statement must be contained within a loop statement                                                                                |                                                                                |
| 1607                     | GetLastModifiedArrayIndex may return an ambiguous signal index                                                                                |                                                                                |
| 1608                     | Missing library file name                                                                                |                                                                                |
| 1609                     | The compiler encountered this function call outside of Function Main                                                                                |                                                                                |
| 1610                     | The compiler encountered this function call within a Wait Statement.                                                                                |                                                                                |
| 1611                     | An invalid structure type was encountered within a construct.                                                                                |                                                                                |
| 1612                     | Custom category names can only be assigned to category “46”. A different category number was found.                                                                                |                                                                                |
| 1613                     | SocketGetSenderIPAddress can only be used within the SOCKETRECEIVE event. It cannot be used inside any other declared function or event type.                                                                                |                                                                                |
| 1614                     | SocketGetStatus can only be used within the SOCKETSTATUS event. It cannot be used inside any other declared function or event type.                                                                                |                                                                                |
| 1615                     | The functions, GetExcpetionMessage and GetExceptionCode can only be used within the CATCH portion of a TRY-CATCH statement block. It cannot be used inside any other type of statement block or event handler.                                                                 |                                                                                |
| 1616                     | When registering delegates, the callback function specified must be valid and exist within the SIMPL+ module. The delegate callback function’s signature must match the signature within the SIMPL# Library.                                                                   |                                                                                |
| File Errors              | 1700                                                                                | End of file reached                                                                                |
| 1701                     | Error writing header file: '<file_name>' Error writing file: '<file_name>' Error writing library file Error writing output file Error creating compiler makefile: '<file_name>' Error opening compiler source makefile: '<file_name>' Error opening source file: '<file_name>' |                                                                                |
| 1702                     | Error extracting library, '<file_name>', from archive: '<archive_file>'                                                                                |                                                                                |
| 1703                     | When including User or Crestron libraries, only the library name is needed within the functions, #USER_LIBRARY and #CRESTRON_LIBRARY. Passing in a fully qualified path is not allowed.                                                                                |                                                                                |
| 1704                     | Library names must be unique. They cannot have the same name as the SIMPL+ module.                                                                                |                                                                                |
| 1705                     | Fatal Error.SIMPL+ does not recognize a construct within the SIMPL# Library.                                                                                |                                                                                |
| 1706                     | A problem exists within a SIMPL# Library. This could be due to a signing issue or the SIMPL# Library being built incorrectly. The SIMPL# Library should be rebuilt again.                                                                                |                                                                                |
| 1707                     | Library error: Library path cannot be relative: <library name>. Absolute paths may be used.                                                                                |                                                                                |
| Compiler Warnings        | 1019                                                                                | Logic excluded as a result of #if_series3 directive                                                     |
| 1800                     | 'Return' statement will only terminate current Wait statement's function scope                                                                                |                                                                                |
| 1801                     | 'TerminateEvent' statement will only terminate current Wait statement's function scope                                                                                |                                                                                |
| 1802                     | #CATEGORY_NAME defined more than once. Using: #CATEGORY_NAME "<number>"                                                                                |                                                                                |
| 1803                     | Possible data loss: LONG_INTEGER to INTEGER assignment                                                                                |                                                                                |

CASE CATEGORY Compiler DEFAULT_NONVOLATILE DEFAULT_VOLATILE DEFINE_CONSTANT ENABLE_DYNAMIC EVENT Errors INTEGER LONG_INTEGER NONVOLATILE Overview Part STRING VOLATILE Warnings and

Errors are listed in numerical order; the numbers are linked to detailed descriptions of the errors. Compiler Errors and Warnings


Compiler Warning 1019

# Compiler Warning 1019

compiler warning:  Logic excluded as a result of #if_series3 directive

SIMPL+ module(s) contain the #IF_SERIES3 directive. When compiling for 4-Series control systems any logic within the #IF_SERIES3 directive block will be excluded from compilation which may result in loss of functionality.

Review the logic contained within the #IF_SERIES3 directive and make sure that it doesn't include any logic intended for 4-series control systems.

Language Constructs & Functions
Compiler Errors & Warnings
Compiler Warning 1019


Compiler Warning 1800

# Compiler Warning 1800

compiler warning:  'Return' statement will only terminate current

                                      Wait statement's function scope

A ‘Return’ statement within a Wait Statement’s block of code will cause the Wait Statement to terminate.  It will NOT terminate the current function that the Wait Statement resides within.

Wait Statements are similar to event functions (EVENT, PUSH, CHANGE, RELEASE) in that they execute in their own program thread.  The control system can have many threads executing at the same time;  each thread runs concurrent with one another.

The following are examples of this warning:

FUNCTION MyFunc( INTEGER x )

{

   if ( x == 1 )

   {

      Wait( 500 )

      {

         return;      // warning - this will terminate the

                      //           Wait Statement. It will NOT

                      //           terminate MyFunc()

      }

   }

   else if ( x == 2 )

      return;         // this will terminate MyFunc()

   x = x + 1;

}

Language Constructs & Functions
Compiler Errors & Warnings
Compiler Warning 1800

CHANGE Compiler EVENT FUNCTION INTEGER MyFunc PUSH RELEASE Wait Warning


Compiler Warning 1801

# Compiler Warning 1801

compiler warning:  'TerminateEvent' statement will only terminate current

                                      Wait statement's function scope

When Wait Statements are embedded within one another, the TerminateEvent, will only terminate the corresponding Wait Statement of the same scope.  It will NOT terminate any Wait Statements that are of a different scope.

Wait Statements are similar to event functions (EVENT, PUSH, CHANGE, RELEASE) in that they execute in their own program thread.  The control system can have many threads executing at the same time;  each thread runs concurrent with one another.

Scope refers to the level at which an Event, user-defined function or statement resides.  Having a global scope means that the function or variable can be called or accessed from anywhere within the program.  A local scope means that the variable can only be accessed from within the event or function that it resides in.

The following are examples of this warning:

FUNCTION MyFunc( INTEGER x )

{

   Wait( 500, MyLabel1 )

   {

      Wait( 300, MyLabel2 )

      {

         TerminateEvent;    // warning – this will only terminate

                            //           the Wait Statent, MyLabel2.

                            //           MyLabel1 will continue to

                            //           execute

      }

   }

}

Language Constructs & Functions
Compiler Errors & Warnings
Compiler Warning 1801


Compiler Warning 1802

# Compiler Warning 1802

compiler warning:  #CATEGORY_NAME defined more than once.

                                      Using: #CATEGORY_NAME "\<number\>"

Only one category name is allowed for each SIMPL+ module.  If the compiler directive, #CATEGORY, is found more than once within a SIMPL+ module, the compiler will use the category number from the last occurrence of the compiler directive.

The following are examples of this warning:

#CATEGORY “1”

#CATEGORY “2”

FUNCTION MyFunc()

{

}

#CATEGORY “3”          // this is the resulting category number

                       // for this SIMPL+ module

FUNCTION AnotherFunc()

{

}

Language Constructs & Functions
Compiler Errors & Warnings
Compiler Warning 1802

AnotherFunc CATEGORY Compiler FUNCTION MyFunc Warning


Compiler Warning 1803

# Compiler Warning 1803

compiler warning:  Possible data loss: LONG_INTEGER to INTEGER assignment

A LONG_INTEGER result was assigned to an INTEGER variable or passed to a function for an INTEGER parameter.  The 32-bit LONG_INTEGER will be truncated to 16-bit value and assigned to the integer, resulting in a loss of data.

- Make sure all the datatypes within an expression are of the same datatype.

- Make sure the parameter of a function being called is of the same datatype as the argument being passed in.

- Make sure the return value of a function matches the destination’s datatype.

The following are examples of this warning:

LONG_FUNCTION MyFunc( INTEGER x )

{

   INTEGER i;

   LONG_INTEGER j;

   i = i;            // ok – both sides of the assigment are of

                     //      the same datatype

   j = i;            // ok – no loss of data

   j = j;            // ok – both sides of the assigment are of

                     //      the same datatype

   i = j;            // warning – LONG_INTEGER being assigned to

                     //           an INTEGER

   Call MyFunc( i ); // ok

   Call MyFunc( j ); // warning

   i = MyFunc( 5 );  // warning – the integer, i, is being assigned a

                     //           LONG_INTEGER value

}

Language Constructs & Functions
Compiler Errors & Warnings
Compiler Warning 1803

Compiler INTEGER LONG_INTEGER MyFunc Warning


Atoi

# Atoi

Name:

Atoi

Syntax:

    INTEGER Atoi(STRING SOURCE);

Description:

Converts a STRING to an INTEGER value. The conversion looks for the first valid character (0-9), and then reads until it finds the first invalid character. The resulting string of valid characters is then converted. The "-" is ignored, hence the output is an unsigned number [i.e., ATOI("-1") would yield 1 as the output]. If the value exceeds 65535, the value is undefined. If no valid value to convert is found, 0 is returned.

Parameters:

SOURCE is a string containing characters that range from 0 to 9 to be converted.

The result will be an unsigned number from 0 to 65535.

Return Value:

An integer representing the given string value.

Example:

    STRING_INPUT IN$[100];

    INTEGER VAL;

    CHANGE IN$

    {

      VAL = ATOI(IN$);

      PRINT("Value of %s after ATOI is %d\n", IN$, VAL);

    }

For example, if IN$ is "abc1234xyz", then VAL will hold the integer 1234. If IN$ is "-50", then VAL will hold the integer 50.

Version:

X Generation:  SIMPL v1.20.01 and later

2-Series:  SIMPL v2.01.05 and later

Language Constructs & Functions
Data Conversion Functions
ATOI
Atoi

ATOI Atoi CHANGE INTEGER PRINT STRING STRING_INPUT


Atol

# Atol

Name:

Atol

Syntax:

    LONG_INTEGER Atol(STRING SOURCE);

Description:

Converts a STRING to an LONG_INTEGER value. The conversion looks for the first valid character (0-9), and then reads until it finds the first invalid character. The resulting string of valid characters is then converted. The "-" is ignored, hence the output is an unsigned number [i.e., ATOL("-1") would yield 1 as the output]. If no valid value to convert is found, 0 is returned. If the integer would exceed 32 bits, the value returned is undefined.

Parameters:

SOURCE is a string containing characters that range from 0 to 9 to be converted. The result will be an unsigned number from 0 to 4294967295.

Return Value:

A long integer representing the given string value.

Example:

    STRING_INPUT IN$[100];

    LONG_INTEGER VAL;

    CHANGE IN$

    {

      VAL = ATOL(IN$);

      PRINT("Value of %s after ATOL is %ld\n", IN$, VAL);

    }

For example, if IN$ is "abc1234xyz", then VAL will hold the number 1234. If IN$ is "-50", then VAL will hold the number 50.

Version:

X Generation:  Not Supported

2-Series:  SIMPL v2.02.10 and later

Language Constructs & Functions
Data Conversion Functions
ATOL
Atol

ATOL Atol CHANGE LONG_INTEGER PRINT STRING STRING_INPUT


Chr

# Chr

Name:

Chr

Syntax:

    STRING Chr(INTEGER CODE);

Description:

Takes the integer value specified and returns the corresponding ASCII character as a one-byte string.

Parameters:

CODE contains a number from 0 to 255 to be converted into an ASCII string.

Return Value:

A string representing the code. If CODE is greater than 255, lower 8-bits of CODE are used in the computation.

Example:

    STRING_OUTPUT Code$;

    ANALOG_INPUT VALUE;

    CHANGE VALUE

    {

      Code$ = CHR(VALUE);

      PRINT("Code = %s\n", Code$);

    }

In this example, if VALUE was equal to 72, the output would be Code = H.

Version:

X Generation:  SIMPL v1.20.01 and later

2-Series:  SIMPL v2.01.05 and later

Language Constructs & Functions
Data Conversion Functions
Chr

ANALOG_INPUT CHANGE CHR Chr INTEGER PRINT STRING STRING_OUTPUT


Datatype Conversions

# Datatype Conversions

| Source              | Destination         | Action                                                                               |
| ------------------- | ------------------- | ------------------------------------------------------------------------------------ |
| INTEGER             | LONG_INTEGER        | Lower 2 bytes of destination = source. Upper 2 bytes cleared.                        |
| INTEGER             | SIGNED_INTEGER      | The 2 bytes of source moved to destination. 2 byte number now treated as signed.     |
| INTEGER             | SIGNED_LONG_INTEGER | Lower 2 bytes of destination = source. Upper 2 bytes cleared.                        |
| LONG_INTEGER        | INTEGER             | Lower 2 bytes of source moved to destination, treated as unsigned.                   |
| LONG_INTEGER        | SIGNED_INTEGER      | Lower 2 bytes of source moved to destination, treated as signed.                     |
| LONG_INTEGER        | SIGNED_LONG_INTEGER | The 4 bytes of destination = source, now treated as signed.                          |
| SIGNED_LONG_INTEGER | INTEGER             | Lower 2 bytes of source moved to destination.                                        |
| SIGNED_LONG_INTEGER | SIGNED_INTEGER      | Lower 2 bytes of source moved to destination.                                        |
| SIGNED_LONG_INTEGER | LONG_INTEGER        | The 4 bytes of destination = source, now treated as unsigned.                        |
| SIGNED_INTEGER      | INTEGER             | Lower 2 bytes of source moved to destination, 2 byte number now treated as unsigned. |
| SIGNED_INTEGER      | LONG_INTEGER        | 2 byte source is sign extended to 4 bytes                                            |
| SIGNED_INTEGER      | SIGNED_LONG_INTEGER | 2 byte source is sign extended to 4 bytes                                            |

Language Constructs & Functions
Data Conversion Functions
Datatype Conversions


HexToI

# HexToI

Name:

HexToI

Syntax:

    INTEGER HexToI(STRING Source);

Description:

Returns the INTEGER value of Source.  If Source exceeds 4 characters, the lower 4 characters of Source are used.

Parameters:

STRING Source:  A string containing the characters are 0 through 9, A through F, and a through f.  If other characters are in the string, the result is undefined or zero, depending on the SIMPL+ Cross Compiler Include File version.

Return Value:

An integer representing the given string value.

If the source string contains characters other than A-F, a-f, 0-9 the result will be undefined if the SIMPL+ Cross Compiler Include file is less than version 1.45, or zero if the SIMPL+ Cross Compiler Include file is version 1.45 or later.

The Cross Compiler Include File version can be determined from the SIMPL+ Editor, under Help | About.

Example:

   INTEGER V1, V2;

   V1 = HexToI("ABCD");

   V2 = HexToI("ABCDE"); // Only BCDE will be in the conversion.

   PRINT("V1=%u, V2=%u\n", V1, V2);

For example,  the code shown above would return: V1=43981, V2=48350

Version:

SIMPL+ Version 3.03.00 or later

CUZ 3.137 or later required

Language Constructs & Functions
Data Conversion Functions
HexToI


HexToL

# HexToL

Name:

HexToL

Syntax:

    LONG_INTEGER HexToL(STRING Source);

Description:

Returns the LONG_INTEGER value of Source.  If Source exceeds 8 characters, the lower 8 characters of Source are used.

Parameters:

STRING Source:  A string containing the characters are 0 through 9, A through F, and a through f.  If other characters are in the string, the result is undefined or zero, depending on the SIMPL+ Cross Compiler Include File version.

Return Value:

A LONG_INTEGER containing the string value.

If the source string contains characters other than A-F, a-f, 0-9 the result will be undefined if the SIMPL+ Cross Compiler Include file is less than version 1.45, or zero if the SIMPL+ Cross Compiler Include file is version 1.45 or later.

The Cross Compiler Include File version can be determined from the SIMPL+ Editor, under Help | About.

Example:

   LONG_INTEGER V1, V2;

   V1 = HexToL("ABCD1234");

   V2 = HexToL("ABCD12340"); // Only BCD12340 will be in the conversion.

   PRINT("V1=%lu, V2=%lu\n", V1, V2);

For example,  the code shown above would return: V1= 2882343476, V2= 3167822656

Version:

SIMPL+ Version 3.03.00 or later

CUZ 3.137 or later required

Language Constructs & Functions
Data Conversion Functions
HexToL


HexToSI

# HexToSI

Name:

HexToSI

Syntax:

    SIGNED_INTEGER HexToSI (STRING Source);

Description:

Returns the SIGNED_INTEGER value of Source.  If Source exceeds 4 characters, the lower 4 characters of Source are used.

Parameters:

STRING Source:  A string containing the characters are 0 through 9, A through F, and a through f.  If other characters are in the string, the result is undefined or zero, depending on the SIMPL+ Cross Compiler Include File version.

Return Value:

A SIGNED_INTEGER containing the string value.

If the source string contains characters other than A-F, a-f, 0-9 the result will be undefined if the SIMPL+ Cross Compiler Include file is less than version 1.45, or zero if the SIMPL+ Cross Compiler Include file is version 1.45 or later.

The Cross Compiler Include File version can be determined from the SIMPL+ Editor, under Help | About.

Example:

   SIGNED_INTEGER V1, V2;

   V1 = HexToSI ("FFFF");

   V2 = HexToSI ("AFFFB); // Only FFFB will be in the conversion.

   PRINT("V1=%d, V2=%d\n", V1, V2);

For example,  the code shown above would return: V1=-1, V2=-5

Version:

SIMPL+ Version 3.03.00 or later

CUZ 3.137 or later required

Language Constructs & Functions
Data Conversion Functions
HexToSI


HexToSL

# HexToSL

Name:

HexToSL

Syntax:

    SIGNED_LONG_INTEGER HexToL(STRING Source);

Description:

Returns the SIGNED_LONG_INTEGER value of Source.  If Source exceeds 8 characters, the lower 8 characters of Source are used.

Parameters:

STRING Source:  A string containing the characters are 0 through 9, A through F, and a through f.  If other characters are in the string, the result is undefined or zero, depending on the SIMPL+ Cross Compiler Include File version.

Return Value:

A SIGNED_LONG_INTEGER containing the string value.

If the source string contains characters other than A-F, a-f, 0-9 the result will be undefined if the SIMPL+ Cross Compiler Include file is less than version 1.45, or zero if the SIMPL+ Cross Compiler Include file is version 1.45 or later.

The Cross Compiler Include File version can be determined from the SIMPL+ Editor, under Help | About.

Example:

   SIGNED_LONG_INTEGER V1, V2;

   V1 = HexToSL("FFFF1234");

   V2 = HexToSL("FFFF12340"); // Only FFF12340 will be in the conversion.

   PRINT("V1=%ld, V2=%ld\n", V1, V2);

For example,  the code shown above would return: V1=-60876, V2=-974016

Version:

SIMPL+ Version 3.03.00 or later

CUZ 3.137 or later required

Language Constructs & Functions
Data Conversion Functions
HexToSL

HexToL HexToSL PRINT SIGNED_LONG_INTEGER STRING


ItoA

# ItoA

Name:

ItoA

Syntax:

    STRING ItoA(INTEGER CODE);

Description:

Takes the value in CODE and creates a string containing the string equivalent of that integer. The output string does not contain leading zeros.

Parameters:

CODE contains a number from 0 to 65535 to be converted into a string. CODE is treated as an unsigned number.

Return Value:

A string representing the code. If CODE is greater than 65535, lower 16-bits of CODE are used in the computation.

Note that the following two statements are equivalent:

    out$ = itoa(CODE);

    makestring(out$, "%d", CODE);

Example:

    STRING_OUTPUT Code$;

    ANALOG_INPUT VALUE;

    CHANGE VALUE

    {

      Code$ = ITOA(VALUE);

      PRINT("Code$ = %s\n", ITOA(VALUE);

    }

For example, if VALUE was equal to 25, Code$ would contain the string "25".

Version:

X Generation:  SIMPL v1.20.01 and later

2-Series:  SIMPL v2.01.05 and later

Language Constructs & Functions
Data Conversion Functions
ITOA
ItoA

ANALOG_INPUT CHANGE INTEGER ITOA ItoA PRINT STRING STRING_OUTPUT


ItoHex

# ItoHex

Name:

ItoHex

Syntax:

    STRING ITOHEX(INTEGER CODE);

Description:

Takes the value in CODE and creates a string containing the hexadecimal equivalent. The output string does not contain leading zeros and is expressed in uppercase.

Parameters:

CODE contains a number from 0 to 65535 to be converted into a hexadecimal string. CODE is treated as an unsigned number.

Return Value:

A string representing the code. If CODE is greater than 65535, lower 16-bits of CODE are used in the computation.

Note that the following two statements are equivalent:

    out$ = itohex(CODE);

    makestring(out$, "%X", CODE);

Example:

    STRING_OUTPUT Code$;

    ANALOG_INPUT VALUE;

    CHANGE VALUE

    {

      Code$ = ITOHEX(VALUE);

      PRINT("Code$ = %s\n", ITOHEX(VALUE);

    }

For example, if VALUE contained the integer 90, Code$ would contain the string "5A".

Version:

X Generation:  SIMPL v1.20.01 and later

2-Series:  SIMPL v2.01.05 and later

Language Constructs & Functions
Data Conversion Functions
ITOHEX
ItoHex

ANALOG_INPUT CHANGE INTEGER ITOHEX ItoHex PRINT STRING STRING_OUTPUT


LtoA

# LtoA

Name:

LtoA

Syntax:

    STRING LtoA(LONG_INTEGER CODE);

Description:

Takes the value in CODE and creates a string containing the string equivalent of that LONG_INTEGER. The output string does not contain leading zeros.

Parameters:

CODE contains a number from 0 to 4294967295 to be converted into a string. CODE is treated as an unsigned number.

Return Value:

A string representing the code.

Note that the following two statements are equivalent:

    out$ = ltoa(CODE);

    makestring(out$, "%ld", CODE);

Example:

    STRING_OUTPUT Code$;

    LONG_INTEGER VALUE;

    CHANGE VALUE

    {

      Code$ = LTOA(VALUE);

      PRINT("Code = %s\n", Code$);

    }

For example, if VALUE was equal to 25, Code$ would contain the string "25".

Version:

X Generation:  Not Supported

2-Series:  SIMPL v2.02.10 and later

Language Constructs & Functions
Data Conversion Functions
LtoA

CHANGE LONG_INTEGER LTOA LtoA PRINT STRING STRING_OUTPUT


LtoHex

# LtoHex

Name:

LtoHex

Syntax:

    STRING LTOHEX(LONG_INTEGER CODE);

Description:

Takes the value in CODE and creates a string containing the hexadecimal equivalent. The output string does not contain leading zeros and is expressed in uppercase.

Parameters:

CODE contains a number from 0 to 4294967295 to be converted into a hexadecimal string. CODE is treated as an unsigned number.

Return Value:

A string representing the code.

Note that the following two statements are equivalent:

    out$ = ltohex(CODE);

    makestring(out$, "%X", CODE);

Example:

    STRING_OUTPUT Code$;

    LONG_INTEGER VALUE;

    CHANGE VALUE

    {

      Code$ = LTOHEX(VALUE);

      PRINT("Code = %s\n", Code$);

    }

For example, if VALUE contained the integer 90, Code$ would contain the string "5A".

Version:

X Generation:  Not Supported

2-Series:  SIMPL v2.02.10 and later

Language Constructs & Functions
Data Conversion Functions
LtoHex

CHANGE LONG_INTEGER LTOHEX LtoHex PRINT STRING STRING_OUTPUT


Data Conversion Functions Overview

# Data Conversion Functions Overview

These functions take one form of data (integer or string) and convert it to the opposite type in a given SIMPL+ program. Usually, these functions are for converting number stored in strings to integers, or for converting numbers stored in integers to strings.

|  |  |
|----|----|
| Function | Description |
| [ATOI] | Converts a STRING to an INTEGER value. |
| [ATOL] | Converts a STRING to an LONG_INTEGER value. |
| [Chr] | Takes the integer value specified and returns the corresponding ASCII character as a one-byte string. |
| [HexToI] | Returns the INTEGER value of Source.  If Source exceeds 4 characters, the lower 4 characters of Source are used.   |
| [HexToL] | Returns the LONG_INTEGER value of Source.  If Source exceeds 8 characters, the lower 8 characters of Source are used.   |
| [HexToSI] | Returns the SIGNED_INTEGER value of Source.  If Source exceeds 4 characters, the lower 4 characters of Source are used.   |
| [HexToSL] | Returns the SIGNED_LONG_INTEGER value of Source.  If Source exceeds 8 characters, the lower 8 characters of Source are used.   |
| [ITOA] | Takes the value in CODE and creates a string containing the string equivalent of that integer. |
| [ITOAHex] | Takes the value in CODE and creates a string containing the hexadecimal equivalent. |
| [LtoA] | Takes the value in CODE and creates a string containing the string equivalent of that LONG_INTEGER. |
| [LtoHex] | Takes the value in CODE and creates a string containing the hexadecimal equivalent. |

  [ATOI]: ATOI.md
  [ATOL]: ATOL.md
  [Chr]: Chr.md
  [HexToI]: HexToI.md
  [HexToL]: HexToL.md
  [HexToSI]: HexToSI.md
  [HexToSL]: HexToSL.md
  [ITOA]: ITOA.md
  [ITOAHex]: ITOHEX.md
  [LtoA]: LtoA.md
  [LtoHex]: LtoHex.md

Language Constructs & Functions
Data Conversion Functions
Overview
Data Conversion Functions Overview

ATOI ATOL Chr Conversion Data Functions HexToI HexToL HexToSI HexToSL INTEGER ITOA ITOAHex LONG_INTEGER LtoA Overview SIGNED_INTEGER SIGNED_LONG_INTEGER STRING

ATOI ATOL Chr HexToI HexToL HexToSI HexToSL ITOA ITOAHex LtoA


ANALOG_INPUT

# ANALOG_INPUT

Name:

ANALOG_INPUT

Syntax:

ANALOG_INPUT \<var1\>[,\<var2\>...];

ANALOG_INPUT \<var[size]\>;

ANALOG_INPUT \<var[size[,\<min\>]]\>

ANALOG_INPUT \<var1\>[,[_SKIP_]][,\<var2\>...];

Description:

Routes analog inputs from the outside SIMPL program into a SIMPL+ program under with the specified variable names. ANALOG_INPUT values are 16-bit numbers. They are treated as signed or unsigned values inside of a SIMPL+ program depending on the operators or functions being used. Refer to the discussion on fixed and variable arrays in [Declarations Overview.]

NOTE:  ANALOG_INPUT variables may not be passed to functions in Version 3.00 for the 2-Series Control Systems. If you need to pass an ANALOG_INPUT variable to a function, assign it to a locally declared variable and pass that variable to the function.

For an array of ANALOG_INPUTs, the maximum value of SIZE is 65535. Valid indices are 1 through the specified size.

NOTE: \<min\> is the number of inputs shown at a minimum, in SIMPL the default is 1. The user can expand the minimum up to the full size. Only the last array of a type can have a \<min\>.

NOTE: The [_SKIP_] keyword can be used in DIGITAL_INPUT, DIGITAL_OUTPUT, ANALOG_INPUT, ANALOG_OUTPUT, BUFFER_INPUT, STRING_INPUT and STRING_OUTPUT declarations.

Example:

ANALOG_INPUT ramp1;

Signifies that one analog input is coming into the SIMPL+ program from the SIMPL Program.

ANALOG_INPUT light_levels[25];

Signifies that up to 25 analog inputs are coming into the SIMPL+ program from the SIMPL Program, referenced as light_levels[1] through light_levels[25]. One is shown as a minimum but the symbol input can be expanded by the user up to 25.

ANALOG_INPUT temp_set_pts[20,4];

Signifies that up to 20 analog inputs exist, referenced as temp_set_pts[1] through temp_set_pts[20]. Four are shown at a minimum, and the symbol inputs can be expanded by the user up to 20.

Version:

X Generation

SIMPL v1.20.01 and later

SIMPL v1.50.06 and later for ANALOG_INPUT arrays

2-Series

SIMPL v2.01.05 and later [Same features as X Generation SIMPL v1.50.06]

SIMPL v2.03.18 and later for fixed arrays and minimum sizes.

  [_SKIP_]: javascript:void(0);
  [Declarations Overview.]: Declarations_Overview.md

Language Constructs & Functions
Declarations
ANALOG INPUT
ANALOG_INPUT


ANALOG_OUTPUT (Part 1)

# ANALOG_OUTPUT

Name:

ANALOG_OUTPUT

Syntax:

ANALOG_OUTPUT \<var1\>[,\<var2\>...];

ANALOG_OUTPUT \<var[size]\>;

ANALOG_OUTPUT\<var[size[,\<min\>]]\>;

ANALOG_OUTPUT \<var1\>[,[_SKIP_]][,\<var2\>...];

Description:

Routes a value from the SIMPL+ program to the SIMPL program as an analog value. ANALOG_OUTPUT values are 16-bit numbers. They are treated as signed or unsigned values inside of a SIMPL+ program depending on the operators or functions being used. Refer to the discussion on fixed and variable arrays in [Declarations Overview.]

NOTE:  ANALOG_OUTPUTs may be jammed with other analog values from a SIMPL program (i.e., from a RAMP or other analog logic, even other SIMPL+ symbols). When such an output is jammed, the new value is read back into the SIMPL+ symbol and the value of the output is altered.

In X-Generation Control Systems, the logic process only sees the last analog that was posted after the SIMPL+ module tasks switched away. Therefore, in a loop that iterates from 1 to 10000, only a few of the values will be seen by the logic process. If all values should be seen by the logic process, a PROCESSLOGIC statement is required after the assignment to the ANALOG_OUTPUT.

When the SIMPL+ program writes to the ANALOG_OUTPUT, the new value is posted immediately. Therefore, if the value is read back after being assigned, the new value is read back (unlike a DIGITAL_OUTPUT on X-Generation control systems).

In the 2-Series Control Systems, the logic process sees ALL values that are assigned to the ANALOG_OUTPUT. No PROCESSLOGIC is required.

For an array of ANALOG_OUTPUTs, the maximum value of SIZE is 65535. Valid indices are 1 through the specified size.

NOTE: \<min\> is the number of outputs shown at a minimum, in SIMPL the default is 1. The user can expand the minimum up to the full size. Only the last array of a type can have a \<min\>.

NOTE: The [_SKIP_] keyword can be used in DIGITAL_INPUT, DIGITAL_OUTPUT, ANALOG_INPUT, ANALOG_OUTPUT, BUFFER_INPUT, STRING_INPUT and STRING_OUTPUT declarations.

Example:

ANALOG_OUTPUT LEVEL;

Signifies that one analog output is being sent from the SIMPL+ program to the SIMPL program.

ANALOG_OUTPUT LEVELS[25];

Signifies that up to 25 analog outputs, referenced as LEVELS[1] through LEVELS[25] are being sent from the SIMPL+ program to the SIMPL program.

ANALOG_OUTPUT LEVELS[25,5];

Signifies same as above, except that a minimum of 5 are shown at any time.

NOTE:  If LEVEL or any of the elements from LEVELS is jammed from outside the symbol, it will take on that new jammed value.

NOTE: You should use [isSignalDefined] to test whether the output is connected to an actual signal in the SIMPL program before assigning a value to it. If you assign a value and there is no signal, a message is placed in the system error log.

Version:

X-Generation

SIMPL v1.20.01 and later

SIMPL v1.50.06 and later, support for ANALOG_OUTPUT arrays

2-Series

SIMPL v2.01.05 and later  [Same support as X Generation SIMPL v1.50.06, however, ANALOG_OUTPUTs or ANALOG_OUTPUT Arrays cannot be passed by reference]

SIMPL v2.03.18 and later, Fixed size arrays and minimum sizes.

Language Constructs & Functions
Declarations
ANALOG OUTPUT
ANALOG_OUTPUT


ANALOG_OUTPUT (Part 2)

  [_SKIP_]: javascript:void(0);
  [Declarations Overview.]: Declarations_Overview.md
  [isSignalDefined]: ../System_Interfacing/IsSignalDefined.md

ANALOG_OUTPUT Declarations Overview Part isSignalDefined

If you assign a value and there is no signal, a message is placed in the system error log. Version:

X-Generation

SIMPL v1.20.01 and later

SIMPL v1.50.06 and later, support for ANALOG_OUTPUT arrays

2-Series

SIMPL v2.01.05 and later  [Same support as X Generation SIMPL v1.50.06, however, ANALOG_OUTPUTs or ANALOG_OUTPUT Arrays cannot be passed by reference]

SIMPL v2.03.18 and later, Fixed size arrays and minimum sizes.


BUFFER_INPUT

# BUFFER_INPUT

Name:

BUFFER_INPUT

Syntax:

BUFFER_INPUT \<var1[max_length]\>[,\<var2[max_length]\>...];

BUFFER_INPUT \<var[size][max_length]\>;

BUFFER_INPUT\<var[size[,\<min\>]][max_length]\>;

BUFFER_INPUT \<var1\>[,[_SKIP_]][,\<var2\>...];

Description:

Routes serial inputs from the outside SIMPL program into a SIMPL+ program under the specified variable names. This is used when a serial string coming from a communications port needs to be processed by a SIMPL+ program. When new data comes in on a BUFFER_INPUT, the data is appended to the end of a BUFFER_INPUT. If the buffer is full, the contents are shifted up and the new data is appended to the end. This differs from STRING_INPUTs in that new data entering into a STRING_INPUT variable replaces the previous string contents. BUFFER_INPUTs may be processed with string handling functions. The GETC function may be used to read a character from the beginning of the buffer and shift the contents up by 1. Buffer inputs may be written to, so their data space may be used as a storage spot for doing something such as parsing through a string without declaring temporary storage. Refer to the discussion on fixed and variable arrays in [Declarations Overview.]

NOTE:  BUFFER_INPUT variables may not be passed to functions in Version 3.00 for the 2-Series Control Systems. If you need to pass a BUFFER_INPUT variable to a function, assign it to a locally declared variable and pass that variable to the function.

MAX_LENGTH may be a value up to 255 in SIMPL+ Version 1.00. SIMPL+ Version 2.00 and later allow for MAX_LENGTH to be up to 65534. For an array of BUFFER_INPUTs, the maximum value of SIZE is 65535. Valid indices are 1 through the specified size.

NOTE: \<min\> is the number of inputs shown at a minimum, in SIMPL the default is 1. The user can expand the minimum up to the full size. Only the last array of a type can have a \<min\>.

NOTE: The [_SKIP_] keyword can be used in DIGITAL_INPUT, DIGITAL_OUTPUT, ANALOG_INPUT, ANALOG_OUTPUT, BUFFER_INPUT, STRING_INPUT and STRING_OUTPUT declarations.

Example:

BUFFER_INPUT FromComPort[100];

Signifies that a 100 character buffer with the name "FromComPort" is specified as a BUFFER_INPUT.

BUFFER_INPUT ComBuffers[2][100];

Signifies that two 100 character buffers have been set up that may be referenced with the names ComBuffers[1] through ComBuffers[2].

BUFFER_INPUT ComBuffers[2,2][100];

Same as above except both are always shown on the symbol.

Version:

X-Generation

SIMPL v1.20.01 and later

SIMPL v1.50.06 and later, allow BUFFER_INPUT arrays and MAX_LENGTH to be 65535.

2 Series:

SIMPL v2.03.18 and later, [Same as X Generation SIMPL v1.50.06, and allow Fixed size arrays and minimum sizes]

  [_SKIP_]: javascript:void(0);
  [Declarations Overview.]: Declarations_Overview.md

Language Constructs & Functions
Declarations
BUFFER INPUT
BUFFER_INPUT


DIGITAL_INPUT

# DIGITAL_INPUT

Name:

DIGITAL_INPUT

Syntax:

DIGITAL_INPUT \<var1\>[,\<var2\>...];

DIGITAL_INPUT \<var[size]\>;

DIGITAL_INPUT \<var[size[,min]]\>;

DIGITAL_INPUT \<var1\>[,[_SKIP_]][,\<var2\>...];

Description:

Routes digital inputs from the outside SIMPL program into a SIMPL+ program under the specified variable names. DIGITAL_INPUT values are either 0 (digital low) or 1 (digital high). Refer to the discussion on fixed and variable arrays in [Declarations Overview.]

NOTE:  DIGITAL_INPUT variables may not be passed to functions in Version 3.00 for the 2-Series Control Systems. If you need to pass a DIGITAL_INPUT variable to a function, assign it to a locally declared variable and pass that variable to the function.

For an array of DIGITAL_INPUTs, the maximum value of SIZE is 65535. Valid indices are 1 through the specified size.

NOTE: \<min\> is the number of inputs shown at a minimum, in SIMPL the default is 1. The user can expand the minimum up to the full size. Only the last array of a type can have a \<min\>.

NOTE: The [_SKIP_] keyword can be used in DIGITAL_INPUT, DIGITAL_OUTPUT, ANALOG_INPUT, ANALOG_OUTPUT, BUFFER_INPUT, STRING_INPUT and STRING_OUTPUT declarations.

Example:

DIGITAL_INPUT osc_in, toggle_in;

Signifies that two digital inputs are coming into the SIMPL+ program from the SIMPL Program.

DIGITAL_INPUT status_bits[8];

Signifies that eight digital inputs are coming into the SIMPL+ program from the SIMPL Program, referenced under the names status_bits[1] through status_bits[8].

DIGITAL_INPUT flags[8,2];

Signifies up to eight digital inputs, with at least two shown.

Version:

SIMPL+ Version 3.01 for fixed arrays and minimum sizes.

SIMPL+ Version 2.00 for DIGITAL_INPUT arrays.

SIMPL+ Version 1.00 for everything else.

  [_SKIP_]: javascript:void(0);
  [Declarations Overview.]: Declarations_Overview.md

Language Constructs & Functions
Declarations
DIGITAL INPUT
DIGITAL_INPUT