Page 1 of 1

PWM and RTC DS1307 going haywire????

Posted: Wed Nov 16, 2011 10:08 pm
by Jordy101091
Hi all,

Im verry close to finishing my project. But now I have some trouble to get things working.
I have made a little board with two transistor that drive a LED and FAN.

LED simulates the night/day cycle and I control it with a PWM signal the same for the FAN.
The PWM signal is:

frequency: 46.875 KHz
and a period time of 21.3 uSec.

The transistor(s) can handle this switching frequency, but thats not my problem.

When I connect this all to port C this is where CCP1/2 is located on my LCD the time shows as follow 45:85 45/25/165
when I enter a new time and date nothing changes.
When I disconect the tranistors on port C the Time shows correct. I dont know if this is a timing issue (sound like it does) I dont know.
Maybe some one can take a look at it for me.

Regards Jordy

Re: PWM and RTC DS1307 going haywire????

Posted: Wed Nov 16, 2011 10:15 pm
by Jordy101091
Guys, quick update,

situation:

My FAN was turned on with PWM Dcycle @ 1023 (100%) display going crazy.
I was going to bed so I turned the FAN of with Dcycle @ 0 (0%) display shows normal time and date value, my LED (PWM) regulates fine.
Seems to me like abracadabra whats going on...?

Hope somebody has any ideas ?

Regards Jordy

Re: PWM and RTC DS1307 going haywire????

Posted: Fri Nov 18, 2011 5:51 pm
by Benj
Hello,

If the program runs fine without the PWM outputs connected then I would assume there is something fundamentally wrong with your circuit. The PWM is just an output so the chip does not know if anything is connected to it or not. This means that something is going wrong when you connect up your port C outputs.

Do you have base resistors on your transistors?

Do you have a fairly large capacitor across your power rails to ensure the motor is not eating all of the available current and browning out the microcontroller? Similarly do you have decoupling 100nF caps on your supply rails?

Re: PWM and RTC DS1307 going haywire????

Posted: Fri Nov 18, 2011 6:18 pm
by Jordy101091
Hi Ben thanks for you reply,

When the fan Turned on the voltage droped below the tricker point of the PICs brownout.
So I fixed it whit a cap and some resistors.

It works fine now.

Regards Jordy