PIC 18F device has odd fade-in delay?

I've successfully programmed PIC 16F-series MCUs since the summer, but just started messing with an 18F2450 and an 18F2550. I've put some simplistic Hello World firmware on the chip, whereby PORTB is incremented once after a delay loop, repeating ad infinitum. I have two LEDs connected via 1K resistors to RB0 and RB1. (TRISB = 0, ADCON0 = 0, MCLR disabled.)

When I apply power to the circuit, the LED on RB0 seems to take a few seconds (longer than the program's delay loop) to fade in at first. After that, the program runs normally.

I thought it might be the fact that I was using a 20MHz crystal on a breadboard, so I removed the crystal and configured the device for internal oscillator. I also thought it might have something to do with the ATX power supply I was using, so I tried batteries instead. Neither fixed the problem.

Also, the same problem occurred with both the '2450 and the '2550 I used, so it seems as if it's not a problem with the chip itself.

Along the lines of firmware and/or application circuit, what else should I try?

Thanks PSM

Reply to
Peter S. May
Loading thread data ...

On a sunny day (Wed, 19 Dec 2007 10:37:35 -0500) it happened "Peter S. May" wrote in :

Did you initinalise the delay loop[s] with zero and fist decrement or something? Then it would first go to say 255 (for 8 bit registers). I am referring to the original value at power up of the variables in RAM. Looks like software to me.

Reply to
Jan Panteltje

You should increment LATB not PORTB, or use a shadow variable.

Best regards, Spehro Pefhany

--
"it\'s the network..."                          "The Journey is the reward"
speff@interlog.com             Info for manufacturers: http://www.trexon.com
Embedded software/hardware/analog  Info for designers:  http://www.speff.com
Reply to
Spehro Pefhany

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.