----- Original Message ----- > > Date: Mon, 3 Jul 2006 23:10:50 +1000 > From: "Josh Green" > Subject: RE: [PIC]Redesigning for 16F88 (instead of 16F84A) > I have tried disabling every interupt I can (without losing the timer0 > interupt) by doing the following: > RBIE =0; //Disable change on port B interupts > INT0IE =0; //Disable external interupt pin > PEIE = 0; //Disable peripheral interupts > TMR0IE = 1; //Enable TMR0 interupt > GIE = 1; //Enable all selected interupts Since you are evidently using the timer interrupt, you can't turn off GIE, so you MUST disable or handle all the other sources of interrups. The 16F88 datasheet says "The PIC16F87/88 has up to 12 sources of interrupt.". I don't count 11 things you have disabled. A stray interrupt could cause the sort of behavior you describe. (Most of those 11 probably default to disabled, but check anyway!) Another poster pointed out that you don't want to just arbitrarily disable all the analog peripherals. If you have a pin which COULD be analog, and you leave that pin floating, or at some intermediate value, and you have defined the pin as a digital input (i.e. disabled the analog and NOT made it an output), then the pin could draw excessive current. This can even potentially damage the chip, but depending on your supply, could also simply cause erratic operation. This is why those analog pins default to analog. Several posters suggested the 648A instead of the 88. There are quite a number of 18 pin alternatives, also the 818/819, 716, 628A and on and on. The 88 is a very capable part, far more capable than the 648A, and from hobbyist sources, it is only barely more expensive than the 648A. It's hard to think of the 88 as expensive when it costs half what an 84A costs. Sure, if you are going to buy a few hundred thousand of them, the extra few cents matters, but when the shipping costs twice what the part costs, why save a few pennies (well, OK, maybe 50 cents) and get a less flexible part? $2.60 is hardly going to break the bank. I've used 88's as F84 replacements with few issues. I'm sure there is something terribly obvious, but when you are using a compiler, if the compiler doesn't handle all the issues for you, then uncovering them can be a bit of a challenge. People say that the compiler lets you move between parts more easily, and perhaps after you've done it a few dozen times that might be true. But until you -really- understand what the compiler is doing to you, you always need to be suspicious that something is happening that you aren't aware of. I would compare the emitted code between the 84 and 88 and look for anything suspicious. In particular watch for places where the registers are in different locations between the processors. It is quite possible that the compiler hasn't been all that well tested on all parts ... there are a LOT of possibilities. --McD -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist