Timer0 Problem

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
wayne millard
Posts: 234
Joined: Thu May 31, 2007 2:18 pm
Has thanked: 7 times
Been thanked: 12 times

Timer0 Problem

Post by wayne millard »

Hi Matrix Team,

Can you please tell me what am i doing wrong my project works but the time that it generates is not as accurate
as it should be. i have a 10us interrupt running. it seems that the 10us is not quite 10us why and what can i do to fix it. is it the counter i have in the interrrupt?

Thanks,
Wayne m :cry:
Attachments
PVMS TEST SET.fcf
(32.24 KiB) Downloaded 250 times

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

Re: Timer0 Problem

Post by medelec35 »

I have tested the 10us in a simulator with OSC set at 40MHz. Interrupt was accessed every 10.20uS not exactly 10uS, but not far off.
If you have a scope, you could always test interrupt access time by the following method:
Test timer0.jpg
Test timer0.jpg (32.02 KiB) Viewed 2434 times
Just measure time or frequency at port C3 of target device
Are you using the 10MHz xtal you mentioned in a different post? If not what crystal are you using?
Do you have to use a very sort time like 10uS and count up to 5000, or can you use a longer time period e.g 100uS and count up to 500 for your shortest delay?
Martin

wayne millard
Posts: 234
Joined: Thu May 31, 2007 2:18 pm
Has thanked: 7 times
Been thanked: 12 times

Re: Timer0 Problem

Post by wayne millard »

Hi medelec35,

So there is about a 2% error in the timing. so i calculate interrupt counts for required time then subtract 2% of the counts i still dont get the accuracy over all the time spane.

Help
Wayne

Post Reply