{"id":1052,"date":"2020-03-13T14:51:50","date_gmt":"2020-03-13T14:51:50","guid":{"rendered":"https:\/\/ibex.tech\/embedded\/?p=1052"},"modified":"2024-07-19T12:04:40","modified_gmt":"2024-07-19T11:04:40","slug":"adding-mcc-to-new-project","status":"publish","type":"post","link":"https:\/\/ibex.tech\/embedded\/microchip\/pic18\/xc8-compiler\/xc8-general\/adding-mcc-to-new-project","title":{"rendered":".Adding MCC To New Project"},"content":{"rendered":"\n<h4 class=\"wp-block-heading\">Adding to your project<\/h4>\n\n\n\n<p>Create your MPLABX project as normal.<\/p>\n\n\n\n<p>Press the blue &#8216;MCC&#8217; button on the toolbar to launch the code configurator.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">MCC Melody \/ MCC Classic \/ MPLAB Harmony choice<\/h5>\n\n\n\n<p>(Unavailable options for your chosen device will be greyed out)<\/p>\n\n\n\n<p>&#8220;MCC Melody&#8221; is the newest that you should use if it is available for your device. <em>&lt;&lt;Do this!! We have found devices that are not properly supported by Classic that we&#8217;ve wasted ages on trying to get working but when re-generating the project and using Melody suddenly all of the peripherals etc are there and working properly!<\/em><\/p>\n\n\n\n<p>&#8220;MCC Classic&#8221; is the old typical option to go with, but Harmony maybe what you want to be able to utilize all the special more advanced use case libraries that Harmony provides.<\/p>\n\n\n\n<p>Add any special libraries (you&#8217;ll be prompted for all the normal peripherals after pressing Finish).<\/p>\n\n\n\n<p>At the next stage setup all the config by adding the modules you want to use and adjusting settings.<\/p>\n\n\n\n<p>When done from the &#8220;Generate&#8221; button (in top left Project Resources box). Check for any errors in the Output window.<\/p>\n\n\n\n<p>Press the MCC button to close the Code Configurator view.<\/p>\n\n\n\n<p>The MCC will have created a main.c file for your project, plus various other driver files in folder &#8220;\\mcc_generated_files&#8221;.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Simple way to integrate your project files with the MCC generated main.c file<\/h4>\n\n\n\n<p>Create your own main and init functions:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#include \"mcc_generated_files\/system\/system.h\"\n\n\/\/********************************\n\/\/********** INITIALISE **********\n\/\/********************************\nvoid ap_initialise (void)\n{\n\tuint8_t Data;\n\n\t\/\/Do your init stuff\t\n\n\t\/\/-----------------------------\n\t\/\/----- ENABLE INTERRUPTS -----\n\t\/\/-----------------------------\n\t\/\/INTCONbits.PEIE = 1;\n\t\/\/ENABLE_INT;\n\n\t\n}\n\n\n\n\/\/***********************************\n\/\/***********************************\n\/\/********** MAIN FUNCTION **********\n\/\/***********************************\n\/\/***********************************\nvoid ap_main (void)\n{\n\t\/\/*********************\n\t\/\/*********************\n\t\/\/***** MAIN LOOP *****\n\t\/\/*********************\n\t\/\/*********************\n\t\/\/while(1)\t\t\t\t\t\t\/\/(Do forever) &lt;THIS IS ALREADY OCCURING IN main.c main(), WE ARE CALLED FROM WITHIN IT\n\t\/\/{\n\t\t\n\n\t\t\/\/&lt;&lt;&lt;&lt; Add your applicaiton main loop code here\n\n\t\/\/}\t\/\/while(1)\n}\n<\/code><\/pre>\n\n\n\n<h5 class=\"wp-block-heading\">In the main.c file<\/h5>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/Add these after the #include section at the top\nextern void ap_initialise (void);\nextern void ap_main (void);\n\n\/\/Add this before the main() function \"while (1)\" or \"while (true)\"\n\t\/\/CALL OUR APPLICATION INITIALSE CODE\n\tap_initialise();\n\n\/\/Add this inside the main() function \"while (1)\" or \"while (true)\" loop\n\t\/\/CALL OUR APPLICATION MAIN LOOP CODE\n\tap_main();<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Using MCC created peripherals<\/h4>\n\n\n\n<p>See the <a href=\"https:\/\/ibex.tech\/embedded\/category\/microchip\/mplab-x\/mcc\">dedicated section of this web site here<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Adding to your project Create your MPLABX project as normal. Press the blue &#8216;MCC&#8217; button on the toolbar to launch the code configurator. MCC Melody \/ MCC Classic \/ MPLAB Harmony choice (Unavailable options for your chosen device will be greyed out) &#8220;MCC Melody&#8221; is the newest that you should use if it is available [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[106,123,80,120,88],"tags":[],"class_list":["post-1052","post","type-post","status-publish","format-standard","hentry","category-xc32-general","category-xc8-general-xc8-compiler-pic16","category-xc8-general","category-xc8-general-xc8-compiler-pic12","category-mcc"],"_links":{"self":[{"href":"https:\/\/ibex.tech\/embedded\/wp-json\/wp\/v2\/posts\/1052","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibex.tech\/embedded\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibex.tech\/embedded\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibex.tech\/embedded\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ibex.tech\/embedded\/wp-json\/wp\/v2\/comments?post=1052"}],"version-history":[{"count":31,"href":"https:\/\/ibex.tech\/embedded\/wp-json\/wp\/v2\/posts\/1052\/revisions"}],"predecessor-version":[{"id":1573,"href":"https:\/\/ibex.tech\/embedded\/wp-json\/wp\/v2\/posts\/1052\/revisions\/1573"}],"wp:attachment":[{"href":"https:\/\/ibex.tech\/embedded\/wp-json\/wp\/v2\/media?parent=1052"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibex.tech\/embedded\/wp-json\/wp\/v2\/categories?post=1052"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibex.tech\/embedded\/wp-json\/wp\/v2\/tags?post=1052"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}