PWM for motor control with Microchip Curiosity and MPLAB Code Configurator
October 07, 2015
Video
Embedded Computing Design
PWM for motor control with Microchip Curiosity and MPLAB Code Configurator
The following describes how to build a simple PWM for motor control applications on the Microchip Curiosity Development board using the MPLAB X Integrated Development Environment (IDE) and MPLAB Code Configurator (MCC). We begin with basic bring up of Curiosity’s onboard PIC16F1619 8-bit MCU running a “Hello, World!” program, and continue to set up a PWM using a Timer based on an FOSC/4 clock. All of this is done using the Microchip MCC without ever writing a single line of code.
Difficulty Level: Beginner
Hardware Required:
• Microchip Curiosity Development Board (Outfitted with PIC16(L)F161X MCUs – Used here is the PIC16F1619)
• USB 2.0 A-Male to Mini-B Cable
Software Required:
• Microchip MPLAB X IDE version 3.05 or later (Used here is MPLAB X IDE version 3.10; Download from www.microchip.com/pagehandler/en-us/family/mplabx/)
• MPLAB XC Compiler (Used here is MPLAB® XC8 Compiler version 1.35; Download from www.microchip.com/pagehandler/en-us/devtools/mplabxc/home.html)
• MPLAB Code Configurator version 2.25 plugin (Download from www.microchip.com/mymicrochip/filehandler.aspx?ddocname=en576270)
Recommended Platforms:
• Windows (x86/x64)
• Linux 32-bit and Linux 64-bit (32-bit compatibility libraries required)
• Mac (Versions 10.X)
Support/Documentation:
• www.microchip.com/curiosity
• www.microchip.com/support
Cost Estimate:
• Microchip Curiosity Development Board – $20 (Before tax, shipping & handling. Available from multiple distributors.)
• USB 2.0 A-Male to Mini-B Cable – $5 (Rough estimate. Available from multiple distributors.)
var Hubs = window.Hubs || {}; Hubs.recommendation = {"enabled":true,"isRecommendationFound":null,"id":46698,"isInternalRule":false,"isAiRule":true,"recommendationAiContent":"all_streams","recommendationAiStreams":[],"source_collection_id":0,"template":{"max_items_to_display":8,"max_item_age":365,"enable_panel":0,"panel_top_auto":1,"panel_top_pixels":20,"panel_delay":0,"override_next":1,"label_recommended":"Recommended","hide_publish_date":0}};
×
// Called when a Parent Window of an Embedded IFrame has Initial Load Data function g_iFrameLoadDataCallback(loadData) { $('window').trigger('loadData', [loadData]); }
// Called when a Parent Window of an Embedded IFrame is Scrolled function g_iFrameScrollCallback(scrollTop, offsetTop, viewportX, viewportY) { $('window').trigger('scroll', [scrollTop, offsetTop, viewportX, viewportY]); }
'search' : { 'enabled' : true, 'labels' : { 'home' : 'Home', 'videos' : 'Videos', 'blogs' : 'Articles & Blogs', 'docs' : 'White Papers & Publications', 'social' : 'Social', 'recent' : 'Recent Searches', 'noItems' : 'No Items Found', 'noItemsStream' : 'No Items Found in this Stream', 'seeMore' : 'See more', 'searchEntireHub' : 'Search the rest of the Hub', 'searchAllContent': 'All Content', 'searchPlaceholder':'Search' }, 'maxRecents' : 5 },
'isMobile' : false, 'isEmbedded' : false, 'isEmbeddedTile' : false,
'labOptions' : {"topMenu":false,"permHeader":true,"noHeader":true,"hideBanner":false,"highlightFirst":false,"stickyFooter":true,"flipbookBreakOut":false,"linkBreakOut":false,"loadByButton":false,"navAlwaysTop":true}, 'embedOptions' : {"hideHeader":false,"hideBanner":false,"hideFooter":false,"hidePrimaryNav":false,"hideSecondaryNav":false,"linkBreakOut":false,"revealBehaviour":"fade"}, 'knownUser' : {"Mailchimp":0,"Hubspot":0,"Eloqua":0,"Marketo":0,"Pardot":0,"Acton":0}, 'eloquaFirstPartyCookies' : 0, 'mapIntegrations' : ["Marketo"], 'integrationsToTrackViews' : ["Marketo"], 'disableUfMetrics' : false, 'pageType' : Hubs.PAGE_TYPE_ITEM, 'bombora' : true, 'analyticsCodes' : ['UA-91807-34'], 'enableDebugger' : false, 'itemPreviewButtonLabel': 'Continue Reading...', 'externalApiUrl': 'https://v2.api.uberflip.com', 'isPreventAnalyticsCollectionEnabled': false, 'privacyGroups': [], });
/* Get uuid - used to pass back to bombora as our main identifier of this visitor */ window.getBomboraUuid = function() { return ''; };
/* Get page id - used to pass back to bombora as the item being viewed */ window.getBomboraUrlId = function(){ var env = 'production'; var $infoDiv = $('#page-type-identifier'); var item = { type : $infoDiv.attr('data-page-type'), collectionId : $infoDiv.attr('data-collection-id'), id : $infoDiv.attr('data-item-id') };
if(item.type === 'PAGE_TYPE_HUB'){ return env + '||' + Hubs.Config.hubId; } else if(item.type === 'PAGE_TYPE_COLLECTION'){ return env + '||' + Hubs.Config.hubId + '||' + item.collectionId; } else if(item.type === 'PAGE_TYPE_ITEM'){ return env + '||' + Hubs.Config.hubId + '||' + item.collectionId + '||' + item.id; } };
// Bombora tracking script (function (w,d,t) { _ml = w._ml || {}; _ml.eid = '52079'; // Uberflip ID -- DO NOT CHANGE _ml.fp = w.getBomboraUuid(); _ml.cid = w.getBomboraUrlId(); _ml.informer = { callback: function () { //call back when profile is loaded //data is loaded in _ml.us }, enable: true }; var s, cd, tag; s = d.getElementsByTagName(t)[0]; cd = new Date(); tag = d.createElement(t); tag.async = 1; tag.src = 'https://ml314.com/tag.aspx?' + cd.getDate() + cd.getMonth(); s.parentNode.insertBefore(tag, s); })(window,document,'script');
})(document,"script","munchkin",300000); } loadMarketoTracking();
function appendDCLink(){ $('.cta').each(function( i ){ var dataCtaId = $(this).attr('data-cta-id'); //Find CTA ID for targeting if (dataCtaId == '306999'){ //the ID of the Link CTA you're targeting var ctaLink = $(this).find('a').prop('href'); // var dcLink = "https://www.digikey.com/en/product-highlight/r/renesas/ra-mcus"; //the redirect on the link you're setting up var concatLink = ctaLink + "?" + dcLink; //concatenation of DC link tracking code and redirection code $(this).find('a').attr('href', concatLink); //append to href of appropriate CTA } else if (dataCtaId == '332336') { // DigiKey August 2020 var ctaLink = $(this).find('a').prop('href'); // var dcLink = "https://www.digikey.com/en/product-highlight/t/toshiba-semi-and-storage/low-power-discrete-semiconductors-for-the-iot"; var concatLink = ctaLink + "?" + dcLink; $(this).find('a').attr('href', concatLink); } else if (dataCtaId == '338033') { // DigiKey September 2020 var ctaLink = $(this).find('a').prop('href'); // var dcLink = "https://www.digikey.com/en/product-highlight/s/sitime/oscillator-selection#osc-type%7CTabs1"; var concatLink = ctaLink + "?" + dcLink; $(this).find('a').attr('href', concatLink); } else if (dataCtaId == '342073') { // DigiKey Oct 2020 var ctaLink = $(this).find('a').prop('href'); // var dcLink = "https://www.digikey.com/en/product-highlight/x/xilinx/zynq-ultrascale-mpsoc-zcu102-evaluation-kit"; var concatLink = ctaLink + "?" + dcLink; $(this).find('a').attr('href', concatLink); } }); }
/* Replace "Learn More" with "Read white paper" only one white paper stream */ function replaceText(selector, text, newText, flags) { var matcher = new RegExp(text, flags); $(selector).each(function () { var $this = $(this); if (!$this.children().length) $this.text($this.text().replace(matcher, newText)); }); }
function sponsoredTiles() { $('li[data-tags*="sponsored"]').addClass('sponsored'); $('.tile.sponsored').each(function(){ var $this = $(this); if($(this).find('.sponsored-label').lengthSponsored'); } }); }
function webcastTiles() { $('li[data-source-stream-id="773047"].tile').addClass('webcast'); $('.tile.webcast').each(function(){ var $this = $(this); if($(this).find('.webcast-label').lengthWebcast'); } }); }
function bloatedTiles() { $('.tile.with-img').each(function(){ var $this = $(this); if(($(this).find('h3.h3like').height()+$(this).find('h4').height())>132) { $(this).addClass('bloated'); } }); }
//data-source-stream-id="424317" function replaceAllText() { replaceText('.tile.single[data-source-stream-id="738160"]>a.view', 'Read Article', 'Read news story', 'g'); //data-source-stream-id="738160" replaceText('.stream-424317 .tile.single>a.view', 'Read Article', 'Read white paper', 'g'); replaceText('.tile.stream-613287>a.view, .tile[data-source-stream-id="613287"]>a.view', 'Read Article', 'Listen to Podcast'); replaceText('.tile.sponsored>a.view', 'Read Article', 'Learn More', 'g'); replaceText('.tile.stream-773047>a.view', 'Read Article', 'Register for Webcast', 'g'); replaceText('.tile.stream-7405615>a.view', 'Read Article', 'REGISTER', 'g'); }
$('html').ajaxStop(replaceAllText);
function onLoadOrChange($this){ sponsoredTiles(); webcastTiles(); bloatedTiles(); appendDCLink();
if($('meta[name="title"][content^="Sponsored:"]').length>0) { $('.level-three').first().addClass('sponsored'); } else if(typeof $this.currentItemTags == 'string' && $this.currentItemTags.length > 0 && $this.currentItemTags.indexOf('sponsored') > -1) { $('.level-three').first().addClass('sponsored'); } $('.level-three.sponsored').prepend('
if(typeof $this.currentItemTags == 'string' && $this.currentItemTags.length > 0 && $this.currentItemTags.indexOf('slide show') > -1) { $.getScript( 'http://cloud2.opensystemsmedia.com/share/JS/jquery-ui-1.12.1-uniqueId.min.js').done(function(){ $.getScript( 'http://cloud2.opensystemsmedia.com/share/JS/waypoints.min.js').done(function(){ var waypoints = $('.entry h2').uniqueId().waypoint({ handler: function(direction) { console.log(this.id+' (h2 hit)'); ga('send', 'pageview', window.location.pathname + '#slide'+this.id); } }) }); }); }
if(Hubs.appInstance.itemType != 'uberflip' && $('.entry iframe[src*="soundcloud"]').length 0 && $('meta[itemprop="image"]').attr('content').length > 11) { //$('.level-three .entry-wrapper').prepend('
var disqus_shortname = 'embedded'; var disqus_identifier = '292843218'; var disqus_url = 'https://www.embedded-computing.com/youtube-videos-embedded/pwm-for-motor-control-with-microchip-curiosity-and-mplab-code-configurator';
var disqus_config = function () { this.page.url = disqus_url; this.page.identifier = disqus_identifier; };
(function() { var d = document, s = d.createElement('script');
s.src = '//' + disqus_shortname + '.disqus.com/embed.js';
s.setAttribute('data-timestamp', +new Date()); (d.head || d.body).appendChild(s); })();