Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
LinkBack Thread Tools Display Modes
Old 21st November 2007, 02:48 PM   (permalink)
Default PIC18F & C Programming

HI,

I am wanting to start learning to program PIC's with C. I have a PIC18F252.
I have the ISP working. I am using MPLAB with C18 compiler.

What documents or tutrorials are available to learn how to address the USART and do A/D conversions using "C" ?

Any help would be greatly appreciated.
Mike
mikesmixes777 is offline  
Old 22nd November 2007, 04:50 AM   (permalink)
Default

There is some example code in the directory where you installed the C18 compiler:
C:\MCC18\example\users_guide
NOTE: You may need to have specified that the samples be included when you installed the C18 compiler.
Other useful things:
C:\MCC18\doc\periph-lib
C:\MCC18\example\getting_started
__________________
--- The days of the digital watch are numbered. ---

Last edited by kchriste; 22nd November 2007 at 04:54 AM.
kchriste is offline  
Old 22nd November 2007, 10:01 AM   (permalink)
Default

Have you used these modules before?

Well you can use a library function to set up the UART or ADC, which personally I do not recommend because if you don't understand everything it's doing to the letter then there's a significant chance you're not going to be using it right. If you DO know exactly what you want to do, then just assign the reg directly. That's what most people do.

I have always just looked up the module functionality and assigning them in C is straightforward:
ADCON=0b11110000;

You will probably need to write an interrupt handler, that's in a format specific to a particular C compiler. The syntax is different for PICC18 and MCC18.
__________________
I thought what I'd do was I'd pretend I was one of those deaf-mutes.
Oznog is offline  
Reply

Bookmarks

Thread Tools
Display Modes



Similar Threads
Title Starter Forum Replies Latest
Question about Inchworm+ Quan Micro Controllers 54 28th October 2007 01:21 AM
UNIT Committment solution using Dynamic programming arijit18 Electronic Projects 1 18th October 2007 09:28 PM
my first 16F88 has me stumped Hank Fletcher Micro Controllers 15 3rd August 2007 04:22 PM
Programming languages sram General Electronics Chat 9 2nd March 2007 05:15 PM
Good Computer Programming Book ThermalRunaway Chit-Chat 21 16th September 2005 11:05 PM



All times are GMT. The time now is 02:11 AM.


Electronic Circuits  |  Learning Electronics
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.

eXTReMe Tracker