beautypg.com

Sample program, 2 instructions, Converting to ascii text in decimal notation – Omron SYSMAC CP CP1E-N@@D@-@ User Manual

Page 283

background image

2-247

2 Instructions

CP1E CPU Unit Instructions Reference Manual(W483)

F
loat
ing
-p
o

int
Math

In

stru

ctio

ns

2

FSTR

Limits on the Number of Digits in the Integer Part

1) Decimal Notation (C = 0 hex)

When there is no fractional part (C+2 = 0 hex):

1

≤ Number of Integer Digits ≤ 24-1

When there is a fractional part (C+2 = 1 to 7 hex):

1

≤ Number of Integer Digits ≤ (24 - Fractional digits - 2)

2) Scientific Notation (C = 1 hex)
1 digit (fixed)

Limits on the Number of Digits in the Fractional Part

1) Decimal Notation (C = 0 hex)

Fractional Digits

≤ 7

Also: Fractional Digits

≤ (Total Number of ASCII Characters - 3)

2) Scientific Notation (C =1 hex)

Fractional Digits

≤ 7

Also: Fractional Digits

≤ (Total Number of ASCII Characters - 7)

Sample program

Converting to ASCII Text in Decimal Notation

When CIO 0.00 is ON in the following example, FSTR(448) converts the floating-point data in D1 and
D0 to decimal-notation ASCII text and writes the ASCII text to the destination words beginning with
D100. The contents of the control words (D10 to D12) specify the details on the data format (decimal
notation, 7 characters total, 3 fractional digits).

20(Space)

2E(.)

32(2)

00

1 0 1 0 1 0 0 0 0 1 1 1 0 0 1 0
0 0 1 1 1 1 1 0 1 0 1 0 0 1 1 1

0.00

15

0

D0

D1

0(Hex)
7(Hex)
3(Hex)

D10

D11

D12

0.327457

20(Space)

30(0)
33(3)
37(7)

D100
D101
D102
D103

0 . 3 2 7 4 5 7

FSTR

D0

D10

D100

Conversion

Storage
conditions

Decimal notation
Total characters = 7 characters
Fractional digits = 3 digits (characters)

Total number of characters

Rounded off

Spaces

Fractional part

This manual is related to the following products: