Mitsubishi Electronics FX1S manual Floating Point Format

Page 119

FX Series Programmable Controllers

Devices in Detail 4

4.15.2Floating Point Format

Floating point format extends the abilities and ranges provided by Scientific Notation with the ability to represent fractional portions of whole numbers, for example;

Performing and displaying the calculation of 22 divided by 7 would yield the following results:

a)Normal FX operation using decimal (integers) numbers would equal 3 remainder 1

b)In floating point it would equal 3.14285 (approximately)

c)In Scientific format this calculation would be equal to 3142 10 -3

So it can be seen that a greater degree of accuracy is provided by floating point numbers, i.e. through the use of larger numerical ranges and the availability of more calculable digits. Hence, calculations using floating point data have some significant advantages. Decimal data can be converted in to floating point by using the FLT, float instruction (FNC 49). When this same instruction is used with the float fag M8023 set ON, floating point numbers can be converted back to decimal. see page 5-49 for more details.

The following points should be remembered about the use of Floating Point within appropriate FX units;

Floating point numbers, no matter what numerical value, will always occupy two consecu- tive data registers (or 32 bits).

Floating point values cannot be directly monitored, as they are stored in a special format recommended by the I.E.E.E (Institute of Electrical and Electronic Engineers) for personal and micro computer applications.

Floating point numbers have both mantissa and exponents (see Scientific Notation for an explanation of these terms). In the case of floating point exponents, only 8 bits are used.

Additionally there is a single sign bit for the mantissa. The remaining bits of the 32 bit value, i.e. 23 bits, are used to ‘describe’ the mantissa value.

 

 

FX Data Register Contruction

 

 

 

Data register ’D+1’

 

Data register ’D’

 

b15

 

(16 bits)

b0 b15

(16 bits)

b0

 

Exponet

Mantissa

 

 

(8 bits)

(23 bits)

 

Sign bit

Floating Point Format

 

 

 

 

Valid ranges for floating point numbers as used in FX Main Processing Units:

 

 

 

 

 

 

 

 

Description

Sign

Exponent

Mantissa

Remark

 

 

(bit pattern)

(bit pattern)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

11111111111111111111111

Largest number +/- 3.403 1038

 

 

 

0 or 1

11111110

11111111111111111111110

 

 

Normal Float

Accuracy: 7 significant figures

 

 

00000001

00000000000000000000001

 

 

 

 

Smallest number +/- 1.175 10-38

 

 

 

 

 

00000000000000000000000

 

 

 

 

 

 

 

 

 

Zero

0 or 1

00000000

00000000000000000000000

All digits are 0 (zero)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

4-45

