DioReadStatusRegister

Applies To

GC5050, GX5050, GX5055, GX5150, GX5280, GX5290, GX5290e, GX5295

Purpose

Reads the status register from the specified board.

Syntax

DioReadStatusRegister (nHandle, lpwData, pnStatus)

Parameters

Name

Type

Comments

nHandle

SHORT

Board handle.

lpwData

PWORD

Returns status register value. See Comments.

pnStatus

PSHORT

Returned status: 0 on success, negative number on failure.

Comments

GC5050, GX5050:

The status register is a 16-bit register (bits 0 – 15) configured as follows:

Bits

15   12

11   10

9

8

7

6     5

4       2

1       0

Mnemonic

BRDID

R

OVF

L

C

DEQ

STATE

TM

Where:

Mnemonic

Comments

BRDID

4 bits (15-12). Board to ID number. The following values are available:

0xA (1010) - GT-50 Master board0xB (1011) - GT-50 Slave board.

0x2 (0010) - GT-25 Master board0x3 (0011) - GT-25 Slave board.

R

Reserved.

OVF

1 bit (9). Address overflow for program counter overflow.

L

1 bit (8). Loop overflow. This bit is set to 1 when a register used by the current command is set to 0.

C

1 bit (7). Condition state. This bit is set to 0 when the current command condition is TRUE.

DEQ

2 bits (6-5). These bits are set to 0 when external event lines ANDed with D mask register are equal to the D event register. Each bit represents 8 lines (byte) where bit 5 is for event lines 0-7 (LSB) and bit 5 is for event lines 8-15 (MSB).

STATE

3 bits (4-2). These bits represent the current board state. The following binary values are available:

000 - HALT The board is in HALT state.

001 - WAIT D Waiting for D level trigger.

010 - WAIT T Waiting for T level trigger.

011 - PAUSE The board is in PAUSE state.

1xx - RUN The board is in RUN state.

TM

2 bits (1-0). These bits represent the current trigger mode. See DioSetupTriggerMode for more information. The following values are available:

00 - Trigger mode is 1 (D).

01 - Trigger mode is 2 (T).

10 - Trigger mode is 3 (D and T).

11 - Trigger mode is 4 (T and D).

GX5055:

The status register is a 16-bit register (bits 0 – 15) configured as follows:

Bits

15  12

11  10

9

8

7

6     5

4    2

1   0

Mnemonic

BRDID

R

OVF

L

C

RFU

STATE

RFU

Where:

Mnemonic

Comments

BRDID

4 bits (15-12). Board to ID number. The following values are available:

0xA (1010) - GT-50 Master board0xB (1011) - GT-50 Slave board.

0x2 (0010) - GT-25 Master board0x3 (0011) - GT-25 Slave board.

R

Reserved.

OVF

1 bit (9). Address overflow for program counter overflow.

L

1 bit (8). Loop overflow. This bit is set to 1 when a register used by the current command is set to 0.

C

1 bit (7). Condition state. This bit is set to 0 when the current command condition is TRUE.

STATE

3 bits (4-2). These bits represent the current board state. The following binary values are available:

000 - HALT The board is in HALT state.

001 - WAIT D Waiting for D level trigger.

010 - WAIT T Waiting for T level trigger.

011 - PAUSE The board is in PAUSE state.

1xx - RUN The board is in RUN state.

GX5150:

The status register is a 16-bit register (bits 0 – 15) configured as follows:

Bits

10

9

8

7

6     

5

4    2

1   0

Mnemonic

Seq

AOF

Chalt

CPuase

RFlag

DEQ

STATE

TM

 

Mnemonic

Comments

SEQ

1 Bit [10]. Sequencer state.

0 Disable

1 Enable

AOF

1 Bit (9). Address Counter Overflow. Read back of ‘1’ indicates an overflow condition.

CHLT

1 Bit (8). HALT Condition. Read back of ‘1’ indicates the vector set the sequencer to HALT state.

CPSE

1 Bit (7). PAUSE Condition. Read back of ‘1’ indicates the vector set the sequencer to PAUSE state.

RFLG

1 Bit (6). Run Flag Indicator. Read back of ‘1’ indicates a RUN mode has occurred since the last read of this register bit. This bit is used in conditions where a short RUN sequence can end before the PC is able to read the real-time ‘RUN’ bit.

DEQ

1 bit (5). This bit is set to 1 when external event lines ANDed with D mask register are equal to the D event register.

STATE

3 bits (4-2). These bits represent the current board state. The following binary values are available:

000 - HALT THE BOARD IS IN HALT STATE.

001 - WAIT D Waiting for D level trigger.

010 - WAIT T Waiting for T level trigger.

011 - PAUSE The board is in PAUSE state.

1xx - RUN The board is in RUN state.

TM

2 bits (1-0). These bits represent the current trigger mode. See DioSetupTriggerMode for more information. The following values are available:

00 - Trigger mode is 1 (D).

01 - Trigger mode is 2 (T).

10 - Trigger mode is 3 (D and T).

11 - Trigger mode is 4 (T and D).

 

GX528X/GX529X/GX529Xe/GX5295:

The status register is a 16-bit register (bits 0 – 15) configured as follows:

Bits

9

8   7

6

5   

4    2

1   0

Mnemonic

AOF

Not Used

RFlag

DEQ

STATE

TM

Where:

Mnemonic

Comments

AOF

1 Bit (9). Address Counter Overflow. Read back of ‘1’ indicates an overflow condition.

RFLG

1 Bit (6). Run Flag Indicator. Read back of ‘1’ indicates a RUN mode has occurred since the last read of this register bit. This bit is used in conditions where a short RUN sequence can end before the PC is able to read the real-time ‘RUN’ bit.

DEQ

1 bit (5). This bit is set to 1 when external event lines ANDed with D mask register are equal to the D event register.

STATE

3 bits (4-2). These bits represent the current board state. The following binary values are available:

000 - HALT THE BOARD IS IN HALT STATE.

001 - WAIT D Waiting for D level trigger.

010 - WAIT T Waiting for T level trigger.

011 - PAUSE The board is in PAUSE state.

1xx - RUN The board is in RUN state.

TM

2 bits (1-0). These bits represent the current trigger mode. See DioSetupTriggerMode for more information. The following values are available:

00 - Trigger mode is 1 (D).

01 - Trigger mode is 2 (T).

10 - Trigger mode is 3 (D and T).

11 - Trigger mode is 4 (T and D).

 

Example

The following example waits until the board is in the HALT state:

 

do

{ DioReadStatusRegister (nMasterHandle, &wData, &nStatus);

} while (wData & 0x1C == 0);  // mask the STATE bits

 

See Also

DioSetupTriggerMode, DioGetTriggerMode, DioTrig, DioArm, DioHalt, DioGetErrorString