beautypg.com

Pm designer operation manual – B&B Electronics WOP-2121V-N4AE - Manual User Manual

Page 429

background image

14

PM Designer Operation Manual

14-20

CHAPTER 14 USING MACROS

X2A

Format

P1

= X2A(P2)

Data Type

U

Function

Converts 16-bit number P2 to a 4-digit hex number in ASCII character form and saves the result
in word array P1. The character of the fourth digit is saved in the first word of P1 and the
characters of the other digits are saved in the following words in sequence.

P1 (I)

The location (or the word array) to save the result.

P2 (I/C)

The number to be converted.

Example 1

$U10

= X2A(

0x34AB

)

/*The 4 words starting from $U10 will be: 51('3'), 52('4'), 65('A'), 66('B') */

W2F

Format

P1

= W2F(P2)

Data Type

U/S

Function

Converts 16-bit number P2 to a floating point number and saves the result in P1.

P1 (I/E)

The location to save the result.

P2 (I/E/C)

The 16-bit number to be converted.

Example 1

$U200

= W2F(

$U10

) (S)

D2F

Format

P1

= D2F(P2)

Data Type

UD/SD

Function

Converts 32-bit number P2 to a floating point number and saves the result in P1.

P1 (I/E)

The location to save the result.

P2 (I/E/C)

The 32-bit number to be converted.

Example 1

$U200

= D2F(

$U10

) (SD)

F2W

Format

P1

= F2W(P2)

Data Type

F

Function

Converts floating point number P2 to a 16-bit number and saves the result in P1.

P1 (I/E)

The location to save the result.

P2 (I/E/C)

The floating point number to be converted.

Example 1

$U200

= F2W(

$U10

) (F)

F2D

Format

P1

= F2D(P2)

Data Type

F

Function

Converts floating point number P2 to a 32-bit number and saves the result in P1.

P1 (I/E)

The location to save the result.

P2 (I/E/C)

The floating point number to be converted.

Example 1

$U200

= F2D(

$U10

) (F)