|
|
View previous topic :: View next topic |
Author |
Message |
burnsy
Joined: 18 Oct 2003 Posts: 35 Location: Brisbane, Australia
|
18F452 Just won't fire up |
Posted: Sun May 08, 2005 2:30 pm |
|
|
Hi, I have extensive experience with the 16F series, but just can't get my 18F452 to go. Does anyone have a SIMPLE program, that might toggle a port pin, so I can see it operate?
I am using it in a board which used to have a 16F877. VCC = 5V. It has a 3.6864MHz resonator (3 pin with caps inc). MCLR has a 4k7 pullup, and a 0.1uf cap to earth. My compiler version is PCH 3.156.
I have looked all over this forum for answers but can't seem to get any of it to translate into a result. Any help would REALLY be appreciated.
_________________ This is the last code change until its ready.... |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun May 08, 2005 3:02 pm |
|
|
The following program should work. I don't have your version of PCH.
I tested this with vs. 3.188.
Note that if you're using ICD2, they don't want you to put any caps
on the MCLR pin. Also note that the 18F452 data sheet says that in
some cases, a resonator may require HS mode instead of XT.
Code: | #include <18F452.h>
#fuses XT, NOWDT,NOPROTECT, PUT, BROWNOUT, NOLVP
#use delay(clock = 3686400)
//========================================
void main()
{
while(1)
{
output_high(PIN_B0);
delay_ms(500);
output_low(PIN_B0);
delay_ms(500);
}
} |
|
|
|
treitmey
Joined: 23 Jan 2004 Posts: 1094 Location: Appleton,WI USA
|
|
Posted: Mon May 09, 2005 2:14 pm |
|
|
Quote: | 3.6864MHz resonator | may be getting close to the 4MhZ crossover to the HS setting.
Try HS in the fuse
#fuses HS, NOWDT,NOPROTECT, PUT, BROWNOUT, NOLVP |
|
|
Humberto
Joined: 08 Sep 2003 Posts: 1215 Location: Buenos Aires, La Reina del Plata
|
|
Posted: Mon May 09, 2005 3:09 pm |
|
|
One of the best features of PIC + CCS is portability and flexibility.
I made a debugging board to adapt the 16F8xx & 18F4x2 to the ICD.
Changing only one jumper AND selecting the processor family
it is possible to start running with any of them.
This is the common header:
Code: |
#case
//#define PIC16 Cambiar Jumper interface ICD !!!
#define PIC18 // Cambiar Jumper interface ICD !!!
#ifdef PIC16
#include <16F877.H>
#device ICD=TRUE
#fuses NOWDT,XT, NOPROTECT, BROWNOUT, PUT, DEBUG, NOLVP
#else
#include <18F452.H>
#device ICD=TRUE
#fuses NOWDT,WDT128,XT, NOPROTECT, NOOSCSEN, BROWNOUT, BORV20, PUT, STVREN, \
NODEBUG, NOLVP, NOWRT, NOWRTD, NOWRTB, NOWRTC, NOCPD, NOCPB,
\NOEBTR, NOEBTRB
#endif
#define Xtal 4000000
#use delay(clock=Xtal)
#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,enable=PIN_C5,bits=8,errors)
|
If you are using ICD, be aware that 18F use different pinīs than 16F.
Hope this help you,
Humberto |
|
|
burnsy
Joined: 18 Oct 2003 Posts: 35 Location: Brisbane, Australia
|
Thanks |
Posted: Thu May 19, 2005 11:47 pm |
|
|
Thanks for your help everyone. The code snippet Pcm Programmer worked first time. Now to try and get the rest going.
Thanks again _________________ This is the last code change until its ready.... |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|