LAB #4
VHDL Counter/ Divider
In this Lab we will synthesize a simple circuit which will take the output of the X84 boards 555 timer circuit and using a counter, will divide down the clock by rates which will be programmable via the on board 8255 programmable latchs. We will use an eight bit value (0-255) as the programmable divider range.
The APS-X84 has an on board 555 timer circuit which is made up of U6,R6,R4,C1,C18, and JP7. The function of JP7 is discussed in section 2.1 of the User's Guide and needs to be on. U6 is a 555 timer chip. The R4, R6 and C18 values of 51K,22K & .01uf are used to set the time constant of the oscillator using the equation shown below:
Charge Time= T1= 1.386*(R1C1)= 1.386*(51000*.00000001)=.00070686 secs
Frequency = 1/cycle time = 1/.00070686=1414=1.414Khz
This timer circuit can be used as a slow timer. Coupled with relatively small counter/dividers it can be used to give approximate timing for such things as blinking LEDs, delays and waits which might be in seconds. If we want to use a relatively fast oscillator in our circuit it would take a large divider to get pulse in the seconds range.
Since the TIMER circuit puts out a 1.414Khz rate that means that our clock changes states at 1,414 times per second. This is to fast to see if we sent it directly to the X84 Utility LED. We could divide down the LED with our 8 bit value from our 8255 output pins (input pins to FPGA) which will set up the terminal count of a VHDL counter we could create which will look something like this: l
library IEEE;
use IEEE.std_logic_1164.all; library METAMOR;
library SYNOPSYS;
library PN_PAK;
ENTITY X84DEMO IS PORT
attribute pinnum of DivCntIn : signal is "P10,P9,P8,P7,P6,P5,P4,P3";
SIGNAL Count: INTEGER RANGE 0 TO 255; BEGIN DIVIDER: PROCESS
Count <= Count +1; -- increment counter IF Count >= slvect2int(DivCntIn)
THEN
END behave; |
library IEEE;
use IEEE.std_logic_1164.all; library METAMOR;
library SYNOPSYS;
library PN_PAK;
ENTITY X84DEMO IS PORT
attribute pinnum of DivCntIn : signal is "P10,P9,P8,P7,P6,P5,P4,P3";
SIGNAL Count: INTEGER RANGE 0 TO 255;
-- Divide input by Multiplier times the DivCntIn value
BEGIN DIVIDER: PROCESS
IF Count >= slvect2int(DivCntIn) THEN
END behave; |
1) Open the X84Lab4 project in the Foundation Software projects.
2) Insure the project has been properly synthesized and routed.
3) Insure the X84Lab4.rbt file from the latest route version is stored in the X84Lab4C directory where the X84Lab4.exe file is located.
4) Execute the X84Lab4.exe program and you should see the following screen:
By typing in different values you will be able to make the LED blink at different rates.