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

MCLR doesnīt restart the code (include schematics) Why?
Goto page Previous  1, 2, 3, 4  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Helyos



Joined: 22 Oct 2003
Posts: 22

View user's profile Send private message

PostPosted: Sun May 16, 2004 9:02 pm     Reply with quote

Yes, it isnīt a rocket science, but in this case, this isnīt working.
Iīm working in a new prototype, I will test it tomorrow, I hope that this solve the problems Confused
ajt



Joined: 07 Sep 2003
Posts: 110

View user's profile Send private message

Rocekt Science
PostPosted: Sun May 16, 2004 9:13 pm     Reply with quote

It's frustrating when something this simple causes these types of problems. I typically will drive to find the root cause on a specific board before moving on to a new on. On the new one the reset will work but there will be something else that drives you crazy!

You surely have a simple wiring error that is causing you all this grief. If it were me I wouldn't move on not knowing why.
_________________
Al Testani
raider



Joined: 14 Apr 2004
Posts: 1

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

PostPosted: Tue May 18, 2004 6:05 am     Reply with quote

i think the problem is not in hardware , you may make fault when programing , could you please write us your fuses configuration.
Helyos



Joined: 22 Oct 2003
Posts: 22

View user's profile Send private message

PostPosted: Tue May 18, 2004 10:58 am     Reply with quote

Ohhhh, incredible... I done another prototype, I checked all connections, all works perfectly when I power on the circuit, but if I do the MCLR it stop... Iīm desperate.
My fuses are:

Code:
#include <16F876.h>
#use delay(clock=4000000)
#fuses NOWDT,XT, PUT, NOPROTECT, BROWNOUT, NOLVP, NOCPD, NOWRT, NODEBUG
#use rs232(baud=19200,xmit=PIN_C6,rcv=PIN_C7)
#use i2c(Master,Fast,sda=PIN_C4,scl=PIN_C3,restart_wdt)
#include "24256n.c"
#include "lcd4_i2c.c"


I donīt understand any... Mad
dyeatman



Joined: 06 Sep 2003
Posts: 1912
Location: Norman, OK

View user's profile Send private message

Mine works
PostPosted: Tue May 18, 2004 11:18 am     Reply with quote

Something is wierd here.... I

I prototyped your 16F876 circuit and since I didn't have your code I wrote a simple exercise program and my POR and MCLR Reset both work fine, exactly as they are supposed to. It has to be something in the code or how it is being tested at your end.

have used the 16F876 and 877 many times with no MCLR problems like what are being described. .
Hans Wedemeyer



Joined: 15 Sep 2003
Posts: 226

View user's profile Send private message

It works for me all the time...
PostPosted: Tue May 18, 2004 6:00 pm     Reply with quote

Helyos wrote:
Ohhhh, incredible... I done another prototype, I checked all connections, all works perfectly when I power on the circuit, but if I do the MCLR it stop... Iīm desperate.
My fuses are:

Code:
#include <16F876.h>
#use delay(clock=4000000)
#fuses NOWDT,XT, PUT, NOPROTECT, BROWNOUT, NOLVP, NOCPD, NOWRT, NODEBUG
#use rs232(baud=19200,xmit=PIN_C6,rcv=PIN_C7)
#use i2c(Master,Fast,sda=PIN_C4,scl=PIN_C3,restart_wdt)
#include "24256n.c"
#include "lcd4_i2c.c"


I donīt understand any... Mad


Try NOBROWNOUT

I have been using B4 to pul down MCLR in this design
http://hans-w.com/oldursa.htm and it works .

There is no magic to this !
Helyos



Joined: 22 Oct 2003
Posts: 22

View user's profile Send private message

The same...
PostPosted: Tue May 18, 2004 10:32 pm     Reply with quote

I tested it, and the same. I donīt think in a soft problem, because I tested this simple program, and the same... I program it, when I power on, if a push B7 sounds, if a do a reset with MCLR, doesnīt sounds, with or without B7. It stops completly.
Code:

