| « 3. Program Generator | A.2.1 Revision Notes » |
3.2.1 Typed Data Variables
3.2 VariablesThe ChartWriter™ programming utility uses Typed data variables, which means that all variables must first be declared before they can be used. This involves assigning the variable's name and data type in the Global script variables table. Local variables are data typed using a symbol ($, #, !, %) as the 1st character in the local variable's name.
A variable's data type determines the values it may contain, plus the operations that may be performed on it. The five data types supported by the ChartWriter™ programming utility are:
- byte: 8 bits ($)
- Unsigned 0 to 255
The byte data type is an 8-bit signed two's complement integer. The byte data type is useful for saving memory and as a substitute for the boolean data type which has only two possible values: 1 or 0
- A "1" can represent ... true/open/enabled/active/on/up etc.
- A "0" can represent ... false/closed/disabled/inactive/off/down etc.
-------------------------------------------------------------------------------------
- int: 16 bits (#)
- Signed -32,768 to +32,768
The int data type is a 16-bit signed two's complement integer.
-------------------------------------------------------------------------------------
- long: 32 bits (!)
- Signed -2,147,483,648 to +2,147,483,647
The long data type is a 32-bit signed two's complement integer.
-------------------------------------------------------------------------------------
- time: 32 bits (!)
- Signed 0 to 2,147,483,647 seconds
- 596,523 HRS, 14 MIN, 7 SEC
The time data type is a long integer representing HRS:MIN:SEC in a seconds format. Although time is displayed in the HRS:MIN:SEC format, all calculations are performed using the seconds eqivalent as a long integer.
Useful time conversions:
- 31,557,600 seconds/year
- 2,629,800 seconds/month (avg)
- 604,800 seconds/week
- 86,400 seconds/day
- 3,600 seconds/hour
- 60 seconds/minute
-----------------------------------------------------------------------------------
- float: 32 bits (%)
- Signed -1.0E(-126) to +1.0E(+127)
- 1 bit Sign, 8 bits Exponent, 23 bits Precision
The float data type is a single-precision 32-bit floating point number.
Recent comments