EasyManuals Logo

Nidec SM-Applications Series User Manual

Nidec SM-Applications Series
132 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #86 background imageLoading...
Page #86 background image
86 SM-Applications Modules & Motion Processors User Guide
Issue Number: 4
This construct provides a convenient way to test for multiple constant values. Any
number of CASE statements can be included.
MAX_INT, MIN_INT, MIN_FLOAT, MAX_FLOAT
These are special predefined keywords that are recognized by the DPL compiler and
replaced by the appropriate numeric value.
UPPER/LOWER
These functions will take an array as a parameter and will return the upper and lower
array index respectively. For example:
TRUNC
This is used to convert a floating point value to integer, truncating rather than rounding.
For example:
In the two examples shown above some sections are within square brackets ([ and ]).
This section of code within the square brackets is optional.
The CASE statements operate in the same way as programs like Visual Basic in that the
program flow will NOT drop through to the next CASE as it does in the C programming
language.
Table 7-5 Min/Max
Keyword Value
MIN_INT -2147483648
MAX_INT 2147483647
MIN_FLOAT
-3.40282e+038 (single precision model)
-1.79769e+308 (double precision model)
MAX_FLOAT
3.40282e+038 (single precision model)
1.79769e+308 (double precision model)
// Create an array of 1000 elements
DIM Array%[1000]
// now,
l% = LOWER(Array%) // will return the value 0
u% = UPPER(Array%) // will return the value 999.
// get the sum of all values in array%
Total%=0
FOR i% = LOWER(Array%) to UPPER(Array%)
Total% = Total% + Array%[i%] //add array element value to total
LOOP
// Initialise floating point variable
FloatVal = 1.56
Int1% = FloatVal // auto-cast rounds to 2.
Int2% = INT(FloatVal) // explicit cast with INT rounds to 2
Int3% = TRUNC(FloatVal) // explicit cast with TRUNC gives 1
NOTE
NOTE

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Nidec SM-Applications Series and is the answer not in the manual?

Nidec SM-Applications Series Specifications

General IconGeneral
BrandNidec
ModelSM-Applications Series
CategoryControl Unit
LanguageEnglish

Related product manuals