CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Reset not Working with 18f4525
Goto page 1, 2  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
cjusto



Joined: 26 Apr 2006
Posts: 38
Location: Portugal

View user's profile Send private message

Reset not Working with 18f4525
PostPosted: Thu Jul 20, 2006 4:33 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Jul 20, 2006 4:48 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Jul 24, 2006 3:23 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Jul 24, 2006 3:36 pm     Reply with quote

Code:
#include <16F877A>
How about changing this line to reflect your new processor?...... Cool
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

View user's profile Send private message

PostPosted: Mon Jul 24, 2006 3:46 pm     Reply with quote

hi. sorry. i forgot that. i changed that to 16f877A to try if the reset button is working ok.

before that i had
Code:


#include <18F4525>


shouldn't this code work ok?
Guest








PostPosted: Wed Jul 26, 2006 2:59 pm     Reply with quote

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
Code:


#include <18F4525>


shouldn't this code work ok?
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Wed Jul 26, 2006 4:49 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Jul 28, 2006 11:37 am     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Jul 28, 2006 12:17 pm     Reply with quote

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

View user's profile Send private message Send e-mail

PostPosted: Fri Jul 28, 2006 12:38 pm     Reply with quote

Code:
#fuse MCLR
or
Code:
#fuse NOMCLR

_________________
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

View user's profile Send private message

PostPosted: Fri Jul 28, 2006 2:35 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Jul 31, 2006 4:05 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Jul 31, 2006 4:49 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Aug 01, 2006 4:03 am     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Aug 01, 2006 4:32 am     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group