CPLD intro 3: Inverse LED toggle
From DP
Contents |
Overview
In tutorial 3 we build on the simple push button example in tutorial 2. We'll add logic that inverts the output of button 1 on LED D2.
Button PB | LED D1 | LED D2 |
---|---|---|
Pressed | OFF | ON |
NOT pressed | ON | OFF |
Schematic
In this demo we'll use both LEDs and the push button connected to the CPLD.
IO | pin connection |
---|---|
LED D1 | P39 |
LED D2 | P38 |
Button BP | P18 |
The XC2C64A CPLD has internal pullup resistors R1 is unpopulated on the XC2C64A development board
XC9572A
This designs adds a second LED and connects it to the push button through an inverter.
- Input from BUTTON enters the CPLD through an input buffer (IBUF)
- The BUTTON signal connects to LED (D1) through an output buffer (OBUF) as before
- INV is a new schematic element that inverts the BUTTON signal before it connects to a second output buffer (OBUF) and LED_INV (D2)
XC2C64A
The XC2C64A version is the same, except we use the internal pull-up resistor instead of R1 on the development board.
UCF
#PIN MAP OF DANGEROUSPROTOTYPES.COM CPLD BREAKOUT BOARDS #lICENSE: CC-0 (CREATIVE COMMONS 0) #http://dangerousprototypes.com/docs/XC9500XL_CPLD_breakout_board #http://dangerousprototypes.com/docs/CoolRunner-II_CPLD_breakout_board NET "LED" LOC = "P39"; NET "BUTTON" LOC = "P18"; NET "LED_INV" LOC = "P38";
Input and output markers in the schematic are mapped to actual CPLD pin numbers in the UCF file. This is an example UCF file that defines the three IO connections on the development boards.
- The Pxx numbers are the actual pin number on the CPLD. Easy.
- ISE has a GUI utility to assign pin numbers, but it doesn't work with CoolRunner-II CPLDs.
We mapped the BUTTON input market to pin 18. The LED output marker connects to pin 39 (D1), and LED_INV connects to pin 38 (D2).