Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Microchip C18 #include question

Status
Not open for further replies.

binzer

Member
I am trying to get started with C18 and I am curious about the #include <p18Cxxx.h> statement. Does this give you access to all of the default device i/o ports, and would I need to also do an include for my specific processor #include <p18f4550.h> to get access to things specific to this processor.
tnx.mike.
 
The p18Cxxx header file is for a different processor. You'll need to #include <p18f4550.h> to define labels for that particular chip (i.e. PORTA, PORTB, etc.)
 
You ONLY need p18f4550.h if your project is going to be a specific pic .. p18Cxxx.h is a generic pic18 header file

Ok, that's what I was thinking. So the p18Cxxx.h would include the things that would be 'general' to all pics, like PortA and PortB but not a Usart(hardware) as it's not included in all pics..
 
Sometimes Microchip uses the " ifdef p18Cxxx " when talking about pic18 as opposed to pic24 or pic33 so I've always assumed it was a generic header.... When you open it up, it lists all pic18's and includes the right header anyway..
 
I figured that was the header file for processors like the PIC18C442 and the PIC18C452 (hence the p18Cxxx--the x's take place of the last three numbers in the processor). I think that's a header for a different chip family. You don't need it at all for the 4550.
 
I figured that was the header file for processors like the PIC18C442 and the PIC18C452 (hence the p18Cxxx--the x's take place of the last three numbers in the processor). I think that's a header for a different chip family. You don't need it at all for the 4550.

Actually like Ian said it's a generic thing, I did look at the file but still had questions, and I'm a bit rusty..

From VT, I'll be up there in a couple weeks to hike the first section of the Long Trail.
 
Sometimes Microchip uses the " ifdef p18Cxxx " when talking about pic18 as opposed to pic24 or pic33 so I've always assumed it was a generic header.... When you open it up, it lists all pic18's and includes the right header anyway..

Yup, I did open up that header and look at it a few days ago, I was still a tad confused, I haven't really done programming since my last job (over 10 yrs ago).

I did do a little .asm stuff when I bought my Junebug about 2 yrs ago but want to try my hand at .c .

I am running Mplab in a Win Xp VM under Linux.

Thanks Ian...
 
Actually like Ian said it's a generic thing, I did look at the file but still had questions, and I'm a bit rusty..

Well, that is good to know. Thanks =)

From VT, I'll be up there in a couple weeks to hike the first section of the Long Trail.

You know, I haven't even had the chance to do that myself....
Let us know how it goes--take a lot of photos :D
 
DS8! hows the mplabX coming on? I see they have a new version on the microchip site... I wonder if it's stable yet..

I'm not sure this is the best place to ask--You might be given unclejed's 'Yosemite Sam Award' :D:D
But to answer your question, the last time I installed MPLAB X (it was quite recently--within the past couple of weeks) it still had a lot of bugs. It still works, it's just that there are some pieces of code that it just doesn't really like. I'm not sure when it will all be fixed.
 
you mean MikroC? Yeah, there is. Saved me a lot of trouble. Config this, config that, all the BS shoved under the rug.

Hmm, That sounds like something I should look into. I just printed out some info from the help files included with C18 and the tags ( FOSC = INTOSC_HS ) come up as invalid/error, why are they in the help file if they are not the correct information. I have been going one step forward and 2 steps back. I was going to look into Hi-Tech but I don't see any info on how to talk to the i/o stuff (adc, usart,ports) in their docs.

Do they also have a program similar to Mplab??
 
Last edited:
The thing about C18...If you need to know a " parameter " or a "definition" you need to hunt down the .h file and search through it... @Vizier! does it make a decent COFF file for use in ISIS?

Well there is what is in the "manual" that you can download, what is in the help files that come with the compiler, and what is in the .h file, none match!!!!
 
The thing about C18...If you need to know a " parameter " or a "definition" you need to hunt down the .h file and search through it... @Vizier! does it make a decent COFF file for use in ISIS?

Hi Ian,
I'm not sure about ISIS since I've never used it, but here are the files generated, probably they're sufficient for your simulation?:

**broken link removed**

The nice part is you can configure the Config part (Prescaler, Postscaler, WDT, HS/XT/RC, etc.) in one window (Project>>Edit Project) and change 'em accordingly.

I'm using v4.15. They have it up to v5.1 now, but here's a free 2 kb-word limit:
https://www.mikroe.com/eng/downloads/get/29/mikroc_pro_pic_2011_v501.zip

Anyway I'm sure they have lots of cracked ones already. Mine's unlimited I think. :D
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top