Full Library / Math Operator / Counter / Counter_Basic
Block Name: Counter_Basic
Code File Location: VisualSim/actor/lib/Counter_Basic
Block Overview
- This block is a counter that is incremented or decremented based on the input value. The outputs are determined by the parameter settings.
-
- This block has four input ports. The incr_add_input port increments, or adds integer values to the counter state. The decr_sub_input port decrements, or subtracts integer values from the counter state. The reset_set_input port resets, or sets a new counter state. The test_input port always generates a value on the counter_output port.
-
- The equals_output generates an integer if the counter state equals the parameter 'Equals_Count".
-
- The increment, decrement, reset functions are controlled by the "Input_Port_Mode". The "Input_Port_Mode" can be "Increment" which is equivalent to "Increment_Decrement by a value of 1", the default setting, or can be value of "ADD" which is equivalent to "Add_Subtract the value in the appropriate input port".
-
- The "Counter_Mode" can keep count without a reset ("Ignore_Final_Count"), or in circular fashion ("Final_Count_to_Initial_Count").
-
- The output can generate counts on each change of the internal state ("Normal_Counter_Update"), or only generate output tokens to the counter_output with the "Output_Mode" setting "Via_Test_Port."
incr_add_input
public TypedIOPort incr_add_input
- Increment, or Add, input port for data tokens, depending on Input_Port_Mode setting: Increment, or Add.
decr_sub_input
public TypedIOPort decr_sub_input
- Decrement, or Subtract, input port for data tokens, depending on Input_Port_Mode setting: Increment (Decrement), or Add (Subtract).
reset_set_input
public TypedIOPort reset_set_input
- Reset counter to Initial_Count, or Set counter to input value, input port for data tokens, depending on Input_Port_Mode setting: Increment (Reset), or Add (Set).
test_input
public TypedIOPort test_input
- Test input port, always outputs counter state on counter_output.
counter_output
public TypedIOPort counter_output
- Counter output port outputs counter state for the test input port triggered, or on each internal state change, when Output_Port_Mode == "Normal_Counter_Update."
equals_output
public TypedIOPort equals_output
- Equals output port always generates an output if counter state equals parameter "Equals_Count."
Initial_Count
public Parameter Initial_Count
- Parameter, initial counter state.
Final_Count
public Parameter Final_Count
- Parameter, final counter state, only valid if Counter_Mode setting: Final_Count_to_Initial_Count. Creates a circular counter, such as 123456781234567, where 8 = final count.
Equals_Count
public Parameter Equals_Count
- Parameter, equals counter state, determines when equals_output is triggered. Type equals setting of Initial_Count.
Input_Port_Mode
public StringAttribute Input_Port_Mode
- The relative input mode operator. This is a string-valued attribute that defaults to "Increment_Decrement_Reset". This mode increments, decrements, and resets input values to the appropriate input port. The other mode is ADD_SUBTRACT_SET.
Output_Port_Mode
public StringAttribute Output_Port_Mode
- The relative output mode operator. This is a string-valued attribute that defaults to "Normal_Counter_Update". This mode generates a counter_output for each state change of the counter.
Counter_Mode
public StringAttribute Counter_Mode
- The relative counter mode operator. This is a string-valued attribute that defaults to "Ignore_Final_Count". This mode increments, or decrements, in normal fashion. In the "Final_Count_to_Inital_Count"
Created with the Personal Edition of HelpNDoc: Free EBook and documentation generator