{"id":997,"date":"2015-03-29T16:52:20","date_gmt":"2015-03-29T20:52:20","guid":{"rendered":"https:\/\/ve2cuy.wordpress.com\/?page_id=997"},"modified":"2015-03-29T16:52:20","modified_gmt":"2015-03-29T20:52:20","slug":"pic-18f-blink-a-led","status":"publish","type":"page","link":"https:\/\/ve2cuy.com\/blog\/index.php\/pic-18f-blink-a-led\/","title":{"rendered":"Proteus &#8211; PIC 18F Blink a LED"},"content":{"rendered":"<h1>Your first Proteus PIC project &#8211; Blink a LED on port RD2 of a\u00a018F4620<\/h1>\n<p>This is your first PIC project ever, blink a LED, yes, I know&#8230;<\/p>\n<p>But it&rsquo;s a great way to learn!<\/p>\n<p><a href=\"http:\/\/ve2cuy.com\/blog\/wp-content\/uploads\/2015\/03\/blink4.gif\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1002\" src=\"http:\/\/ve2cuy.com\/blog\/wp-content\/uploads\/2015\/03\/blink4.gif\" alt=\"blink4\" width=\"562\" height=\"476\" \/><\/a><\/p>\n<p><a href=\"https:\/\/drive.google.com\/uc?export=download&amp;id=0BwVyrqVfxGkRb1R2dV9sbWlGSXM\">Proteus project<\/a><\/p>\n<h1>The board version<\/h1>\n<p><a href=\"http:\/\/ve2cuy.com\/blog\/wp-content\/uploads\/2015\/03\/00058-1.gif\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1015\" src=\"http:\/\/ve2cuy.com\/blog\/wp-content\/uploads\/2015\/03\/00058-1.gif\" alt=\"00058 (1)\" width=\"598\" height=\"448\" \/><\/a><\/p>\n<h1>Source code<\/h1>\n<p>[sourcecode language=\u00a0\u00bbcpp\u00a0\u00bb]<br \/>\n\/\/ Main.c <\/p>\n<p>#include &lt;xc.h&gt;;<\/p>\n<p>\/\/ Default output frequency of INTOSC on Reset will be 1 MHz<br \/>\n#pragma config OSC=INTIO67 \/\/ use internal oscillator &#8211; Depending on your PIC this could be: #pragma config FOSC = INTOSC_EC<br \/>\n#pragma config LVP = OFF \/\/ Low-Voltage (Single-Supply) In-Circuit Serial Programming Enable bit (RB3 is digital I\/O, HV on MCLR must be used for programming)<\/p>\n<p>#define OUT 0<br \/>\n#define LED_PIN_DIRECTION TRISDbits.TRISD2<br \/>\n#define LED_PIN PORTDbits.RD2<br \/>\n#define END_OF_TIME 1<br \/>\n#define ON 1<br \/>\n#define OFF 0<br \/>\n#define _XTAL_FREQ 1000000 \/\/ needed for __delay_ms()<\/p>\n<p>\/\/ This is the program entry point<br \/>\nvoid main(void)<br \/>\n {<br \/>\n LED_PIN_DIRECTION = OUT;<br \/>\n while (END_OF_TIME) {<br \/>\n LED_PIN = ON;<br \/>\n __delay_ms(250);<br \/>\n LED_PIN = OFF;<br \/>\n __delay_ms(250);<br \/>\n } \/\/ while END_OF_TIME<br \/>\n } \/\/ main()<br \/>\n[\/sourcecode]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Your first Proteus PIC project &#8211; Blink a LED on port RD2 of a\u00a018F4620 This is your first PIC project ever, blink a LED, yes, I know&#8230; But it&rsquo;s a great way to learn! Proteus project The board version Source code [sourcecode language=\u00a0\u00bbcpp\u00a0\u00bb] \/\/ Main.c #include &lt;xc.h&gt;; \/\/ Default output frequency of INTOSC on Reset [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"open","ping_status":"open","template":"","meta":{"footnotes":""},"class_list":["post-997","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/ve2cuy.com\/blog\/index.php\/wp-json\/wp\/v2\/pages\/997","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ve2cuy.com\/blog\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/ve2cuy.com\/blog\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/ve2cuy.com\/blog\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ve2cuy.com\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=997"}],"version-history":[{"count":0,"href":"https:\/\/ve2cuy.com\/blog\/index.php\/wp-json\/wp\/v2\/pages\/997\/revisions"}],"wp:attachment":[{"href":"https:\/\/ve2cuy.com\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=997"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}