Status
⑥ Counter Input [cnt_status.vi]

 

Select to check the status of counter input

Only CntStatus is available for digital device counter input

 


IN/OUT Terminal layout

 


Input terminal

CntChannel

Initial value 0

Specify the channel number for checking counter input status

  

Output terminal

CountMatch

Acquire count coincidence status with two element cluster

■ Element 1: count

  Returns the notification status of the count match event set in
  "Counter input (cnt_event.vi)" in the event setting

  Once executing this VI with this Boolean value being True, it will be False
  until a count match event occurs again

  * If no count match event has been set, no notification will be made, so it will always be False

  * When CPSN-CNT-3201I is used in combination with CPSN-MCB271-xxx, no notification is given and it is always False.

■ Element 2: times

  Returns the total number of notifications

  

CarryBorrow

Get the carry/borrow status in a 6 element cluster

■ Element 1: carry

  Returns the notification status as to whether or not carry has occurred
  Once this Boolean value is True and this VI is executed once, it will be False until a carry occurs again

■ Element 2: carry_times

  Returns the number of notifications of carry 

■ Element 3: borrow

  Returns the notification status as to whether borrow occurred
  Once this Boolean value is True and this VI is executed once, it will be False until a borrow occurs again

■ Element 4: borrow_times

  Return borrow notification count

■ Element 5: carry_borrow

  Notified when carry and borrow are detected at the same time
  Once this Boolean value is True and this VI is executed once, it will be False until simultaneous detection again

■ Element 6: carry_borrow_times

  Returns the number of times that carry and borrow were detected at the same time 

  * The counter counting up from the maximum value (FFFFFFH or FFFFFFFFH) to 0H is called carry,
   down counting from 0H to the maximum value (FFFFFFH or FFFFFFFFH) is called borrow

  * It can be used only with counter devices with sampling function.
   In addition, this function is valid only when the Channel Setting is set with Counter Input (BUS Master).

   (It cannot be used when the Channel Setting is set with Counter Input.)

  

CntStatus

Get counter input status

The return value depends on the target device

- In the case of type with sampling function counter devices. It has the following meaning in hexadecimal notation bit unit

Value

Status

Meaning

When it is 0

When it is 1

1H

A-Phase input

Low

High

2H

B-Phase input

Low

High

4H

Z-Phase input

Low(Positive logic)

High(Negative logic)

High(Positive logic)

Low(Negative logic)

8H

General purpose input

Low

High

10H

Count direction

Up count

Down count

20H

Carry

Undetected

Detected

40H

Borrow

Undetected

Detected

80H

Count match 0

Not matched

Matched

100H

Count match 1

Not matched

Matched

  Example) When the CntStatus is "9H" (even in decimal number "9") in the type with sampling function device,
     "A-Phase input" is High and "General purpose input" is High, Other status is the status of the "When it is 0" in the table above

- For counter devices other than type with sampling function. It has the following meaning in hexadecimal notation bit unit

Value

Status

Meaning

When it is 0

When it is 1

1H

A-Phase input

0 detected

1 detected

2H

B-Phase input

0 detected

1 detected

4H

Z-Phase input

0 detected

1 detected

8H

General purpose input

0 detected

1 detected

10H

Count direction

Up count

Down count

20H

Not used

-

-

40H

Not used

-

-

80H

Count match

Not matched

Matched

100H

Not used

-

-

  Example) When CntStatus is "81H" ("129" in decimal) on a device other than the type with sampling function
    "A-Phase input" is 1 and "count match" is matched, Other status is the status of the "when it it 0" in the table above

- For digital device counter input (CPSN-DI-16BCL)

  It has the following meaning in hexadecimal notation bit unit

Value

Status

Meaning

When it is 0

When it is 1

1H

Comparison match

Not matched

Matched*

2H

Carry

Carry undetected

Carry detected*

3H -

Not used

-

-

- For digital device counter input (DIO-0404LY-WQ)

  It has the following meaning in hexadecimal notation bit unit

Value

Status

Meaning

When it is 0

When it is 1

1H

Not used

-

-

2H

Carry

Carry undetected

Carry detected*

4H

Counter operating status

Stopped

Operating

5H -

Not used

-

-

* These statuses are read clear, so if the condition is met, the value (1) will be retained,
     and the value will return to 0 when this VI is executed once.

  Example) In DIO-0404LY-WQ, when CntStatus is "6H" ("6" in decimal number), "Carry is detected" and "Counter is operating".
     Also, Carry is a read clear, so if you run this VI again,  the CntStatus will be "4H" ("4" in decimal).

* The counter counting up from the maximum value (FFFFFFH or FFFFFFFFH) to 0H is called carry, down counting from 0H to the maximum value (FFFFFFH or FFFFFFFFH) is called borrow

 

CounterError

Get error of counter input with 3 element cluster

■ Element 1: AI_error

  In the 2-phase input setting, when the A phase and the B phase change simultaneously, this Boolean value becomes True

■ Element 2: FLT_error

  When a signal (A phase, B phase) which is higher than digital filter setting time is input, this Boolean value becomes True.

■ Element 3: ALM_error

  This Boolean value will be True if disconnection is detected when using differential input
  It is effective only when setting the terminating resistance ON