PDA

View Full Version : 18F4550 not running



comwarrior
- 31st December 2010, 19:49
first off, Merry Christmas and happy new year to everyone on PB forum...

ok, this seems to be an ongoing problem i keep having with the 18F4550...
Various programs i've done to do different things... i always seem to have a problem getting the pic to run. I have to keep disconnecting the power and reconnecting untill it does.
When it doesn't run i seem to get ether intermittent repetitive (the same thing over and over and LED flashing rapidly etc) activity like the pic is resetting after a fraction of a second. or i get a complete lockup.

And yet, i wrote a program for a friend for the 16F610 and it runs first time without issues. same program (diferent fuse config) recompiled for the 18F4550 refuses to run most of the time.

But then when i get it to run, it happily runs for days...

Supply voltage, well, i've ran from 5V regulator (7805CV) and direct from Li-Pol battery (~3.8V)

Below is the fuse config and the osc setup. have i made a mistake somewhere?
Any advice appreciated.


@ __CONFIG _CONFIG1L, _PLLDIV_2_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L
@ __CONFIG _CONFIG1H, _FOSC_INTOSCIO_EC_1H & _FCMEN_ON_1H & _IESO_ON_1H
@ __CONFIG _CONFIG2L, _PWRT_ON_2L & _BOR_ON_2L & _BORV_3_2L & _VREGEN_OFF_2L
@ __CONFIG _CONFIG2H, _WDT_ON_2H & _WDTPS_256_2H
@ __CONFIG _CONFIG3H, _MCLRE_OFF_3H & _PBADEN_OFF_3H
@ __CONFIG _CONFIG4L, _STVREN_ON_4L & _LVP_ON_4L & _ICPRT_OFF_4L & _XINST_ON_4L & _DEBUG_OFF_4L

Define OSC 8 ' Set clock speed

OSCCON = %01110000

Thanks

ScaleRobotics
- 31st December 2010, 19:57
Try with XINST off and LVP off.


@ __CONFIG _CONFIG1L, _PLLDIV_2_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L
@ __CONFIG _CONFIG1H, _FOSC_INTOSCIO_EC_1H & _FCMEN_ON_1H & _IESO_ON_1H
@ __CONFIG _CONFIG2L, _PWRT_ON_2L & _BOR_ON_2L & _BORV_3_2L & _VREGEN_OFF_2L
@ __CONFIG _CONFIG2H, _WDT_ON_2H & _WDTPS_256_2H
@ __CONFIG _CONFIG3H, _MCLRE_OFF_3H & _PBADEN_OFF_3H
@ __CONFIG _CONFIG4L, _STVREN_ON_4L & _LVP_OFF_4L & _ICPRT_OFF_4L & _XINST_OFF_4L & _DEBUG_OFF_4L

Define OSC 8 ' Set clock speed

OSCCON = %01110000

comwarrior
- 31st December 2010, 21:01
ok, that worked first time...

So, the question is why?
LVP is low voltage programming, allows the chip to re-program itself without being supplied with 13.6V... i believe?
Xinst is the extended instruction set... don't know much about this other than what it's name implies...

I've had LVP turned off befor as i was trying to find out if it was something in the config... never turned off xinst... come to think about it, their is no 'enable' option for it in PBP so, how do you use it... ??? ... ??? lol

ScaleRobotics
- 31st December 2010, 21:11
ok, that worked first time...

So, the question is why?
LVP is low voltage programming, allows the chip to re-program itself without being supplied with 13.6V... i believe?
Xinst is the extended instruction set... don't know much about this other than what it's name implies...

I've had LVP turned off befor as i was trying to find out if it was something in the config... never turned off xinst... come to think about it, their is no 'enable' option for it in PBP so, how do you use it... ??? ... ??? lol

That's great!

LVP is something I have never used, and always seems to be a problem, so I turn it off. Of course others have better explanations. See http://www.picbasic.co.uk/forum/showthread.php?t=11880&p=79423#post79423

XINST is for the extended instruction list. The assembly commands above the normal 49 (or so). PBP is not capable of using the extended set (maybe some day), so we have to turn it off for PBP.

Walter

comwarrior
- 31st December 2010, 23:44
Quote from DT

But when LVP is enabled ... anytime RB5/PGM goes HIGH ... it's just like taking MCLR/VPP to 13V.
If it's left floating, the PIC could be constantly entering Program Mode from input noise.

i have a habit of letting unused pins float...
Perhaps i should tie all pins to ground with a 100K resistor... thats a lot of resisters though...
having said that... i have some hardware on order so that i can use ICSP and ICD so perhaps i will do it when i solder up the new sockets...

Bruce
- 1st January 2011, 00:15
Perhaps i should tie all pins to ground with a 100K resistor... thats a lot of resisters though...

No need to do that. Just make them all outputs, and you're good to go...:o

comwarrior
- 1st January 2011, 01:07
lol, ok, that works too...