#include <16F876.h>
#use delay(clock=4000000)
#fuses XT, NOPROTECT,NOWDT, NOPUT, NOBROWNOUT, NOLVP, NOCPD, NOWRT, NODEBUG
#org 0x1F00, 0x1FFF void loader16F876(void) {}
void beep(){
   output_bit(PIN_a4,0);
   delay_ms(25);
   output_bit(PIN_a4,1);
}
void main() {
   loader16F876();
   while (TRUE) {
         if (input(PIN_b7)==0) beep();
   }
}


I think (is logical) that is an electrical problem, something is wrong connected and whe I test it in my test board (wired) it works fine. Why when I join all components this happens????
I think too that itīs important when the circuit is working itīs consuming 8,3 mA but if I reset with MCLR it stops and consume 7 mA.
I put all information (schematics, pcb layout and design) in this page http://www.aiora.com/problem
I hope you can help me because I donīt know what can be wrong.
Thanks!!!
(Dyeatman could you verify that your circuit is exactly mine? Thanks)
Hans Wedemeyer



Joined: 15 Sep 2003
Posts: 226

View user's profile Send private message

Re: The same...
PostPosted: Tue May 18, 2004 11:37 pm     Reply with quote

Looking at your circuit, I think you are going to have a problem driving Q2 with Pin_A4.
I know you tell us it beeps, but i have to question why ?

PIN_A4 is a OPEN COLLECTOR output and can only Sink Current !

Further, if you tried to turn on Q2 (NPN) As Q2 draw current the voltage across the buzzer will build up and you will not have the sustaining drive to keep it hard on.

Anyway, check the data sheet and you will see PAIN_A4 cannot drive Q2 on with the circuit you have.

It would be better if you can place the buzzer in the collector of Q2 and then add a resistor from V+ to base of Q2 and use PIN_A4 to pull down and switch off Q2. That means you would have negaive logic. i.e. PIN_A4 ON means Buzzer off. But that's ok you can livew with that I'm sure.

Simply put your circuit should NOT make the buzzer beep, and as you tell use it beeps I suspect you have another wiring error.
Hadyou drawn this in a conventional manor, I feel sur eyou could have seen the poor placement of the buzzer...

Good luck.
Hans W
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed May 19, 2004 12:23 am     Reply with quote

#include <16F876.h>
#use delay(clock=4000000)
#fuses XT, NOPROTECT,NOWDT, NOPUT, NOBROWNOUT, NOLVP, NOCPD, NOWRT, NODEBUG

A quick check with Google shows that the following line is
used with the Microchipc bootloader. I use that bootloader,
but I don't specify a function name to reserve the upper
256 bytes. I just use: #org 0x1F00, 0x1FFF {}
per the CCS manual.
#org 0x1F00, 0x1FFF void loader16F876(void) {}

void beep(){
output_bit(PIN_a4,0);
delay_ms(25);
output_bit(PIN_a4,1);
} void main() {

This next line sticks out.
I use this bootloader, and I know that you don't have to put
in code to call the bootloader. The bootloader is automatically
jumped to, upon power-up or reset.
This line might be causing your problem. I'm not at a location
where I can test this now, but you should remove this line and
see if it affects your problem.
loader16F876();

while (TRUE) {
if (input(PIN_b7)==0) beep();
}
}
Helyos



Joined: 22 Oct 2003
Posts: 22

View user's profile Send private message

It works
PostPosted: Wed May 19, 2004 4:39 am     Reply with quote

The A4 is an open collector, itīs true, but my design works fine, I tested it, it has nothing to do with the problem. The buzzer sounds perfectly when I want. The MCLR problem persists...
The bootloader, I always use that form. Itīs possible without that line I could solve the problem, I havenīt tested it yet, but it would be very extrange. This function call never had given me any problem. Anyway I will test it today.
But I keep thinking it is an electrical problem. I donīt know why it works when I do a software reset (reset_cpu()) but if I use hardware pin (MCLR) it hangs up.
WHY??
EDITED: I put previous A0, sorry, that was a mistake


Last edited by Helyos on Wed May 19, 2004 8:15 am; edited 1 time in total
Guest








Re: It works OK explain HOW
PostPosted: Wed May 19, 2004 6:15 am     Reply with quote

