PIC 16f648a programming by C

Thread Starter

Kurdo

Joined Jun 21, 2012
3
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
 

ErnieM

Joined Apr 24, 2011
8,377
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 ;)).
 

Thread Starter

Kurdo

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

Thread Starter

Kurdo

Joined Jun 21, 2012
3
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 :)
 

takao21203

Joined Apr 28, 2012
3,702
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.
 
Top