PWM and RTC DS1307 going haywire????

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

Post Reply
User avatar
Jordy101091
Posts: 519
Joined: Sat Jan 08, 2011 4:02 pm
Location: The Netherlands
Has thanked: 25 times
Been thanked: 188 times
Contact:

PWM and RTC DS1307 going haywire????

Post 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
Attachments
Aquarium Controller Version 011-a00 PIC18F4455A.fcf
(182.68 KiB) Downloaded 255 times
the will to learn, should not be stopped by any price

User avatar
Jordy101091
Posts: 519
Joined: Sat Jan 08, 2011 4:02 pm
Location: The Netherlands
Has thanked: 25 times
Been thanked: 188 times
Contact:

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

Post 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
the will to learn, should not be stopped by any price

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

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

Post 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?

User avatar
Jordy101091
Posts: 519
Joined: Sat Jan 08, 2011 4:02 pm
Location: The Netherlands
Has thanked: 25 times
Been thanked: 188 times
Contact:

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

Post 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
the will to learn, should not be stopped by any price

Post Reply