|
|
View previous topic :: View next topic |
Author |
Message |
Helyos
Joined: 22 Oct 2003 Posts: 22
|
|
Posted: Sun May 16, 2004 9:02 pm |
|
|
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 |
|
|
ajt
Joined: 07 Sep 2003 Posts: 110
|
Rocekt Science |
Posted: Sun May 16, 2004 9:13 pm |
|
|
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
|
|
Posted: Tue May 18, 2004 6:05 am |
|
|
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
|
|
Posted: Tue May 18, 2004 10:58 am |
|
|
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... |
|
|
dyeatman
Joined: 06 Sep 2003 Posts: 1933 Location: Norman, OK
|
Mine works |
Posted: Tue May 18, 2004 11:18 am |
|
|
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
|
It works for me all the time... |
Posted: Tue May 18, 2004 6:00 pm |
|
|
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... |
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
|
The same... |
Posted: Tue May 18, 2004 10:32 pm |
|
|
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
|
Re: The same... |
Posted: Tue May 18, 2004 11:37 pm |
|
|
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
|
|
Posted: Wed May 19, 2004 12:23 am |
|
|
#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
|
It works |
Posted: Wed May 19, 2004 4:39 am |
|
|
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 |
Posted: Wed May 19, 2004 6:15 am |
|
|
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
|
Re: It works |
Posted: Wed May 19, 2004 6:24 am |
|
|
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
|
Use the data sheet |
Posted: Wed May 19, 2004 7:31 am |
|
|
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
|
Transistor |
Posted: Wed May 19, 2004 7:38 am |
|
|
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
I would like know why this happens, is very extrange
Why the pic hangs up with MCLR??? |
|
|
frankb
Joined: 08 Sep 2003 Posts: 7
|
|
Posted: Wed May 19, 2004 7:54 am |
|
|
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. |
|
|
|
|
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
|