Helyos wrote:
The A0 is an open collector, itīs true, but my design works fine, I tested it, it has nothing to do with the problem. The buzzer sounds perfectly when I want. The MCLR problem persists...
The bootloader, I always use that form. Itīs possible without that line I could solve the problem, I havenīt tested it yet, but it would be very extrange. This function call never had given me any problem. Anyway I will test it today.
But I keep thinking it is an electrical problem. I donīt know why it works when I do a software reset (reset_cpu()) but if I use hardware pin (MCLR) it hangs up.
WHY??


According to your schematic pin A4 is trying to control the Buzzer... not A0

I just noticed that it is indeed a PNP which can tolerate 500mA base current. Had me fooled there by connecting the collector of the transistor to the 5V, I assume Plus becasue you are also pulling up from 5V to other pins.

However please explain how you think it works !

The buzzer is connected to GROUND and the collector of the PNP is connected to 5V !!!!!!!
Hans Wedemeyer



Joined: 15 Sep 2003
Posts: 226

View user's profile Send private message

Re: It works
PostPosted: Wed May 19, 2004 6:24 am     Reply with quote

Helyos wrote:
The A0 is an open collector, itīs true, but my design works fine, I tested it, it has nothing to do with the problem. The buzzer sounds perfectly when I want. The MCLR problem persists...
The bootloader, I always use that form. Itīs possible without that line I could solve the problem, I havenīt tested it yet, but it would be very extrange. This function call never had given me any problem. Anyway I will test it today.
But I keep thinking it is an electrical problem. I donīt know why it works when I do a software reset (reset_cpu()) but if I use hardware pin (MCLR) it hangs up.
WHY??


Look at this and tell me how your buzzer driver works.

http://hans-w.com/pictorelay.gif
frankb



Joined: 08 Sep 2003
Posts: 7

View user's profile Send private message

Use the data sheet
PostPosted: Wed May 19, 2004 7:31 am     Reply with quote

As I pointed out a few days ago Q1 (and Q2) are connected wrong AND pinned out wrong. Per the data sheet:
pin1 -> Emitter
pin2 -> Collector
pin3 -> Base
Pin 1 is on the left side of the package when viewed from the front (plastic) side of the transistor.
This transistor only has a gain of 40 and will require a fair amount of base current to drive it into saturation. It is a bad choice for this application (unless your buzzer usese a LOT of current).
If it's all you have available it can be made to work by adding a 470 ohm resistor between RA4 and the base (pin3). Connect the emitter (pin1) to 5 volts and collector to the un-grounded side of the buzzer. Same goes for Q2.
Hans, sorry if I'm repeating some info from your schematic but I couldn't view it on my system.
Helyos, get a data sheet for the transistor and compare the info on it to your schematic. Also learn Ohms law and then read up on using transistors as saturated switches. These are entry level concepts you'll need to know before going any farther in hardware design.
Helyos



Joined: 22 Oct 2003
Posts: 22

View user's profile Send private message

Transistor
PostPosted: Wed May 19, 2004 7:38 am     Reply with quote

If you look the schematics you understand it.
The symbols are WRONG!!! I put these symbols because I want show that is an PNP transistor, but I had to allocate the pins in that form because my transistor BD140 the pins are: 1: emitter, 2: collector, 3: base
If you read the schematics with this key you will see that all work.
And in the other hand, I know that it works because I tested it. I hear the buzzer when I push the button (tie to ground) B7.
I told in previous posts, that my problem with MCLR exists even without transistors in board, the transistors arenīt the problem.
Thanks for all your time in this problem Wink
I would like know why this happens, is very extrange
Why the pic hangs up with MCLR???
frankb



Joined: 08 Sep 2003
Posts: 7

View user's profile Send private message

PostPosted: Wed May 19, 2004 7:54 am     Reply with quote

Where is the current limiting resistor between the base of Q1 and RA4? If there is one, I haven't found it anywhere on your schematic. Now you're telling us that although the transistor is drawn incorrectly we should understand how it works anyway. Ohhhhh I need to go put something strong in my coffee. Shocked
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 Previous  1, 2, 3, 4  Next
Page 2 of 4

 
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