Buttons and LEDs are fine but it really doesn't come close to interfacing with real hardware. So now to take the human element out of the equation and time to use a clock.
For this experiment I am using a 1 Mhz crystal oscillator. It doesn't sound very fast but the untrained human eye can only really see somewhere less than 100Hz (see various debates on this on the internet).
This isn't a step by step, but I've given you big hints on how to avoid the big issues.
Happy learning!
The BOM
For this experiment I will be using the following items:
- 1 x CPLD Dev board
- 1 x LED array ( as seen previously, or you can just use 1 LED and a resistor )
- 2 x 4017 decade counters
- 1 x 1 Mhz crystal oscillator, any 5 volt, 1Mhz 4pin crystal oscillator will do.
- 1 x 01.uF capacitor
- Lots of Jumper wires
- LA2016 Logic Analyzer ( or any logic analyzer that can handle 5v ) (optional bonus content)
Failing and learning ( get a Logic Analyzer )
The one thing I learnt early on when constructing this experiment was that I simply could not get the clock division down to a low enough level to see the result. What I really needed was a Logic Analyzer so I could actually see what was going on. I went over and over the code trying to work out what was wrong with it and . . . there was nothing wrong. I just didn't have the right instruments to tell me I was ok.
If you are going to continue your journey with CPLD's and FPGA's you are going to need one. Go buy it now or you will just be frustrated.
Failing and learning part 2 (tie down all of the control input pins on the 4017)
Failing and learning part 3 (assign ALL pins on the CPLD)
Example code
Why are you using 4017 decade counters?
Wiring up the board and Logic Analyzer output
- This signal is the clock itself at 1MHz.
- This is the output of the first CPLD counter at 3.90KHz
- This is the output of the second CPLD counter at 49.90Hz
- This is the output of the third CPLD counter at around 0.06Hz +/- a bit
Plugging the second CPLD output into the 4017's makes the LED flash a around once every 3 seconds.
And here is the finished product.
No comments:
Post a Comment