View previous topic :: View next topic |
Author |
Message |
cjusto
Joined: 26 Apr 2006 Posts: 38 Location: Portugal
|
Reset not Working with 18f4525 |
Posted: Thu Jul 20, 2006 4:33 pm |
|
|
Hi forum!!
i am using a 18f4525. i migrated from 16f877A.
with this new pic i can't reset it. what can be the problem??
i already tried fuse "MCLR". should this do something??
thanks |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Jul 20, 2006 4:48 pm |
|
|
Post a very small test program, that blinks an LED, for example.
Show all your #include, #use, and #fuses statements. Make
the program be compilable, but short. (Don't post 200 lines --
post 20 lines at most) |
|
|
cjusto
Joined: 26 Apr 2006 Posts: 38 Location: Portugal
|
|
Posted: Mon Jul 24, 2006 3:23 pm |
|
|
hi!!
here is it:
Code: |
#include <16F877A>
#include <stdio>
#include <math>
#use delay(clock=10000000)
#fuses NOWDT, HS, NOPUT, NOPROTECT, NODEBUG, BROWNOUT, NOLVP, NOCPD, NOWRT//, NOXINST
#use rs232 (baud=9600, xmit=PIN_C6, rcv=PIN_C7)
#include <boot_lcd>
#include <teclado>
//definição do teclado
//entradas teclado
#define key0 PIN_D0
#define key1 PIN_D1
#define key2 PIN_D2
#define key3 PIN_D3
#define key_av PIN_D4
BYTE buffer_teclas[5] = {0,0,0,0,0};
void main()
{
printf("this is my programm");
}
|
what is wrong with this? |
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Mon Jul 24, 2006 3:36 pm |
|
|
How about changing this line to reflect your new processor?......
This include file contains some processor specific defines like the #device=xxx directive which the compiler needs for locating the Special Purpose registers, Configuration bits, etc. |
|
|
cjusto
Joined: 26 Apr 2006 Posts: 38 Location: Portugal
|
|
Posted: Mon Jul 24, 2006 3:46 pm |
|
|
hi. sorry. i forgot that. i changed that to 16f877A to try if the reset button is working ok.
before that i had
shouldn't this code work ok? |
|
|
Guest
|
|
Posted: Wed Jul 26, 2006 2:59 pm |
|
|
cjusto wrote: | hi. sorry. i forgot that. i changed that to 16f877A to try if the reset button is working ok.
before that i had
shouldn't this code work ok? |
|
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Wed Jul 26, 2006 4:49 pm |
|
|
With your test program, do you see the text printed at power up? I mean, you say the reset is not working but how do you confirm this?
If you don't see the text one time at power up then it is more likely the processor is not working at all.
Can you give more details about your hardware setup?
- Are you using the 40 pin PDIP versions?
- Are you using the same hardware for both processors and you have a socket on the pcb so you can exchange them?
- What kind of clock circuit do you have? If crystal, then mention the value of the capacitors. |
|
|
cjusto
Joined: 26 Apr 2006 Posts: 38 Location: Portugal
|
|
Posted: Fri Jul 28, 2006 11:37 am |
|
|
Hi!
yeah, the programm runs. it makes everything i want, just the reset is not working.
i am using 40pins PDIP versions.
the hardware is exactly the same, with a socket.
the clock is an oscillator, 4 pins (+5V, GND, OSC, NC).
is this information enough?
thanks. |
|
|
cjusto
Joined: 26 Apr 2006 Posts: 38 Location: Portugal
|
|
Posted: Fri Jul 28, 2006 12:17 pm |
|
|
hi again!!
once again i checked the datasheet.
in page 253 there it said this:
REGISTER 23-4: CONFIG3H: CONFIGURATION REGISTER 3 HIGH (BYTE ADDRESS 300005h)
R/P-1 U-0 U-0 U-0 U-0 R/P-0 R/P-1 R/P-1
MCLRE — — — — LPT1OSC PBADEN CCP2MX
bit 7 bit 0
bit 7 MCLRE: MCLR Pin Enable bit
1 = MCLR pin enabled; RE3 input pin disabled
0 = RE3 input pin enabled; MCLR disabled
if i can chenge this register maybe it works.
can someone help me changing the register?
thanks. |
|
|
rwyoung
Joined: 12 Nov 2003 Posts: 563 Location: Lawrence, KS USA
|
|
Posted: Fri Jul 28, 2006 12:38 pm |
|
|
or _________________ Rob Young
The Screw-Up Fairy may just visit you but he has crashed on my couch for the last month! |
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Fri Jul 28, 2006 2:35 pm |
|
|
With the MCLR fuse disabled you would get the behaviour you experienced and Rwyoung told you how to fix that.
I'm just curious, which compiler version are you using? I checked several versions, old and new, and they all have the MCLR pin enabled by default. |
|
|
cjusto
Joined: 26 Apr 2006 Posts: 38 Location: Portugal
|
|
Posted: Mon Jul 31, 2006 4:05 pm |
|
|
hi!
i already tried that MCLR fuse. the behaviour is exactly the same.
i am using CCS ide version 3.43 and PCM,PCH,PCB Version 3.207
this is really wierd. i already talked with some friends, and nobody know how to fix this.
thanks |
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Mon Jul 31, 2006 4:49 pm |
|
|
v3.207 was no stable version, it had many bugs. Maybe it is a problem with setting the fuses and you are able to get it working, but then considering all the other bugs I wouldn't use this compiler version for a commercial product. Upgrade to at least v3.226.
Just for reference: using your #fuses line Code: | #fuses NOWDT, HS, NOPUT, NOPROTECT, NODEBUG, BROWNOUT, NOLVP, NOCPD, NOWRT//, NOXINST | In v3.249 I got the following fuses settings (see your *.lst file):
Code: | Word 1: 0200 HS NOIESO NOFCMEN RESERVED
Word 2: 1E1F BROWNOUT NOWDT BORV21 NOPUT WDT32768
Word 3: 8300 CCP2C1 PBADEN NOLPT1OSC MCLR RESERVED
Word 4: 0081 STVREN NODEBUG NOLVP NOXINST RESERVED
Word 5: C00F NOPROTECT NOCPD NOCPB
Word 6: E00F NOWRT NOWRTD NOWRTC NOWRTB
Word 7: 400F NOEBTR NOEBTRB
| Do you see the same values in your *.lst file? This was one of the known bugs in the early v3.2xx versions where the wrong configuration bits were set. |
|
|
cjusto
Joined: 26 Apr 2006 Posts: 38 Location: Portugal
|
|
Posted: Tue Aug 01, 2006 4:03 am |
|
|
hi cielstra!!
i checked that. i just compiled my program with fuses:
Code: |
#fuses NOWDT, HS, NOPUT, NOPROTECT, NODEBUG, BROWNOUT, NOLVP, NOCPD, NOWRT//, NOXINST
|
and from the lst file i got this:
Code: |
Configuration Fuses:
Word 1: 8200 HS IESO NOFCMEN
Word 2: 1E1F BROWNOUT NOWDT BORV21 NOPUT WDT32768
Word 3: 000F CCP2C1 PBADEN LPT1OSC MCLR
Word 4: 00C1 STVREN NODEBUG NOLVP XINST
Word 5: C00F NOPROTECT NOCPD NOCPB
Word 6: E00F NOWRT NOWRTD NOWRTC NOWRTB
Word 7: 400F NOEBTR NOEBTRB
|
actually, there are some differences.
u think that i can solve this, updating my ccs to a 3.2xx version? |
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Tue Aug 01, 2006 4:32 am |
|
|
Code: | Word 3: 000F CCP2C1 PBADEN LPT1OSC MCLR | This is a compiler bug, the MCLR (bit 15) is not set. Using chipedit.exe you can fix the fuse settings, but as I already mentioned v3.207 is so full of bugs that you definately don't want to use that version. Upgrade to v3.226 or higher to get a stable compiler and to fix your problem. |
|
|
|