Numeric Formats


Many symbols in SIMPL Windows have parameters, which are constant values that help determine how the symbol will behave. For example, a One-Shot symbol delays an action for a specified period and thus has a parameter determining how long the delay should be. An Analog Initialize symbol initializes an analog signal to a set value and thus has a parameter that specifies the value. The exact function of a parameter depends solely on the symbol type itself.

For convenience, parameters may be expressed in a variety of formats, all of which are directly related to one another. Although a parameter will default to one format based upon the symbol type, you can alter the format by changing the format specifier at the end of the value.

 

To set a parameter to a specific format, add the identifier after the value, e.g., 25%, 5s, or 35d; if the parameter is a single byte, place single quotes before and after the ASCII character, e.g., 'a'. If you do not add a specifier, the parameter will default to the format defined for that symbol. The SIMPL Windows status bar will indicate the default specifier when the parameter is selected.

 

Parameters are constants whose value must be known at compile time. The value of the parameter cannot be changed while the program is running (e.g., a signal cannot adjust the value of a parameter). To change a parameter, you must change it in the program and recompile.

 

Time Formats

 

SIMPL Windows provides two formats for time values: seconds (s) and ticks (t).

 

When specifying time values, keep the following points in mind:

 

 

The allowable range of values expressed in each format is shown in the following table:

 

Format

Single Precision

Double Precision

Seconds

0.00s to 655.35s (2-Series and 3-Series)

-or-

0.00s to 582.53s (X-Series)

(adjustable in 0.01s increments)

0.00s to 42,949,672.95s (2-Series and 3-Series)

-or-

0.00s to 19,088,743.00s (X-Series)

(adjustable in 0.01s increments)

Ticks

0t to 65535t

(adjustable in 1t increments)

0t to 4,294,967,295t

(adjustable in 1t increments)

 

The seconds format can also be used to specify time in the following military formats:

 

HH.MM.SS.HSs

MM.SS.HSs

SS.HSs

SSs

.HSs

 

Where HH = hours; MM = minutes; SS = seconds; and HS = hundredths of a second.

 

For example, the parameter 20.03.05s signifies a time value of 20 minutes, 3 seconds, and 5 hundredths of a second. When using this notation the larger units can be left out if not used; thus "3.00.00s" signifies 3 minutes, 0 seconds, and 0 hundredths of a second (it does NOT signify 3 hours).

 

Therefore, the following formats:

 

2.25.36.08s (HH.MM.SS.HS)

145.36.08s  (MM.SS.HS)

8736.08s    (SS.HS)

 

All represent the same time value.

 

It is not required to pad the values with leading 0's (except for .HSs). Therefore:

 

02.03.04.5s = 2.3.4.5s

 

The leading 0 is only required when specifying hundredths of a second, since .HSs represents a fraction. In the above example, .5s signifies five tenths of a second.

 

The maximum values expressed in each format is shown in the following table:

 

Format

(Max Value) Single Precision

(Max Value) Double Precision

Seconds

2-Series and 3-Series:

SS.HS format: 655.35s

MM.SS.HS format: 10.55.35s

-or-

X-Series:

SS.HS format: 582.53s

MM.SS.HS format: 9.42.53s.

2-Series and 3-Series:

SS.HS format: 42949672.95

MM.SS.HS format: 715827.52.95

HH.MM.SS.HS format: 11930.27.52.95s

-or-

X-Series:

SS.HS format: 19088743.52s

MM.SS.HS format: 318145.43.52s.

HH.MM.SS.HS format: 5302.25.43.52s

 

 

Decimal and Hexadecimal Formats

 

As with time formats, decimal (d) and hexadecimal (h) formats can be used to specify single-precision or double-precision values. Parameters that set the value of an analog signal are single precision. In addition, some parameters allow signed and unsigned values. For further information on how signed values are shown on an analog signal, see the end of this topic.  

 

The allowable range of values expressed in each format is shown in the following table:

 

Format

Single Precision

Double Precision

Decimal

0d to 65535d (unsigned)

-or-

–32768d and +32767d (signed)

0d to 4,294,967,295d (unsigned)

-or-

-2,147,483,648d to +2,147,483,647d (signed)

Hexadecimal

0h to FFFFh (unsigned)

-or-

-8000h to +7FFFh  (signed)

0h to FFFFFFFFh (unsigned)

-or-

-80000000h to +7FFFFFFFh (signed)

 

 

Percent Format

 

The percent (p) format is expressed as a percentage of an analog value (65535d), which is always single precision. In addition, a negative sign can be used before the percent value. For further information on how signed values are shown on an analog signal, see the end of this topic.  

 

The maximum precision for the percent format in all Crestron control systems is 0.001%.

 

The allowable range of values expressed in the percent format is shown in the following table:

 

Format

Single Precision

Percent

0.000% to 100.000% of 65535 (unsigned)

-or-

-49.999% to 50.000% (signed)

(adjustable in 0.001% increments)

 

 

Bytes

 

A byte is expressed as a single, printable ASCII character enclosed in single quotes, e.g., 'a'. The parameter value is the ASCII value of the character—see ASCII Conversion.

 

For example:

 

'Y' = 89d = 0059h

 

'1' = 49d = 0031h

 

'2' = 50d = 0032h

 

Using a negative sign before the byte is not legal and will generate an error.

 

The allowable range of values expressed in the byte format is shown in the following table:

 

Format

Range

Byte

Printable ASCII characters:

' ' (space, ASCII 20h) to '~' (tilde, ASCII 7Eh)

 

Negative Analog Values

 

A negative sign can be used before the decimal, hexadecimal and percent formats.

 

A negative number is represented in twos complement form. However, when the parameter sets the value of an analog signal, an easy way to determine the value the signal will show is to subtract the absolute value of the parameter from 65536d:

 

65536d – abs(Parameter) = <Analog Value>

 

Thus a parameter of -25d would result in:

 

65536d – abs(-25d) = 65511d

 

Some symbols explicitly treat the numbers on an analog signal as signed, such as the Analog Scaler with IO Limits with <Format> = 1d.

 

Some symbols explicitly treat the numbers on an analog signal as unsigned, such as the Analog Comparison (Full Set).

 

Some symbols do not care, such as the Analog Sum. For example, if you add +30d and –25d, the result is 5d, as follows:

 

65536d – abs(-25d) = 65511d

 

65511d + 30d = 65541d (10005h)

 

Since analogs carry 16 bits of information in SIMPL, the result uses only the lower 16 bits of 10005h, or 5d.

 

With a parameter that consists of a negative hexadecimal number, first convert the value to decimal format and then apply the above formula.

 

For example, consider -19h:

 

-19h = -25d

 

65536 – abs(-25d) = 65511d

 

With a parameter that consists of a negative percentage, first convert the percentage to decimal format and then apply the above formula.

 

For example, consider –25%:

 

25% is 25% of 65536d, or 16384d
 

–16384d is 49152d (65536d - 16384d = 49152d)
 

49152d is also the same as 75%