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.

Get starting with pic18f452

Status
Not open for further replies.
It hard to say if you could draw out how you hooked your chip up would help. from what your saying your chips not coming on. Are you using the demo of CCS if you are how you getting it to work with 18f452
 
Do you have access to a hardware debugger like an icd2 or pickit2? Are you sure the crystal is working? Decoupling caps? Pullup on mclr? Can you get a 18F4620 (internal osc)?
 
If you your using the download CCS it has limited support for the 18fxxx chips
 
I was just making sure. It has to be hardware. It sounds like the chip is not starting up. CCS has support for your chip but the free download didn't have the files in it to set up your chip now your friend may of added that to his and that's why I was asking. I downloaded CCS and will try it out and see.
 
Last edited:
I think I found why your chips not coming on
Code:
#elif defined(__PCH__)
#include<18f452.h>
#fuses XT,NOWDT,NOPROTECT,NOPUT ,NOBROWNOUT
#use delay(clock=400000) 
void main()
{
set_tris_b(0);
while(1)
{
output_b(255);
delay_ms(1500);
output_b(0);
delay_ms(1500);
}
}
 
Last edited:
It's a compiler directive. It allows you to include different libraries or change other compiler directives depending on certain other defines. It appears incomplete (which is why you're gettign the error) If you copied your code and modified it from someone elses project you may have forgotten to delete it. Just erase it and forget about it, doesn't have any relation to the rest of the code you posted.
 
I don't use CCS but I installed it I use C18 and microC and H-tk
But from what I read that line tell which compiler for chip set. Like 18fXXX your using and then the next is the 18f452.h header file to use for the chip. I maybe wrong but. CCS has from what I read three
compiler one for 12fxxx and 16fxxx and one for the 18fxxx and then the 32 and there sample programs all start with that Line. So you may just not have CCS setup right Your using a comand line compiler with mplab it needs to use the PHC to build for a 18fxxx chip Now how you do that I don't no right now I thought it would work like that by just adding it to your code the way CCS ide did it
 
Its a directive to tell how to build for his chip The CCS uses it as the first line on all of there samples just like I posted it. Thats the samples for there ide with mplab I say there a scrip that needs to load the commands to build for the 18fxxx and he doesn't have that installed.
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top