Maker Pro
Maker Pro

PIC 18F device has odd fade-in delay?

P

Peter S. May

Jan 1, 1970
0
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
 
J

Jan Panteltje

Jan 1, 1970
0
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.

Did you initinalise the delay loop 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.
 
S

Spehro Pefhany

Jan 1, 1970
0
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

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

Best regards,
Spehro Pefhany
 
Top