View previous topic :: View next topic |
Author |
Message |
qleyo
Joined: 23 Aug 2005 Posts: 22
|
pic18f452 and 184520 please help |
Posted: Fri Mar 10, 2006 8:40 am |
|
|
Hi,
I am using the PIC18F452-I/P chip, I have the CCS PCWH compiler, and in the devices folder there is no device header file for the 18F452, there is only one for the 4520.
I have used the 18f4520 header anyway, and my program isn't running (i'm also trying to use the internal oscillator for the first time so perhaps this might the cause, i've written a very simple program and it doesnt run), I know that there are difference with the ADCON1 and so on, what do I do?? Is there a way to get the 452 header file?
Thanks.
My code for the simple test program
Code: |
#include <18F4520.h>
#fuses NOWDT,INTRC_IO, NOPUT, NOMCLR, BROWNOUT, NOCPD, NOWRT, NODEBUG, NOPROTECT, FCMEN, IESO
#use delay(clock=4000000)
void main()
{
setup_oscillator(OSC_4MHZ);
setup_comparator(NC_NC_NC_NC);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
/***start test sequence***/
while(TRUE)
{
output_high(PIN_A0);
delay_ms(1000);
output_low(PIN_A0);
delay_ms(1000);
}
}
|
|
|
|
qleyo
Joined: 23 Aug 2005 Posts: 22
|
|
Posted: Fri Mar 10, 2006 9:25 am |
|
|
Ok apologies, I found the 18F452.h file. It doesnt seem to have setup oscillator parameters i.e. OSC_4MHZ I copied and pasted the defines from another header file.
However, my code still does not work. |
|
|
MikeValencia
Joined: 04 Aug 2004 Posts: 238 Location: Chicago
|
|
Posted: Fri Mar 10, 2006 9:27 am |
|
|
I don't think the '452 has an internal oscillator. |
|
|
rnielsen
Joined: 23 Sep 2003 Posts: 852 Location: Utah
|
|
Posted: Fri Mar 10, 2006 11:29 am |
|
|
The 452 does Not have an internal oscillator. It requires and external clock source of some kind. If you have the Compiler IDE, look at Valid Fuses, in the View menu, to see what fuses you can use.
Ronald |
|
|
qleyo
Joined: 23 Aug 2005 Posts: 22
|
|
Posted: Tue Mar 14, 2006 7:32 am |
|
|
:'( oh my goodness
So i need an external RC :'( I'm losing my mind! |
|
|
MikeValencia
Joined: 04 Aug 2004 Posts: 238 Location: Chicago
|
|
Posted: Tue Mar 14, 2006 1:57 pm |
|
|
Well why don't you just use the 4520 then? They are similiar enough, and Microchip wants you to use the 4520 for new designs instead of the 452 |
|
|
qleyo
Joined: 23 Aug 2005 Posts: 22
|
|
Posted: Thu Mar 16, 2006 4:30 am |
|
|
I would have sworn I ordered the 4520 but obviously got the 452, uni pays for all this stuff so I can't exactly just order another one :(
On the contrary they had a 4mhz crystal lying around, and I managed to get a millenium board off the component store, so I chucked that in and now working on a prototype before I revisit trying to get my hardware to work.
And to think I've been looking at the 4520 datasheet for the last 3 months :s
Now to my AT commands problem :'( |
|
|
SLomas Guest
|
|
Posted: Thu Mar 16, 2006 5:39 am |
|
|
If the cost of buying the 4520 is a problem then try samples from Microchip. This service is provided to allow us to evaluate the devices. The price is right (gratis) and the delivery is normally pretty good. Just don't abuse the service otherwise they might restrict it. |
|
|
|