{"id":275,"date":"2012-06-25T12:11:30","date_gmt":"2012-06-25T10:11:30","guid":{"rendered":"http:\/\/www.f4ctz.fr\/?page_id=275"},"modified":"2018-11-18T17:53:05","modified_gmt":"2018-11-18T16:53:05","slug":"pic32mx795f512l","status":"publish","type":"page","link":"https:\/\/www.f4ctz.fr\/?page_id=275","title":{"rendered":"Microchip PIC32MX795F512L"},"content":{"rendered":"<p>Ceci est un exemple de code source montrant le param\u00e8trage minimal d&rsquo;un PIC32MX795F512L pour sortir sur RA1 des \u00e9tats hauts d&rsquo;une longueur d&rsquo;un temps cycle \u00e0 80MIPS. Cela permet ainsi de valider un circuit avec ce composant en v\u00e9rifiant que :<\/p>\n<ul style=\"list-style-type: disc;\">\n<li>Le composant est correctement aliment\u00e9.<\/li>\n<li>L&rsquo;oscillateur fonctionne et la PLL est correctement configur\u00e9e.<\/li>\n<\/ul>\n<p>Pour cela, deux fichiers \u00e0 ajouter \u00e0 un projet vierge dans MPLAB avec les compilateurs C32 ou XC32 :<\/p>\n<ul>\n<li>main.c<\/li>\n<\/ul>\n<div id=\"wpshdo_1\" class=\"wp-synhighlighter-outer\"><div id=\"wpshdt_1\" class=\"wp-synhighlighter-expanded\"><table border=\"0\" width=\"100%\"><tr><td align=\"left\" width=\"80%\"><a name=\"#codesyntax_1\"><\/a><a id=\"wpshat_1\" class=\"wp-synhighlighter-title\" href=\"#codesyntax_1\"  onClick=\"javascript:wpsh_toggleBlock(1)\" title=\"Click to show\/hide code block\">Source code<\/a><\/td><td align=\"right\"><a href=\"#codesyntax_1\" onClick=\"javascript:wpsh_code(1)\" title=\"Show code only\"><img decoding=\"async\" border=\"0\" style=\"border: 0 none\" src=\"https:\/\/www.f4ctz.fr\/wp-content\/plugins\/wp-synhighlight\/themes\/default\/images\/code.png\" \/><\/a>&nbsp;<a href=\"#codesyntax_1\" onClick=\"javascript:wpsh_print(1)\" title=\"Print code\"><img decoding=\"async\" border=\"0\" style=\"border: 0 none\" src=\"https:\/\/www.f4ctz.fr\/wp-content\/plugins\/wp-synhighlight\/themes\/default\/images\/printer.png\" \/><\/a>&nbsp;<a href=\"https:\/\/www.f4ctz.fr\/wp-content\/plugins\/wp-synhighlight\/About.html\" target=\"_blank\" title=\"Show plugin information\"><img decoding=\"async\" border=\"0\" style=\"border: 0 none\" src=\"https:\/\/www.f4ctz.fr\/wp-content\/plugins\/wp-synhighlight\/themes\/default\/images\/info.gif\" \/><\/a>&nbsp;<\/td><\/tr><\/table><\/div><div id=\"wpshdi_1\" class=\"wp-synhighlighter-inner\" style=\"display: block;\"><div class=\"c\" style=\"font-family:monospace;\"><span class=\"co2\">#include &quot;HardwareProfile.h&quot;<\/span><br \/>\n<br \/>\n<span class=\"kw4\">void<\/span> CPUInit<span class=\"br0\">&#40;<\/span><span class=\"kw4\">void<\/span><span class=\"br0\">&#41;<\/span> <span class=\"br0\">&#123;<\/span><br \/>\n&nbsp; &nbsp; SYSTEMConfigPerformance<span class=\"br0\">&#40;<\/span>SYS_FREQ<span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><br \/>\n<br \/>\n&nbsp; &nbsp; DDPCONbits.<span class=\"me1\">JTAGEN<\/span> <span class=\"sy0\">=<\/span> <span class=\"nu0\">0<\/span><span class=\"sy0\">;<\/span>&nbsp; &nbsp; &nbsp; <span class=\"co1\">\/\/ Disable JTAG<\/span><br \/>\n&nbsp; &nbsp; DDPCONbits.<span class=\"me1\">TROEN<\/span> <span class=\"sy0\">=<\/span> <span class=\"nu0\">0<\/span><span class=\"sy0\">;<\/span> &nbsp; &nbsp; &nbsp; <span class=\"co1\">\/\/ Disable trace<\/span><br \/>\n<br \/>\n&nbsp; &nbsp; PORTSetPinsDigitalOut<span class=\"br0\">&#40;<\/span>IOPORT_A<span class=\"sy0\">,<\/span>BIT_1<span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><br \/>\n<span class=\"br0\">&#125;<\/span> &nbsp; <br \/>\n<br \/>\n<span class=\"kw4\">int<\/span> main<span class=\"br0\">&#40;<\/span><span class=\"kw4\">void<\/span><span class=\"br0\">&#41;<\/span> <span class=\"br0\">&#123;<\/span><br \/>\n<br \/>\n&nbsp; &nbsp; CPUInit<span class=\"br0\">&#40;<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><br \/>\n<br \/>\n&nbsp; &nbsp; <span class=\"kw1\">while<\/span><span class=\"br0\">&#40;<\/span>1<span class=\"br0\">&#41;<\/span> <span class=\"br0\">&#123;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; mPORTASetBits<span class=\"br0\">&#40;<\/span>BIT_1<span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; mPORTAClearBits<span class=\"br0\">&#40;<\/span>BIT_1<span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><br \/>\n&nbsp; &nbsp; <span class=\"br0\">&#125;<\/span> &nbsp; <br \/>\n<br \/>\n&nbsp; &nbsp; <span class=\"kw1\">return<\/span> <span class=\"nu0\">0<\/span><span class=\"sy0\">;<\/span><br \/>\n<span class=\"br0\">&#125;<\/span><\/div><\/div><\/div>\n<ul>\n<li>HardwareProfile.h<\/li>\n<\/ul>\n<div id=\"wpshdo_2\" class=\"wp-synhighlighter-outer\"><div id=\"wpshdt_2\" class=\"wp-synhighlighter-expanded\"><table border=\"0\" width=\"100%\"><tr><td align=\"left\" width=\"80%\"><a name=\"#codesyntax_2\"><\/a><a id=\"wpshat_2\" class=\"wp-synhighlighter-title\" href=\"#codesyntax_2\"  onClick=\"javascript:wpsh_toggleBlock(2)\" title=\"Click to show\/hide code block\">Source code<\/a><\/td><td align=\"right\"><a href=\"#codesyntax_2\" onClick=\"javascript:wpsh_code(2)\" title=\"Show code only\"><img decoding=\"async\" border=\"0\" style=\"border: 0 none\" src=\"https:\/\/www.f4ctz.fr\/wp-content\/plugins\/wp-synhighlight\/themes\/default\/images\/code.png\" \/><\/a>&nbsp;<a href=\"#codesyntax_2\" onClick=\"javascript:wpsh_print(2)\" title=\"Print code\"><img decoding=\"async\" border=\"0\" style=\"border: 0 none\" src=\"https:\/\/www.f4ctz.fr\/wp-content\/plugins\/wp-synhighlight\/themes\/default\/images\/printer.png\" \/><\/a>&nbsp;<a href=\"https:\/\/www.f4ctz.fr\/wp-content\/plugins\/wp-synhighlight\/About.html\" target=\"_blank\" title=\"Show plugin information\"><img decoding=\"async\" border=\"0\" style=\"border: 0 none\" src=\"https:\/\/www.f4ctz.fr\/wp-content\/plugins\/wp-synhighlight\/themes\/default\/images\/info.gif\" \/><\/a>&nbsp;<\/td><\/tr><\/table><\/div><div id=\"wpshdi_2\" class=\"wp-synhighlighter-inner\" style=\"display: block;\"><div class=\"c\" style=\"font-family:monospace;\"><span class=\"co2\">#include &lt;p32xxxx.h&gt;<\/span><br \/>\n<span class=\"co2\">#include &lt;plib.h&gt;<\/span><br \/>\n<br \/>\n<span class=\"co1\">\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/<\/span><br \/>\n<span class=\"co1\">\/\/ Configuration processeur &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \/\/<\/span><br \/>\n<span class=\"co1\">\/\/&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \/\/<\/span><br \/>\n<span class=\"co1\">\/\/ Informations disponibles dans le fichier d'aide :&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \/\/<\/span><br \/>\n<span class=\"co1\">\/\/ - hlpPIC32MXConfigSet.chm&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \/\/<\/span><br \/>\n<span class=\"co1\">\/\/ - http:\/\/ww1.microchip.com\/downloads\/en\/DeviceDoc\/61156G.pdf &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \/\/<\/span><br \/>\n<span class=\"co1\">\/\/ &nbsp; &nbsp; page 165 Section 28.1 - Configuration bits &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \/\/<\/span><br \/>\n<span class=\"co1\">\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/<\/span><br \/>\n<span class=\"co2\">#pragma config FSRSSEL = PRIORITY_0 \/\/ Toutes les interruptions utilisent le shadow register<\/span><br \/>\n<br \/>\n<span class=\"co2\">#pragma config FMIIEN = OFF &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \/\/ Interface Ethernet en mode RMII pour DP83848<\/span><br \/>\n<span class=\"co2\">#pragma config FETHIO = OFF &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \/\/ Configuration alternative des signaux du module Ethernet<\/span><br \/>\n<br \/>\n<span class=\"co2\">#pragma config FCANIO = ON, FUSBIDIO = OFF, FVBUSONIO = OFF &nbsp; &nbsp; \/\/Autres modules inutilises<\/span><br \/>\n<br \/>\n<span class=\"co2\">#pragma config WDTPS = PS1, FWDTEN = OFF<\/span><br \/>\n<br \/>\n<span class=\"co2\">#pragma config ICESEL = ICS_PGx1, DEBUG = OFF<\/span><br \/>\n<br \/>\n<span class=\"co2\">#pragma config PWP = OFF, BWP = OFF, CP = OFF<\/span><br \/>\n<br \/>\n<span class=\"co1\">\/\/\/\/\/\/\/\/\/\/ Configuration de l'oscillateur pour un quartz de 8MHz externe \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/<\/span><br \/>\n<span class=\"co2\">#pragma config FNOSC = PRIPLL &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \/\/ Choix de l'oscillateur primaire avec utilisation de la PLL<\/span><br \/>\n<span class=\"co2\">#pragma config POSCMOD = XT &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \/\/ Quartz &lt; 10Mhz donc XT<\/span><br \/>\n<span class=\"co2\">#pragma config OSCIOFNC = ON<\/span><br \/>\n<span class=\"co2\">#pragma config FPLLIDIV = DIV_2, FPLLMUL = MUL_20, FPLLODIV = DIV_1 \/\/ 80Mips<\/span><br \/>\n<span class=\"co2\">#pragma config UPLLEN = ON, UPLLIDIV = DIV_2&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \/\/ PLL USB<\/span><br \/>\n<span class=\"co2\">#pragma config FSOSCEN = OFF, IESO = OFF, FCKSM = CSDCMD&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \/\/ Autres parametres de l'oscillateur<\/span><br \/>\n<span class=\"co2\">#pragma config FPBDIV = DIV_1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \/\/ Horloge peripherique<\/span><br \/>\n<br \/>\n<span class=\"co1\">\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/<\/span><br \/>\n<span class=\"co1\">\/\/ Definitions generiques &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \/\/<\/span><br \/>\n<span class=\"co1\">\/\/&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \/\/<\/span><br \/>\n<span class=\"co1\">\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/<\/span><br \/>\n<span class=\"co2\">#define SYS_FREQ&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 80000000UL<\/span><br \/>\n<span class=\"co2\">#define GetPeripheralClock()&nbsp; &nbsp; (SYS_FREQ\/(1 &lt;&lt; OSCCONbits.PBDIV))<\/span><br \/>\n<span class=\"co2\">#define GetInstructionClock() &nbsp; (SYS_FREQ)<\/span><\/div><\/div><\/div><\/p>","protected":false},"excerpt":{"rendered":"<p>Ceci est un exemple de code source montrant le param\u00e8trage minimal d&rsquo;un PIC32MX795F512L pour sortir sur RA1 des \u00e9tats hauts d&rsquo;une longueur d&rsquo;un temps cycle \u00e0 80MIPS. Cela permet ainsi de valider un circuit avec ce composant en v\u00e9rifiant que : Le composant est correctement aliment\u00e9. L&rsquo;oscillateur fonctionne et la PLL est correctement configur\u00e9e. Pour [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":267,"menu_order":20,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"categories":[],"tags":[169,148,134,133,141,153,154],"class_list":["post-275","page","type-page","status-publish","hentry","tag-blinking","tag-code-source","tag-microchip","tag-microcontroleur","tag-pic32","tag-pic32mx","tag-pic32mx795f512l"],"_links":{"self":[{"href":"https:\/\/www.f4ctz.fr\/index.php?rest_route=\/wp\/v2\/pages\/275","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.f4ctz.fr\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.f4ctz.fr\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.f4ctz.fr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.f4ctz.fr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=275"}],"version-history":[{"count":0,"href":"https:\/\/www.f4ctz.fr\/index.php?rest_route=\/wp\/v2\/pages\/275\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/www.f4ctz.fr\/index.php?rest_route=\/wp\/v2\/pages\/267"}],"wp:attachment":[{"href":"https:\/\/www.f4ctz.fr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=275"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.f4ctz.fr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=275"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.f4ctz.fr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=275"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}