National Instruments AutoCode NI MATRIX User Manual

Page 46

Advertising
background image

Chapter 2

C Language Reference

© National Instruments Corporation

2-29

AutoCode Reference

A typical fixed-point type looks like the following:

RT_USHORT06

where USHORT stands for unsigned short, and 06 indicates the radix
position.

Fixed-point variables that are always positive in nature can be declared as
unsigned. This has the advantage of providing one more bit of accuracy
than with signed fixed-point variables, because the most significant bit is
used for storing the sign in that data type.

Example 2-2 shows some of the I/O type declarations. Only the significant
parts of the code are shown.

Example 2-2

Fixed-Point C I/O Type Declarations

struct _Subsys_1_out {

RT_SSHORT13 SS13;

RT_SSHORT15 SS15;

RT_SSHORT15 SS15_1;

RT_USHORT14 US14;

RT_USHORT10 US10;

RT_SSHORT13 SS13_1;

RT_SSHORT12 SS12;

RT_SSHORT08 SS8;

short

16

unsigned

RT_USHORT

(radix 00)

RT_USHORTxx (xx = radix 48
to –16)

signed

RT_SSHORT

(radix 00)

RT_SSHORTxx (xx = radix 48
to –16)

long

32

unsigned

RT_ULONG

(radix 00)

RT_ULONGxx (xx = radix 48 to –16)

signed

RT_SLONG

(radix 00)

RT_SLONGxx (xx = radix 48 to –16)

Table 2-6. AutoCode/C Data Types (Continued)

Data
Type

Number

of Bits

Signed or

Unsigned

Data Type Name

Advertising