Interrupt accuracy

Hi there!

I got in this news, a code that uses the IRQ8, and the times doesn’t
keep accuracy… all test under 1 millisecond. eg. 2Khz I’ll have plus
49microseconds, and so on… any tips?

I little bit question: Shoul I forget the use of QNX6 for accuracy below
1 millisecond?

Pulse keeps the accuracy beyond 1 millisecond (in 6.2 Beta says 10
microsecs).


Claudio Cardozo
cazo@bol.com.br

Claudio Cardozo <cazo@bol.com.br> wrote in article <3CE320E0.3090904@bol.com.br>…

Hi there!

I got in this news, a code that uses the IRQ8, and the times doesn’t
keep accuracy… all test under 1 millisecond. eg. 2Khz I’ll have plus
49microseconds, and so on… any tips?

Ok, here is my code snippet:
//period rate selector (status A reg)
#define Hz2 15 //period = 500 mS
#define Hz4 14 // 250 mS
#define Hz8 13 // 125 mS
#define Hz16 12 // 62.5 mS
#define Hz32 11 // 31.25 mS
#define Hz64 10 // 15.625 mS
#define Hz128 9 // 7.8125 mS
#define Hz256 8 // 3.90625 mS
#define Hz512 7 // 1.953125 mS
#define Hz1024 6 // 976.5625 uS
#define Hz2048 5 // 488.281 uS
#define Hz4096 4 // 244.141 us
#define Hz8192 3 // 122.070 us

Is your problem you have 2.048 kHz instead of 2 kHz expected? Perhaps no, because you have
additional to expected time :wink: How did you time measurements ? I guess hardware (RTC) works fine,
but there is problem with measurements. Did you ClockCycles() in ISR or in event handler?

I little bit question: Shoul I forget the use of QNX6 for accuracy below
1 millisecond?

You could set up 0.5 millisecond resolution in QNX 6 and yes, it was promised the better resolution
will 10 microseconds in QNX 6.2. See ClockPeriod() docu
http://qdn.qnx.com/support/docs/neutrino_2.11_en/lib_ref/c/clockperiod.html

Pulse keeps the accuracy beyond 1 millisecond (in 6.2 Beta says 10
microsecs).

1 millisecond is default for >40 MHz CPU :wink:

Cheers,

Eduard.
ed1k at ukr dot net

Claudio Cardozo
cazo@bol.com.br