PDA

View Full Version : blink.bas help cant make any 18f's work



Bonxy
- 13th December 2004, 19:00
Hi everyone

Im not new to pbp or making programs for the 16f877 but i am new to the 18f series pic's

I cant get anything to work on a 18f452 :-(

im using pbp 2.45, epic 2.44 and labx1 board

I compile a program for a 16f877 and it works fine

i compile a program for a 18f452 (even the blink.bas) and it will not work.
the code seems to go into the chip (cos i can read it back)

can anyone send me a code snipet that will definatley work with a 18f452.

Heeeelllllpp, its driving me nuts, what am i doing wrong ???

Bruce
- 13th December 2004, 20:13
How do you have your X1 oscillator configured?

I.E. what position are jumpers ABC in?

Bonxy
- 13th December 2004, 20:23
Hi Bruce

they are set at A=1+2 B=2+3 C=2+3 set at 8mhz i think

-----------
Bri

Bruce
- 13th December 2004, 20:38
Yep that should set it for 8MHz.

1. You'll need to set the osc config fuse for HS
2. Be sure you're using MPASM as the assembler.
3. Be sure to select the 18F452 at compile time.
4. Make sure your programmer is not changing any config fuse
settings before you program the 18F.

The PBP header file for this particular PIC has default config fuse settings. I think it's set for XT which is only good for up to 4MHz.

Open your 18F452.INC file found in your PBP INC file directory.

Make the change (shown below), save, exit, re-compile, and program your 18F on your LAB-X1. Should work fine.

INCLUDE "P18F452.INC" ; MPASM Header
;__CONFIG _CONFIG1H, _OSCS_OFF_1H & _XT_OSC_1H
__CONFIG _CONFIG1H, _OSCS_OFF_1H & _HS_OSC_1H
__CONFIG _CONFIG2H, _WDT_ON_2H & _WDTPS_128_2H
__CONFIG _CONFIG4L, _LVP_OFF_4L

Note: Just comment out the 1st line shown above, and enter the next one with the _HS_OSC_1H.

That sets your config fuse up for the higher oscillator speed. The simple blink program below should work fine.


DEFINE OSC 8

Main:
HIGH 0
PAUSE 250
LOW 0
PAUSE 250
GOTO MAIN

Bonxy
- 13th December 2004, 20:49
Bruce

Thanks for taking the time to help me, i realy apreciate it.
I will go now to try the things you suggest.

I feel like a newbie again, lol :-).
I've been away from the pic scene for over a year and have just upgraded my pbp and epic in atempt to get back into it.

As ever, you and the guys, and gal i belive, have come to my swift rescue.

Thanks again
I'll let you know if it works
----------------------
Bri

Bonxy
- 13th December 2004, 21:13
Thanx Bruce

I changed the INC file like you said and it didnt work, then i changed the epic configuration to HS and it worked!! :-)

Thanks a lot Bruce
------------------------
Bri

Bruce
- 13th December 2004, 21:28
You can fix that under the EPIC Options menu.

Place a check mark next to;

Program/Verify Configuration
Update Configuration
Reread File Before Programming

Another option you'll want checked is;

Erase Before Programming