PIC 16f648a programming by C

Discussion in 'Embedded Systems and Microcontrollers' started by Kurdo, Jun 21, 2012.

  1. Kurdo

    Thread Starter New Member

    Jun 21, 2012
    Hello everyone :)

    I am new in the field of embedded systems which essentially needs knowledge about PIC and how to program it.

    My first assignment is to let a two LEDs works, I have knowledge about C programming, moreover I downloaded the MPLAB and PRESTO so everything is ready.

    BUT my problem that I don't know from where I have to start and what is the syntax of C language in case of programming PIC.

    Please, can anyone help me with this very beginner assignment? I need to know how to write my code

    A lot of thanks
  2. MrChips


    Oct 2, 2009
    There should be an demo led program somewhere.
    Kurdo likes this.
  3. t06afre

    AAC Fanatic!

    May 11, 2009
    The different brands C compilers. Have all somewhat different syntax. Which are you using
    Kurdo likes this.
  4. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    Microchip has some excellent beginners tutorials for their parts at this link. The tutorial will walk you thru all the steps to create a project, write and compile the code, then load it into the PIC. Follow the link and go grab both of these:

    PICkit 3 Debug Express Lesson Files

    PICkit 3 Debug Express Lessons User's Guide

    And while you're at it you should order the hardware kit too. You get a board with buttons and LEDs and a pot to experiment with, and a programmer/debugger that works with all their devices, all for $70

    You *will* need a programmer/debugger and this one is a very good choice. (If you come back and tell us you got some programmer clone kit off EBay I ain't gonna talk to you no more ;)).
    Kurdo likes this.
  5. Kurdo

    Thread Starter New Member

    Jun 21, 2012
    Thank you very much for reply. I am using either CCS C compiler or HI-TECH PICC, both of them installed with MPLAB
  6. Kurdo

    Thread Starter New Member

    Jun 21, 2012
    THank you very much , I have at the moment PRESTO in the Lab I guess that I have to connected to PIC then program it. but I need to write the code which lets the LED once ON then OFF :)
  7. takao21203

    AAC Fanatic!

    Apr 28, 2012
    I suggest reading the datasheet for this PIC, or 16f54 it's less to read.

    The I/O is kind of memory mapped, they are 8 bit only (for registers), but variable declarations/branching/condition testing are not much different from standard C.

    There is a specific .h file for each PIC which you also should examine.

    The new MPLAB X will create a framework already when you start a new project, providing the main function + include. Easier than MPLAB 8 etc.