Start pic programming with mikroc for beginners

January 4, 2009 by
Filed under: Uncategorized 

Write your first program in mikroc

MikroC is a powerful, feature rich development tool for PICmicros. PIC andC fit well together: PIC is the most popular 8-bit chip in the world, used in a wide variety of applications, and C, prized for its efficiency, is a natural choice for developing microcontroller applications. MikroC provides a successful match featuring highly advanced IDE, ANSI compliant compiler, broad set of hardware libraries, comprehensive documentation, and plenty of ready to run example programs.


· Familiar with interface

· Create new project

· Write codes

· Compile


Familiar with mikroc interface


interface

Write your C source code using the built-in Code Editor (Code and Parameter

Assistants, Syntax Highlighting, Auto Correct, Code Templates, and more…)

Below is the complete list of keyboard shortcuts available in mikroC IDE. You can

also view keyboard shortcuts in Code Explorer window, tab Keyboard.

KEYBOARD SHORTCUTS

IDE Shortcuts

F1 Help

CTRL+N New Unit

CTRL+O Open

CTRL+F9 Compile

CTRL+F11 Code Explorer on/off

CTRL+SHIFT+F5 View breakpoints

Basic Editor shortcuts

F3 Find, Find Next

CTRL+A Select All

CTRL+C Copy

CTRL+F Find

CTRL+P Print

CTRL+R Replace

CTRL+S Save unit

CTRL+SHIFT+S Save As

CTRL+V Paste

CTRL+X Cut

CTRL+Y Redo

CTRL+Z Undo

Advanced Editor shortcuts

CTRL+SPACE Code Assistant

CTRL+SHIFT+SPACE Parameters Assistant

CTRL+D Find declaration

CTRL+G Goto line

CTRL+J Insert Code Template

CTRL+<number> Goto bookmark

CTRL+SHIFT+<number> Set bookmark

CTRL+SHIFT+I Indent selection

CTRL+SHIFT+U Unindent selection

CTRL+ALT+SELECT Select columns

Debugger Shortcuts

F4 Run to Cursor

F5 Toggle breakpoint

F6 Run/Pause Debugger

F7 Step into

F8 Step over

F9 Debug

CTRL+F2 Reset

First program

Your first program is that make a LED blinking program. LED ON after 500ms and OFF after 500ms. You can simulate this program using real circuit or using simulation software. (Download simulate software Proteus 7.1 full)

Shall we start our first program

This is the our circuit

circuit1

Create new project

The easiest way to create project is by means of New Project Wizard, drop-down

menu

Project > New Project.

Just fill the dialog with desired values (project name and description, location, device, clock, config word) and mikroC will create the appropriate project file. Tick cp_off, xt_osi, wdt_off.

cp_off – you not going to protect your code.

xt_osi – you use external oscillator

wdt_off – don’t think now

new-project

Write codes

Write following codes in code widow

void main()

{

PORTB = 0;

TRISB = 0;

While(1)

{

PORTB = ~PORTC;

Delay_ms(1000);

}

}


Compile codeings

Press compile button

compile

If your code successfully compiled Error window show as below


succesful

IF error occurs Error widow show as below

error

If error occurs, copy given code carefully in to code window and again compile

Output Files

Upon successful compilation, mikroC will generate output files in the project folder

(folder which contains the project file .ppc). Output files are summarized

below:

Intel HEX file (.hex)

Intel style hex records. Use this file to program PIC MCU.

How write hex file in to pic? Read


Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google

Comments

4 Comments on Start pic programming with mikroc for beginners

  1. KattyBlackyard on Mon, 15th Jun 2009 1:38 am
  2. The article is ver good. Write please more

  3. Joyhoreobrent on Sat, 26th Dec 2009 2:32 pm
  4. Good day

    Before anything else, i will like to give my tumbs up to the admins for running such an amazing place !
    Now that begin said i will like to ask if there is someone who can help me to find a good place to watch Family
    Guy Episodes Online Free, really love this show and because of my work i miss always the Family Guy Shows
    I know only one place to watch family guy episodes oline, but i dont know, let me know what do you think.

  5. Kylie Batt on Tue, 4th May 2010 11:43 pm
  6. ?????????? ??? ?????????? ????, ? ???????? ??????????? ?????? ?? ???????????? ??? ????….

    ????? ? ????????? ?????????; * ???????? 6.1 MikroC provides a […….

  7. dimajak-700 on Tue, 18th May 2010 6:26 am
  8. dimajak-700…

    ???????, ????? ???? ?? ???????http://cook495.ru/, ????? ????????? ? ??????????? ??? ???????…

Tell me what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!