COUNTER

by Nathaniel LG in Circuits > Computers

229 Views, 1 Favorites, 0 Comments

COUNTER

unknvown.png

The counter is a digital device that is used to count a number of pulses and it can also be used for a frequency divider.

The counter can count in two ways:

1. Count up (1,2,3...,n)

2. Count down (n,n-1.n-2,....,1,0)

Supplies

We recommend to code with ISE Design Suite 14.7 as it can also be used to test the code in VHDL. However, to upload the code into BASYS 3, you will need to install Vivado (ver. 2015.4 or 2016.4) and write the constraint file with .xdc extension.

Signal Input and Output

INPUT

1. COUNT_UP_Left: in STD_LOGIC; (This is for C_OUT_Left)

2. COUNT_DWN_Left: in STD_LOGIC; (This is for C_OUT_Left)

3. COUNT_UP_Right: in STD_LOGIC; (This is for C_OUT_Right)

4. COUNT_DWN_Right: in STD_LOGIC; (This is for C_OUT_Right)

5. RST: in STD_LOGIC; (used to reset the system)

6. CLK: in STD_LOGIC; (This is for timing)

INTERNAL SIGNAL

1. countinLeft: STD_LOGIC_VECTOR (7 downto 0); (This is for C_OUT_Left)

2. countinRight: STD_LOGIC_VECTOR (7 downto 0); (This is for C_OUT_Right)

OUTPUT

1. C_OUT_Left: out STD_LOGIC_VECTOR (7 downto 0); (This is for output C_OUT_Left)

2. C_OUT_Right : out STD_LOGIC_VECTOR (7 downto 0)); (This is for output C_OUT_Right)

How It Works

In this part of the code, we made a sequential circuit that has the function to count up or count down the value of binary that is sent passing through the system. We make it this way because we want to make a counting timing device that will activate according to the limit of count that is determined from the user input. The upper limit of the count is user programmable and the counter’s increment value can be user-defined. The signal is then sent to the Shift Register. In the code that we have built, we use an internal signal for the value of the count named countin, we also have count_up and count_dwn to increase or decrease the value of the counting by 1 so we can make the counter count up or count down depending on the circumstance that we need it. We also made a reset setting to reset the value of the countin just in case we need to reset the system.

Click HERE for the code sample