Are you using the internal OSC? If so are the boards running in a hot environment?
Are you using the internal OSC? If so are the boards running in a hot environment?
Dave
Always wear safety glasses while programming.
No, external ceramic resonator.
Boards can sometimes get hot but are designed to turn off the output if an overt emp is detected.
I got bit by this phenomena once on my first '18F' series parts after years of using '16F' parts.
Turns out I didn't have both pins of the oscillator set up correctly. One was set for OSC IN but the other was inadvertantly configured for GPIO. It worked fine on my desk for months during development but would inexplicably drop to the internal slow oscillator in the field.
Check the "Clock Sources and Oscillator Switching" section of your data sheet.
The following is for a different device than yours but illustrates the issue.
...includes a feature that allows the
device clock source to be switched from the main
oscillator to an alternate low-frequency clock source.
PIC18F2525/2620/4525/4620 devices offer two alternate
clock sources. When an alternate clock source is enabled,
the various power managed operating modes are
available.
Essentially, there are three clock sources for these
devices:
• Primary oscillators
• Secondary oscillators
• Internal oscillator block
...The secondary oscillators are those external sources
not connected to the OSC1 or OSC2 pins. These
sources may continue to operate even after the
controller is placed in a power managed mode.
The fuses are set right and the program performs exactly the same if I set it up for internal RC.
Here is the code with everything removed except the LCD related stuff. I cant show the actual code used in the product. It appears to be none code related though as this is a very stripped piece of code that should have no problems.
DEFINES are the same, ports are the same.
DEFINE OSC 10
DEFINE LCD_DREG PORTB ' Set LCD Data port
DEFINE LCD_DBIT 4 ' Set starting Data bit (0 or 4) if 4-bit bus
DEFINE LCD_RSREG PORTB ' Set LCD Register Select port
DEFINE LCD_RSBIT 2 ' Set LCD Register Select bit
DEFINE LCD_EREG PORTB ' Set LCD Enable port
DEFINE LCD_EBIT 3 ' Set LCD Enable bit
DEFINE LCD_BITS 4 ' Set LCD bus size (4 or 8 bits)
DEFINE LCD_LINES 2 ' Set number of lines on LCD
DEFINE LCD_COMMANDUS 2000 ' Set command delay time in us
DEFINE LCD_DATAUS 50 ' Set data delay time in us
DEFINE ADC_BITS 10
DEFINE ADC_CLOCK 3
DEFINE ADC_SAMPLEUS 50
ADCON1 = %01000000
ADCON2 = %10111111
TRISA = %11111111 'All inputs
TRISB = %00000000 'PORTB.1 is output to flash heartbeat LED
PAUSE 1000
LCDOUT $FE, 1
LCDOUT $FE, 2, "HELLO"
LCDOUT $FE, $C0, "WORLD"
Loop:
PORTB.1 = 1
LCDOUT $FE, 1
PAUSE 500
LCDOUT $FE, 2, "LED 1"
LCDOUT $FE, $C0, "I=123456"
PAUSE 1000
PORTB.1 = 0
PAUSE 500
Goto loop
Last edited by jmgelba; - 16th December 2010 at 22:13.
Meaning no disrespect . . . how about you let US see those fuse settings, you know . . fresh eyes.
esp.is this in there?
Code:_FSCM_OFF_1H ; Fail-Safe Clock Monitor disabled _IESO_OFF_1H ; Internal External Oscillator Switch Over mode disabled
Last edited by Archangel; - 17th December 2010 at 07:31.
If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
.
Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
.
There simply is no "Happy Spam" If you do it you will disappear from this forum.
Could it be some sort of corrosion between the OSC1 and OSC2 pins?
I've experienced something similar due to oxide formation between the pins . . .
No corrosion. And it will run slow if set for internal oscillator.
Bookmarks