Timing Issue?

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

Post Reply
JDR04
Posts: 271
Joined: Tue Mar 05, 2013 10:49 pm
Has thanked: 111 times
Been thanked: 13 times
Contact:

Timing Issue?

Post by JDR04 »

Hi folks, I have attached the flowchart I have done for a darkness detector.

Everything seems to be working fine except for when I want the LED (connectd to GP5)to come on for 1 second. For som reason it it comes on for about half a second which is too quick. I've set the internal clock to 8Mhz and 4Mhz for the delays and have checked my chip configurations. For the life of me I just cannot figure out where I have gone wrong so would appreciate somebody pointing it out.

Thanks for your time.............JDR04
Attachments
DD2.fcf
(17.5 KiB) Downloaded 495 times

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Timing Issue?

Post by medelec35 »

Hi John,
The only thing I can spot is osccon value not matching clock frequency.
osccon=0x60; = 4MHz (since this is the default value on switch on then osccon is not required).
osccon=0x70; = 8MHz

Martin
Martin

JDR04
Posts: 271
Joined: Tue Mar 05, 2013 10:49 pm
Has thanked: 111 times
Been thanked: 13 times
Contact:

Re: Timing Issue?

Post by JDR04 »

Hi Martin, thanks for your time. Could I clear one thing up as I think I may misunderstand it.

I've got osccon=70 so I can run the chip at 8Mhz. The 4 Mhz I set was for the delay periods? Am I confusing something here????

Thanks a lot.....John

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Timing Issue?

Post by medelec35 »

Hi John,
JDR04 wrote:'ve got osccon=70 so I can run the chip at 8Mhz. The 4 Mhz I set was for the delay periods? Am I confusing something here????
Yes, I'm afraid you are.
The Clock speed must be set to match the actual osc speed.
All the dalays are automatically calculated.

So if osccon = 0x70; sets osc to 8MHz then you must also set clock speed to 8MHz.
Same if you have a 20MHz crystal then you must also set clock speed to 20MHz.
Etc..

Martin
Martin

JDR04
Posts: 271
Joined: Tue Mar 05, 2013 10:49 pm
Has thanked: 111 times
Been thanked: 13 times
Contact:

Re: Timing Issue?

Post by JDR04 »

OK, finally get it.

Thanks for your patience.............Take care,John

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Timing Issue?

Post by medelec35 »

No problem at all John.
Glad you have got it now.

Martin
Martin

Post Reply