You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

396 lines
21 KiB

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="en" dir="ltr">
<head>
<title>CPLD intro 3: Inverse LED toggle - DP</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="generator" content="MediaWiki 1.16.0" />
<link rel="shortcut icon" href="/favicon.ico" />
<link rel="search" type="application/opensearchdescription+xml" href="/docs/opensearch_desc.php" title="DP (en)" />
<link title="Creative Commons" type="application/rdf+xml" href="/docs/index.php?title=CPLD_intro_3:_Inverse_LED_toggle&amp;action=creativecommons" rel="meta" />
<link rel="copyright" href="http://creativecommons.org/licenses/by-sa/3.0/" />
<link rel="alternate" type="application/atom+xml" title="DP Atom feed" href="/docs/index.php?title=Special:RecentChanges&amp;feed=atom" />
<link rel="stylesheet" href="/docs/skins/common/shared.css?270" media="screen" />
<link rel="stylesheet" href="/docs/skins/common/commonPrint.css?270" media="print" />
<link rel="stylesheet" href="/docs/skins/monobook/reset.css?270" media="screen" />
<link rel="stylesheet" href="/docs/skins/monobook/main.css?270" media="screen" />
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Francois One" />
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Oswald" />
<link rel="stylesheet" href="/docs/index.php?title=MediaWiki:Common.css&amp;usemsgcache=yes&amp;ctype=text%2Fcss&amp;smaxage=18000&amp;action=raw&amp;maxage=18000" />
<link rel="stylesheet" href="/docs/index.php?title=MediaWiki:Print.css&amp;usemsgcache=yes&amp;ctype=text%2Fcss&amp;smaxage=18000&amp;action=raw&amp;maxage=18000" media="print" />
<link rel="stylesheet" href="/docs/index.php?title=MediaWiki:Monobook.css&amp;usemsgcache=yes&amp;ctype=text%2Fcss&amp;smaxage=18000&amp;action=raw&amp;maxage=18000" />
<link rel="stylesheet" href="/docs/index.php?title=-&amp;action=raw&amp;maxage=18000&amp;gen=css" />
<script>
var skin="monobook",
stylepath="/docs/skins",
wgUrlProtocols="http\\:\\/\\/|https\\:\\/\\/|ftp\\:\\/\\/|irc\\:\\/\\/|gopher\\:\\/\\/|telnet\\:\\/\\/|nntp\\:\\/\\/|worldwind\\:\\/\\/|mailto\\:|news\\:|svn\\:\\/\\/",
wgArticlePath="/docs/$1",
wgScriptPath="/docs",
wgScriptExtension=".php",
wgScript="/docs/index.php",
wgVariantArticlePath=false,
wgActionPaths={},
wgServer="http://dangerousprototypes.com",
wgCanonicalNamespace="",
wgCanonicalSpecialPageName=false,
wgNamespaceNumber=0,
wgPageName="CPLD_intro_3:_Inverse_LED_toggle",
wgTitle="CPLD intro 3: Inverse LED toggle",
wgAction="view",
wgArticleId=1121,
wgIsArticle=true,
wgUserName=null,
wgUserGroups=null,
wgUserLanguage="en",
wgContentLanguage="en",
wgBreakFrames=false,
wgCurRevisionId=7357,
wgVersion="1.16.0",
wgEnableAPI=true,
wgEnableWriteAPI=true,
wgSeparatorTransformTable=["", ""],
wgDigitTransformTable=["", ""],
wgMainPageTitle="Main Page",
wgFormattedNamespaces={"-2": "Media", "-1": "Special", "0": "", "1": "Talk", "2": "User", "3": "User talk", "4": "DP", "5": "DP talk", "6": "File", "7": "File talk", "8": "MediaWiki", "9": "MediaWiki talk", "10": "Template", "11": "Template talk", "12": "Help", "13": "Help talk", "14": "Category", "15": "Category talk"},
wgNamespaceIds={"media": -2, "special": -1, "": 0, "talk": 1, "user": 2, "user_talk": 3, "dp": 4, "dp_talk": 5, "file": 6, "file_talk": 7, "mediawiki": 8, "mediawiki_talk": 9, "template": 10, "template_talk": 11, "help": 12, "help_talk": 13, "category": 14, "category_talk": 15, "image": 6, "image_talk": 7},
wgSiteName="DP",
wgCategories=["Tutorials", "Xilinx"],
wgRestrictionEdit=[],
wgRestrictionMove=[];
</script><script src="/docs/skins/common/wikibits.js?270"></script>
<script src="/docs/skins/common/ajax.js?270"></script>
<script src="/docs/index.php?title=-&amp;action=raw&amp;gen=js&amp;useskin=monobook&amp;270"></script>
</head>
<body class="mediawiki ltr ns-0 ns-subject page-CPLD_intro_3_Inverse_LED_toggle skin-monobook">
<!-- Begin PageWrapper //-->
<!--// TODO: remove all stupid divs -->
<div id="globalWrapper" class="home blog two-sidebars">
<div id="page">
<div id="page-inner">
<a id="navigation-top"></a>
<div id="skip-to-nav"><a href="#navigation">Skip to Navigation</a></div>
<!-- Begin Header //-->
<div id="header">
<div class="clearfix" id="header-inner">
<div class="region region-header" id="header-blocks">
<!-- Begin Widget TODO: remove this Crap, make real Header //-->
<div class="widget-container widget_text logo" id="text-4">
<div class="textwidget">
<a href="/"><img alt="Dangerous Prototypes" src="http://dangerousprototypes.com/theme/logo.png" /></a>
</div>
</div><!--//End Widget -->
<!-- Begin Widget //-->
<div class="widget-container widget_text banner" id="text-11">
<div id="announce" class="textwidget"></div>
</div><!--// End Widget -->
</div><!--// End Region -->
</div><!--// inner -->
</div><!--// End Header -->
<!-- Begin TopNavigation //-->
<!--// TODO: Add SideWide Global Navigation -->
<div id="navbar">
<div class="clear-block region region-navbar" id="navbar-inner">
<a id="navigation" name="navigation"></a>
<div class="menu-nav">
<ul class="menu" id="menu-header-4">
<li><a href="http://dangerousprototypes.com">Blog</a></li>
<li><a href="http://dangerousprototypes.com/docs/Main_Page#Projects">Projects</a></li>
<li><a href="http://dangerousprototypes.com/forum">Forum</a></li>
<li><a href="http://dangerousprototypes.com/about">About</a></li>
<li><a href="http://dangerousprototypes.com/contact">Contact</a></li>
<li ><a href="http://www.seeedstudio.com/depot/wherelabs-m-9.html">Shop</a></li>
<li><a href="http://dangerousprototypes.com/store/">Free PCBs</a></li>
</ul>
</div>
<div class="widget-container widget_text social" id="text-10">
<div class="textwidget">
<a id="facebook" title="Visit our Facebook page" href="http://www.facebook.com/pages/Dangerous-Prototypes/127701397281222">Facebook</a>
<a id="twitter" title="Follow us on twitter" href="http://twitter.com/#!/dangerousproto">Twitter</a>
<a id="rss" title="Subscribe to rss feed" href="http://dangerousprototypes.com/feed">RSS</a>
<a id="comrss" href="http://dangerousprototypes.com/comments/feed/" title="Subcribe to comments">Comments</a>
</div>
</div>
</div>
</div><!--// End TopNavigation -->
<!-- Begin Main //-->
<div id="main">
<div class="clearfix with-navbar" id="main-inner">
<div id="content">
<div id="content-inner">
<div id="content-area">
<a id="top"></a>
<!-- Begin Notices //-->
<!--// End Notices -->
<h1 id="firstHeading" class="firstHeading">CPLD intro 3: Inverse LED toggle</h1>
<div id="bodyContent">
<h3 id="siteSub">From DP</h3>
<div id="contentSub"></div>
<div id="jump-to-nav">
Jump to: <a href="#column-one">
navigation </a>, <a href="#searchInput">search</a>
</div>
<!-- start content -->
<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
<ul>
<li class="toclevel-1 tocsection-1"><a href="#Overview"><span class="tocnumber">1</span> <span class="toctext">Overview</span></a></li>
<li class="toclevel-1 tocsection-2"><a href="#Schematic"><span class="tocnumber">2</span> <span class="toctext">Schematic</span></a>
<ul>
<li class="toclevel-2 tocsection-3"><a href="#XC9572A"><span class="tocnumber">2.1</span> <span class="toctext">XC9572A</span></a></li>
<li class="toclevel-2 tocsection-4"><a href="#XC2C64A"><span class="tocnumber">2.2</span> <span class="toctext">XC2C64A</span></a></li>
</ul>
</li>
<li class="toclevel-1 tocsection-5"><a href="#UCF"><span class="tocnumber">3</span> <span class="toctext">UCF</span></a></li>
</ul>
</td></tr></table><script>if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
<h2> <span class="mw-headline" id="Overview">Overview</span></h2>
<p>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.
</p>
<table class="wikitable" border="1">
<caption> Tutorial 3 truth table
</caption><tr>
<th> Button PB </th><th> LED D1</th><th>LED D2
</th></tr>
<tr>
<td> Pressed</td><td> OFF </td><td> ON
</td></tr>
<tr>
<td> NOT pressed </td><td>ON</td><td>OFF
</td></tr></table>
<h2> <span class="mw-headline" id="Schematic">Schematic</span></h2>
<p><a href="/docs/File:Cpld-tutorial-external-circuit.png" class="image"><img alt="Cpld-tutorial-external-circuit.png" src="/docs/images/thumb/d/d4/Cpld-tutorial-external-circuit.png/250px-Cpld-tutorial-external-circuit.png" width="250" height="77" /></a>
</p><p>In this demo we'll use both LEDs and the push button connected to the CPLD.
</p>
<table class="wikitable" border="1">
<caption> CPLD dev board connections
</caption><tr>
<th> IO </th><th> pin connection
</th></tr>
<tr>
<td> LED D1 </td><td>P39
</td></tr>
<tr>
<td> LED D2 </td><td>P38
</td></tr>
<tr>
<td> Button BP </td><td> P18
</td></tr></table>
<pre>The XC2C64A CPLD has internal pullup resistors
R1 is unpopulated on the XC2C64A development board
</pre>
<h3> <span class="mw-headline" id="XC9572A">XC9572A</span></h3>
<p><a href="/docs/File:Cpld-demo3.png" class="image"><img alt="Cpld-demo3.png" src="/docs/images/thumb/9/9d/Cpld-demo3.png/480px-Cpld-demo3.png" width="480" height="97" /></a>
</p><p>This designs adds a second LED and connects it to the push button through an inverter.
</p>
<ul><li>Input from BUTTON enters the CPLD through an input buffer (IBUF)
</li><li>The BUTTON signal connects to LED (D1) through an output buffer (OBUF) as before
</li><li>INV is a new schematic element that inverts the BUTTON signal before it connects to a second output buffer (OBUF) and LED_INV (D2)
</li></ul>
<h3> <span class="mw-headline" id="XC2C64A">XC2C64A</span></h3>
<p><a href="/docs/File:Cpld-xc2c-ledinv.png" class="image"><img alt="Cpld-xc2c-ledinv.png" src="/docs/images/thumb/0/01/Cpld-xc2c-ledinv.png/480px-Cpld-xc2c-ledinv.png" width="480" height="119" /></a>
</p><p>The XC2C64A version is the same, except we use the internal pull-up resistor instead of R1 on the development board.
</p>
<h2> <span class="mw-headline" id="UCF">UCF</span></h2>
<pre>#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 &quot;LED&quot; LOC = &quot;P39&quot;;
NET &quot;BUTTON&quot; LOC = &quot;P18&quot;;
NET &quot;LED_INV&quot; LOC = &quot;P38&quot;;</pre>
<p>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.
</p>
<ul><li>The Pxx numbers are the actual pin number on the CPLD. Easy.
</li><li>ISE has a GUI utility to assign pin numbers, but it doesn't work with CoolRunner-II CPLDs.
</li></ul>
<p>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).
</p>
<!--
NewPP limit report
Preprocessor node count: 21/1000000
Post-expand include size: 0/2097152 bytes
Template argument size: 0/2097152 bytes
Expensive parser function count: 0/100
-->
<!-- Saved in parser cache with key dp_mediawiki-wiki_:pcache:idhash:1121-0!1!0!!en!2!edit=0 and timestamp 20200705230050 -->
<div class="printfooter">
Retrieved from "<a href="http://dangerousprototypes.com/docs/CPLD_intro_3:_Inverse_LED_toggle">http://dangerousprototypes.com/docs/CPLD_intro_3:_Inverse_LED_toggle</a>"</div>
<div id='catlinks' class='catlinks'><div id="mw-normal-catlinks"><a href="/docs/Special:Categories" title="Special:Categories">Categories</a>: <span dir='ltr'><a href="/docs/Category:Tutorials" title="Category:Tutorials">Tutorials</a></span> | <span dir='ltr'><a href="/docs/Category:Xilinx" title="Category:Xilinx">Xilinx</a></span></div></div> <!-- end content -->
<div class="visualClear"></div>
</div><!--// End ContentBody -->
</div><!--// End ContenArea -->
</div><!--// inner -->
</div><!--// End Content -->
<!--// TODO: Add Wiki Navigation to TopNav, remove Sidebars from Wiki -->
<!-- Begin Sidebar left //-->
<div id="sidebar-left">
<div class="region region-left" id="sidebar-left-inner">
<script type="text/javascript"> if (window.isMSIE55) fixalpha(); </script>
<!-- Begin CustomBox //-->
<div class='generated-sidebar portlet' id='p-jump_to'>
<h5>jump to</h5>
<div class='pBody'>
<ul><li><a href="/docs/Main_Page" title="Main Page">Projects homepage</a>
</li><li><a href="/docs/Bus_Pirate" title="Bus Pirate">Bus Pirate</a>
</li><li><a href="/docs/USB_Infrared_Toy" title="USB Infrared Toy">USB Infrared toy</a>
</li><li><a href="/docs/Web_Platform" title="Web Platform">Web platform</a>
</li><li><a href="/docs/Bus_Blaster" title="Bus Blaster">Bus Blaster</a>
</li><li><a href="/docs/Open_Bench_Logic_Sniffer" title="Open Bench Logic Sniffer">Logic Sniffer</a>
</li><li><a href="/docs/CPLD:_Complex_programmable_logic_devices" title="CPLD: Complex programmable logic devices">CPLD dev boards</a>
</li><li><a href="/docs/Logic_Shrimp_logic_analyzer" title="Logic Shrimp logic analyzer">Logic Shrimp</a>
</li><li><a href="/docs/Dangerous_Prototypes_breakout_boards" title="Dangerous Prototypes breakout boards">Breakout boards</a>
</li><li><a href="/docs/Dangerous_Proto_boards" title="Dangerous Proto boards" class="mw-redirect">Proto boards</a>
</li><li><a href="/docs/Twatch_networked_LCD" title="Twatch networked LCD">#twatch network LCD</a>
</li><li><a href="/docs/Flash_Destroyer" title="Flash Destroyer">Flash Destroyer</a>
</li><li><a href="/docs/Dangerous_Prototypes_Projects_In_Development" title="Dangerous Prototypes Projects In Development">In development</a>
</li><li><a href="/docs/Partlist" title="Partlist">Partlist and reference</a>
</li><li><a href="/docs/Special:RecentChanges" title="Special:RecentChanges">Recent changes</a>
</li></ul>
</div>
</div><!--// End CustomBox -->
<!-- Begin CustomBox //-->
<div class='generated-sidebar portlet' id='p-buy_stuff'>
<h5>buy stuff</h5>
<div class='pBody'>
<ul><li><a href="http://www.seeedstudio.com/depot/bus-pirate-v3-assembled-p-609.html?cPath=61_68" class="external text" rel="nofollow">Bus Pirate v3</a>
</li><li><a href="http://www.seeedstudio.com/depot/usb-infraed-toy-p-607.html?cPath=61_68" class="external text" rel="nofollow">USB Infrared Toy</a>
</li><li><a href="http://www.seeedstudio.com/depot/bus-blaster-v2-jtag-debugger-p-807.html" class="external text" rel="nofollow">Bus Blaster v2</a>
</li><li><a href="http://www.seeedstudio.com/depot/preorder-open-workbench-logic-sniffer-p-612.html?cPath=75" class="external text" rel="nofollow">Logic Sniffer</a>
</li></ul>
</div>
</div><!--// End CustomBox -->
<!-- Begin Search //-->
<div id="p-search" class="portlet">
<h5><label for="searchInput">Search</label></h5>
<div id="searchBody" class="pBody">
<form action="/docs/index.php" id="searchform">
<input type='hidden' name="title" value="Special:Search" />
<input id="searchInput" title="Search DP" accesskey="f" type="search" name="search" /> <input type="submit" name="go" class="searchButton" id="searchGoButton" value="Go" title="Go to a page with this exact name if exists" />
&nbsp;
<input type='submit' name="fulltext" class="searchButton" id="mw-searchButton" value="Search" title="Search the pages for this text" />
</form>
</div>
</div><!--// End Search -->
<!-- Begin ToolBox //-->
<div class="portlet" id="p-tb">
<h5>Toolbox</h5>
<div class="pBody">
<ul>
<li id="t-whatlinkshere">
<a href="/docs/Special:WhatLinksHere/CPLD_intro_3:_Inverse_LED_toggle" title="List of all wiki pages that link here [j]" accesskey="j">
What links here </a>
</li>
<li id="t-recentchangeslinked">
<a href="/docs/Special:RecentChangesLinked/CPLD_intro_3:_Inverse_LED_toggle" title="Recent changes in pages linked from this page [k]" accesskey="k">
Related changes </a>
</li>
<li id="t-specialpages">
<a href="/docs/Special:SpecialPages" title="List of all special pages [q]" accesskey="q">
Special pages </a>
</li>
<li id="t-print">
<a href="/docs/index.php?title=CPLD_intro_3:_Inverse_LED_toggle&amp;printable=yes" rel="alternate" title="Printable version of this page [p]" accesskey="p">
Printable version </a>
</li>
<li id="t-permalink">
<a href="/docs/index.php?title=CPLD_intro_3:_Inverse_LED_toggle&amp;oldid=7357" title="Permanent link to this revision of the page">
Permanent link </a>
</li>
</ul>
</div>
</div><!--// End Toolbox -->
</div>
</div><!--// End Sidebar left -->
<!-- Begin Sidebar right //-->
<div id="sidebar-right">
<div class="region region-right" id="sidebar-right-inner">
<div id="pcactions" class="portlet">
<h5>Views</h5>
<div class="pBody">
<ul>
<li id="ca-nstab-main" class="selected"><a href="/docs/CPLD_intro_3:_Inverse_LED_toggle" title="View the content page [c]" accesskey="c">Page</a></li><li id="ca-talk" class="new"><a href="/docs/index.php?title=Talk:CPLD_intro_3:_Inverse_LED_toggle&amp;action=edit&amp;redlink=1" title="Discussion about the content page [t]" accesskey="t">Discussion</a></li><li id="ca-viewsource"><a href="/docs/index.php?title=CPLD_intro_3:_Inverse_LED_toggle&amp;action=edit" title="This page is protected.&#10;You can view its source [e]" accesskey="e">View source</a></li><li id="ca-history"><a href="/docs/index.php?title=CPLD_intro_3:_Inverse_LED_toggle&amp;action=history" title="Past revisions of this page [h]" accesskey="h">History</a></li> </ul>
</div>
</div>
<div class="portlet" >
<h5>Personal tools</h5>
<div class="pBody">
<ul>
<li id="pt-login"><a href="/docs/index.php?title=Special:UserLogin&amp;returnto=CPLD_intro_3:_Inverse_LED_toggle" title="You are encouraged to log in; however, it is not mandatory [o]" accesskey="o">Log in</a>
</li>
</ul>
</div>
</div>
</div>
</div><!--// End Sidebar right -->
</div>
</div><!--// End Main -->
<div id="push"></div>
</div><!--// page-inner -->
</div><!--// page -->
</div><!--// End Global Wrapper -->
<!--// TODO: Add real Clearfix -->
<div class="visualClear"></div>
<!-- Begin Footer //-->
<!--// TODO: Add SideWide Global Footer -->
<div id="footer">
<div class="region region-footer" id="footer-inner">
<div class="widget-container widget_text contact" id="text-6">
<h3 class="widget-title">Site</h3>
<div class="textwidget">
<ul id="f-list">
<li id="lastmod">
This page was last modified on 26 February 2011, at 16:38. </li>
</ul>
<br />
Copyright 2020 Where Labs, LLC.<br />
CC BY-SA unless otherwise noted.
</div>
</div>
<div class="widget-container widget_text connect" id="text-7">
<h3 class="widget-title">Connect</h3>
<div class="textwidget">
<ul>
<li><a title="Follow us on twitter" href="http://twitter.com/#!/dangerousproto">Follow us on Twitter</a></li>
<li><a href="http://dangerousprototypes.com/feed" title="Subscribe to rss feed">Subscribe to our feed</a></li>
<li><a href="http://dangerousprototypes.com/comments/feed" title="Subcribe to comments">Subscribe to our comments</a></li>
<li><a title="Visit our Facebook page" href="http://www.facebook.com/pages/Dangerous-Prototypes/127701397281222">Visit our Facebook page</a></li>
<li><a href="http://dangerousprototypes.com/contact-us">Send us an email</a></li>
</ul>
</div>
</div>
<div class="widget-container widget_text projects" id="text-8">
<h3 class="widget-title">Projects</h3>
<div class="textwidget">
<ul>
<li><a href="http://www.seeedstudio.com/depot/bus-pirate-v3-assembled-p-609.html?cPath=61_68">Get a Bus Pirate v3</a></li>
<li><a title="Bus Blaster v2" href="http://www.seeedstudio.com/depot/bus-blaster-v2-jtag-debugger-p-807.html">Get a Bus Blaster v2</a></li>
<li><a href="http://www.seeedstudio.com/depot/usb-infrared-toy-v2-p-831.html?cPath=174">Get a USB Infrared Toy</a></li>
<li><a href="http://www.seeedstudio.com/depot/preorder-open-workbench-logic-sniffer-p-612.html?cPath=75">Get a Logic Sniffer</a></li>
</ul>
</div>
</div>
<div class="widget-container widget_text about-us" id="text-9">
<h3 class="widget-title">About Us</h3>
<div class="textwidget">Our goal is to make open source hardware that makes hacking fun. Copies of our projects are available through Seeed Studio and our distributors.</div>
</div>
</div>
</div><!--// End Footer -->
<!-- Begin JavaScripts //-->
<script>if (window.runOnloadHook) runOnloadHook();</script>
<!--// End JavaScripts -->
<!-- Served in 0.044 secs. --> </body>
</html>