Image 119
Contents Programming Manual Page Foreword FX Series Programmable ControllersFX Series Programmable Controllers FAX Back Combined Programming Manual J FX Series Programmable Controllers Software Warnings Hardware WarningsFX Series Programmable Controllers Contents STL Programming Applied Instructions Rotation And Shift Functions 30 to External FX Serial Devices Functions 80 to Execution Times And Instructional 10-1 Viii FX Series Programmable Controllers Chapter Contents Overview IntroductionWhat do You Need to Program a PLC? What is a Programmable Controller?Current Generation CPU all versions Special considerations for programming equipmentManual name Number FX Base Unit Hardware Assocciated ManualsManual name Number FX DU, GOT and DM units Memo Basic Program Instructions FX Series Programmable ControllersBasic Program Instructions Detailed device information What is a Program?Outline of Basic Devices Used in Programming Example How to Read Ladder LogicProgram example Load, Load InverseOUT instruction Out Timer and Counter VariationsDouble Coil Designation Use of dual coilsLast coil effect Peripheral limitations And, And InverseORI Or, Or InverseSingle Operation flags M2800 to M3071 Load Pulse, Load Trailing PulseLDF ANF OUT Pulse, And Trailing PulseORF ORB Or Pulse, Or Trailing PulseSequential processing limitations Or BlockBatch processing limitations ANB BlockMPS, MRD and MPP usage 13 MPS, MRD and MPPMultiple program examples MCR Master Control and ResetNested MC program example Resetting timers and counters Set and Reset16.1Basic Timers, Retentive Timers And Counters Timer, Counter Out & ResetRetentive timers High Speed Counters Bit countersAvailability of devices Normal 32 bit CountersLeading and Trailing Pulse PLFUsages for INV InverseNo Operation No OperationProgram scan 20 EndMemo STL Programming FX Series Programmable ControllersSTL Programming General note What is STL, SFC And IEC1131 Part 3?Look Inside an STL How STL OperatesEach step is a program Activating new states How To Start And End An STL ProgramCombined SFC Ladder representation Embedded STL programsReturning to Standard Ladder Initial StepsTerminating an STL Program Moving Between STL Steps Using SET to drive an STL coilOut is used for distant jumps Using OUT to drive an STL coilOUT is used for loops and jumps Basic Notes On The Behavior Of STL programs Rules and Techniques For STL programsT001 K20 K50 Method 2 Special Single Pulse Flags Single Signal Step ControlMethod 1 Using locking devices Restrictions on using applied instructions Restrictions Of Some Instructions When Used With STLUsing ‘jump’ operations with STL STL OUT SET Using STL To Select The Most Appropriate ProgramLimits on the number of branches Using STL To Activate Multiple Flows SimultaneouslyLimits on the number of branches Instruction Format General Rules For Successful STL BranchingGeneral Precautions When Using The FX-PCS/AT-EE Software Simple STL Flow Programming ExamplesSET STL Identification of normally closed contactsSelective Branch/ First State Merge Example Program Points to noteFull STL flow diagram/program Advanced STL Use Devices in Detail FX Series Programmable ControllersDevices in Detail Device Mnemonic Configuration detailsInputs Available devicesAlias O/P OutputsDevice Mnemonic Y General Stable State Auxiliary Relays Auxiliary RelaysDevice Mnemonic M External loads Battery Backed/ Latched Auxiliary RelaysSpecial Single Operation Pulse Relays Special Diagnostic Auxiliary RelaysGeneral Stable State State Relays State RelaysDevice Mnemonic S PLC FX 1S FX 1N FX 2N Battery Backed/ Latched State RelaysIST instruction Assigned statesMonitoring STL programs STL/SFC programmingAnnunciator Flags Device Mnemonic P PointersJumping to the end of the program Device availabilityPointer position Interrupt PointersAdditional applied instructions Nested levelsInput Interrupts Timer InterruptsRules of use Disabling Individual Interrupts Driving special auxiliary relaysDisabling high speed counter interrupts Additional notesExample device usage N/A Constant KConstant H Device Mnemonic KDevice Mnemonic T TimersTimer accuracy Driving special auxiliary coils General timer operationSelectable Timers Retentive Timers Using timers in interrupt or ‘CALL’ subroutinesCondition Internal timer accuracyTimers Used in Interrupt and ‘CALL’ Subroutines Timer AccuracyDevice Mnemonic C Setting ranges for countersCounters High speed countersGeneral/ Latched 16bit UP Counters Battery backed/latched countersGeneral/ Latched 32bit Bi-directional Counters Battery backed/ latched countersSelecting the counting direction Further uses None Basic high speed counter operationBasic High Speed Counter Operation Driving high speed counter coilsAvailability of High Speed Counters Input assignmentCounter Speeds Calculating the maximum combined counting speed on FX1S Using the SPD instruction Device specificationSetting range Direction settingRST Device size 11.5 2 Phase Bi-directional Counters C246 to C25011.6 A/B Phase Counters C252 to C255 Example device usage None Data RegistersDevice Mnemonic D General Use Registers Data register updatesData retention Special Diagnostic Registers Using the FX2-40AW/APUse of diagnostic registers Battery Backed/ Latched RegistersProgram memory registers Special caution when using FX1SWriting to file registers File RegistersUses Externally Adjusted RegistersAvailable forms Index RegistersUse of Modifiers with Applied Instruction Parameters Device Mnemonic V,ZMisuse of the Modifiers Using Multiple Index RegistersModifying a Constant Bit Devices, Individual and Grouped Bits, Words, BCD and HexadecimalAssigning grouped bit devices Moving grouped bit devicesAssigning I/O Interpreting Word Data Word DevicesFX Series Programmable Controllers Word Data Summary Binary Coded Decimal value= ErrorInverted7 Additional1 14.4 Two’s ComplimentSome useful constants Floating Point And Scientific NotationScientific Notation Floating Point Format FLT