{"id":190,"date":"2010-10-09T14:59:41","date_gmt":"2010-10-09T14:59:41","guid":{"rendered":"http:\/\/embedded-lab.com\/blog\/?p=190"},"modified":"2012-07-30T09:29:34","modified_gmt":"2012-07-30T13:29:34","slug":"getting-ready-for-the-first-lab","status":"publish","type":"post","link":"https:\/\/embedded-lab.com\/blog\/getting-ready-for-the-first-lab\/","title":{"rendered":"Getting ready for the first lab"},"content":{"rendered":"<p>This is to be followed after you have successfully completed the following steps:<\/p>\n<ul>\n<li>Installed <a href=\"http:\/\/www.mikroe.com\/eng\/downloads\/get\/29\/mikroc_pro_pic_2010_v415_setup.zip\" target=\"_blank\"><strong><em>mikroC Pro for PIC<\/em><\/strong><\/a> on your PC.<\/li>\n<li>Installed the programmer software that came with your PIC programmer. If you have got an iCP01 USB PIC programmer from <a href=\"http:\/\/www.piccircuit.com\/\" target=\"_blank\">iCircuit Technologies<\/a>, you should install Microchip&#8217;s PICkit programming software.<\/li>\n<li>Got a breadboard and a <em><strong><a href=\"http:\/\/embedded-lab.com\/blog\/?p=112\">regulated +5V power source<\/a><\/strong><\/em>.<\/li>\n<\/ul>\n<p><strong>Basic setup on the breadboard<\/strong><\/p>\n<p>As mentioned before all the experimental circuits will be constructed on the breadboard because it is easy to modify the circuit and correct any wiring error. Figure 1 shows the pin diagrams of PIC16F688. It is a 14-pin microcontroller with a precision internal oscillator. It provides 12 I\/O pins with individual direction control, and can drive LEDs directly. 8 out of 12 I\/O pins also serve as ADC channels for the internal 10-bit ADC. The various features of PIC16F688 will be discussed later in more detail in following lab sessions. For now, we will look at a simple circuit setup for PIC16F688 on the breadboard that will be used in all the experiments.<\/p>\n<p style=\"text-align: center;\"><a href=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2010\/10\/PIC16F688.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-173\" title=\"PIC16F688\" src=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2010\/10\/PIC16F688-500x158.png\" alt=\"\" width=\"500\" height=\"158\" srcset=\"https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2010\/10\/PIC16F688-500x158.png 500w, https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2010\/10\/PIC16F688.png 720w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/a><\/p>\n<p><!--more--><\/p>\n<p style=\"text-align: center;\">Figure 1: PIC16F688 pin diagram<\/p>\n<p style=\"text-align: center;\">\n<p style=\"text-align: center;\"><a rel=\"attachment wp-att-634\" href=\"http:\/\/embedded-lab.com\/blog\/?attachment_id=634\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-634 aligncenter\" title=\"Circuit_BasicSetup_PIC16F688\" src=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2010\/10\/Circuit_BasicSetup_PIC16F688.jpg\" alt=\"\" width=\"574\" height=\"533\" srcset=\"https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2010\/10\/Circuit_BasicSetup_PIC16F688.jpg 574w, https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2010\/10\/Circuit_BasicSetup_PIC16F688-484x450.jpg 484w\" sizes=\"auto, (max-width: 574px) 100vw, 574px\" \/><\/a>Figure 2: Basic setup for PIC16F688 with an external reset switch<\/p>\n<p>Figure 2 shows a PIC16F688 microcontroller with minimum support components. We will use the built-in oscillator of PIC16F688 so that we don&#8217;t have to provide an external oscillator circuit. This frees up two port pins (2 and 3) that can be used for I\/O purpose.<\/p>\n<p>There are many circumstances when you may want to reset the microcontroller and force the program execution to restart from the beginning. This can be achieved by connecting an external reset button to the MCLR (Master Clear) pin of PIC16F688 as shown in Figure 2. Normally, the MCLR pin is at logic 1, and it goes to logic 0 when the reset button is pressed. The logic 0 at MCLR pin resets PIC16F688. When the button is released, the microcontroller operates normally, executing instructions from the beginning of the program memory. However, the MCLR pin can also be disabled and used just as an I\/O pin through software (will see it later).<\/p>\n<p>PIC16F688 can be programmed serially (while in the target circuit) through two pins: <em>ICSPDAT (RA0, 13)<\/em>, and <em>ICSPCLK (RA1, 12)<\/em>. This technique is known as <em>in circuit serial programming<\/em> (ICSP). During ICSP, the MCLR\/Vpp pin is driven to approximately 13V by the programming device. Therefore, the application circuit must be isolated from this high voltage. In our case, the 10K resistor connected between the +5V power supply and \u00a0MCLR\/Vpp will prevent any voltage conflict during programming. Don&#8217;t ever press the reset button while the microcontroller is being programmed. <em><span style=\"color: #ff0000;\"><strong>That&#8217;s\u00a0dangerous, never do that<\/strong><\/span><\/em>. The\u00a0RA1\/ICSPCLK pin is the clock line driven by the programming device during ICSP, and RA0\/ICSPDAT is\u00a0the bidirectional data line which is driven by the programmer\u00a0when programming, and by PIC16F688 when verifying. These pins must be isolated from the\u00a0rest of the application circuit so as not to affect the signals\u00a0during programming.<\/p>\n<p>Besides, a 100 nF capacitors serves as the decoupling capacitor and should be placed close to the microcontroller. See the pictures below that show the whole arrangement made on the breadboard.<\/p>\n<p style=\"text-align: center;\"><a rel=\"attachment wp-att-707\" href=\"http:\/\/embedded-lab.com\/blog\/?attachment_id=707\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-707 aligncenter\" title=\"Image_BasicSetUp_PIC16F688\" src=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2010\/10\/Image_BasicSetUp_PIC16F688.jpg\" alt=\"\" width=\"528\" height=\"381\" \/><\/a><\/p>\n<p style=\"text-align: center;\">Figure 3: PIC16F688 with minimum support components on the breadboard.<\/p>\n<p style=\"text-align: center;\"><a rel=\"attachment wp-att-613\" href=\"http:\/\/embedded-lab.com\/blog\/?attachment_id=613\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-613 aligncenter\" title=\"SetupWithPower\" src=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2010\/10\/SetupWithPower.jpg\" alt=\"\" width=\"580\" height=\"326\" srcset=\"https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2010\/10\/SetupWithPower.jpg 580w, https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2010\/10\/SetupWithPower-550x309.jpg 550w\" sizes=\"auto, (max-width: 580px) 100vw, 580px\" \/><\/a><\/p>\n<p style=\"text-align: center;\">Figure 4: Basic PIC16F688 circuit with a +5V power source plugged into the breadboard.<\/p>\n<p style=\"text-align: center;\">\n<p style=\"text-align: center;\"><a rel=\"attachment wp-att-616\" href=\"http:\/\/embedded-lab.com\/blog\/?attachment_id=616\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-616 aligncenter\" title=\"SetUpWithProgrammer\" src=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2010\/10\/SetUpWithProgrammer.jpg\" alt=\"\" width=\"580\" height=\"437\" srcset=\"https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2010\/10\/SetUpWithProgrammer.jpg 580w, https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2010\/10\/SetUpWithProgrammer-550x414.jpg 550w\" sizes=\"auto, (max-width: 580px) 100vw, 580px\" \/><\/a><\/p>\n<p>Figure 5 : Basic PIC16F688 setup circuit with a +5V power source and the programmer plugged into the breadboard.<\/p>\n<p style=\"text-align: left;\">Now you are pretty much set with the required hardware and software, and you are ready for your first experiment with PIC.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is to be followed after you have successfully completed the following steps: Installed mikroC Pro for PIC on your PC. Installed the programmer software that came with your PIC programmer. If you have got an iCP01 USB PIC programmer from iCircuit Technologies, you should install Microchip&#8217;s PICkit programming software. Got a breadboard and a regulated +5V power source. Basic setup on the breadboard As mentioned before all the experimental circuits will be constructed on the breadboard because it is easy to modify the circuit and correct any wiring error. Figure 1 shows the pin diagrams of PIC16F688. It is<\/p>\n","protected":false},"author":2,"featured_media":612,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[32,29,38],"tags":[39,20,1308],"class_list":["post-190","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-embedded-labs","category-embedded-lessons","category-pic-tutorials","tag-breadboard","tag-pic16f688","tag-power-supply"],"_links":{"self":[{"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/posts\/190","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/comments?post=190"}],"version-history":[{"count":38,"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/posts\/190\/revisions"}],"predecessor-version":[{"id":5858,"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/posts\/190\/revisions\/5858"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/media\/612"}],"wp:attachment":[{"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/media?parent=190"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/categories?post=190"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/tags?post=190"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}