.

Counter

Overview

Overview

Description

The Counter block counts up or down when the input transitions from 0 to 1 (non-zero). The Up/Down input determines whether the counter increments (Up/Down = 0) or decrements (Up/Down non-zero) at the transition. A non-zero value at the Clear input holds the counter at zero.

Example

The following example demonstrates how to use the Counter Block and take the output to turn on Digital IO based on the Counter output.

The Counter is activated by a Digital In state. On every Low – High transition (0-1) the counter’s output increments by one. If the Up/Down input is Zero, it is in the Positive direction. If Up/Down is non-zero, it decrements (negative increment). If the Clear input goes high, the Counter is reset to zero. In this example, Node 1’s Digital Input Bit 3 activates the Clear operation.


The configuration values for this block are as follows:

 

Evaluate Block

This block allows you to specify whether the block executes Every Sample, Every Other Sample (Odd or Even), or Every Fourth Sample (and specify the First, Second, Third, or Fourth). This provides greater flexibility in controlling the execution of a model and to preserve performance for other areas of motion control.

User Defined Block Priority When selected, allows you to enter a Priority Code to modify Execution Ordering of this block. For more information, see Block Execution Order and User Defined Block Priority.
Priority For an explanation of how the Priority field is used by the MechaWare Model Downloader, see Block Execution Order and User Defined Block Priority.
User Data 0 Application-specific data. See User Data Storage.
User Data 1 Application-specific data. See User Data Storage.

Matlab/Simulink

Simulink Interface

The Counter block counts up or down when the input transitions from 0 to 1 (non-zero). The Up/Down input determines whether the counter increments (Up/Down = 0) or decrements (Up/Down non-zero) at the transition. A non-zero value at the Clear input holds the counter at zero.

The block has two user data fields (User Data 0, User Data 1) to store application-specific data for convenient storage and retrieval. For more information, see User Data Storage.

The block's update schedule is determined by the Evaluate Block. The following Parameter Dialog Box can be opened by double-clicking on the block in a Simulink model:

 

C++ API

COUNTERBlock

Declaration

Public Method

 
class COUNTERBlock: public virtual Block
{
public:
	// User accessible coefficients
};
 

Required Header: mechaware.h

Description

The Counter block counts up or down when the input transitions from 0 to 1 (non-zero).

Methods

Block Methods

 

       Legal Notice  |  Tech Email  |  Feedback
      
Copyright ©
2001-2012 Motion Engineering