Zur Übersicht - INFO - Neueste 50 Beiträge - Neuer Beitrag - Suchen - Zum C-Control-I-Forum - Zum C-Control-II-Forum

Re: Synchronisationsproblem mit Input-Capture und Timer-Overflow Interrupt Kategorie: Programmierung C (von PepeV - 4.05.2012 15:15)
Als Antwort auf Re: Synchronisationsproblem mit Input-Capture und Timer-Overflow Interrupt von Torsten - 2.05.2012 21:02
Ich nutze:
C-Control Pro Mega128, Pro-Bot128
Hi Torsten,

You are right, it's a nice game.

Why are the wrong results still there? I am afraid you forgot Irq_GetCount in ICT3IrqCapture!
(It cost me quite some time to find this out since I can't test the program. I have no application
board only a ProBot128.)

About your comments:
> Really exactly.
> Therefore the change over.
> We have two data records. For every function one.
> One to read and one to write.
Though it is not important any more because you removed this functionality, you really should
have a look at this again. In ICT3GetCapture you do calculations with the inactive ms counter.
But what if during ICT3GetCapture ICT3IrqCapture gets called? Then the inactive counter will
be set active and set to zero. If then ICT3GetCapture continues, the ms counter it uses will
read zero.

> > Also I noticed that you multiply with 0x0000FFFFl where it should be 65536 (2^16).
>
> The data type "dword" is required, to be able to carry that multiplication.
> The little wobbly type transformation of  Compact-C
> converts according to the first operand.
What I meant is that 0000FFFF = 65535, not 65536.

> > Secondly, ICT3IrqCapture must be as fast as possible in order not to block the interrupt handling of
> > the slow timer. It would therefore pay off to get rid of all the float calculations in it. This can be
> > realized as follows.
>
> I do not see any floot operation in this function.
Not in the old version (0.03) but in the version I was explaining to you and which is now 0.04.

> What is an "integer division"?
That is like floor but with an integer result, not a float. Like 7/3=2.

Well, I am curious to know whether still wrong result occur.
GruÃ? Pepe


    Antwort schreiben


Antworten:

Re: Synchronisationsproblem mit Input-Capture und Timer-Overflow Interrupt (von Torsten - 5.05.2012 6:26)
    Re: Synchronisationsproblem mit Input-Capture und Timer-Overflow Interrupt (von PepeV - 5.05.2012 14:45)
        Re: Synchronisationsproblem mit Input-Capture und Timer-Overflow Interrupt (von Torsten - 6.05.2012 8:34)
            Re: Synchronisationsproblem mit Input-Capture und Timer-Overflow Interrupt (von PepeV - 7.05.2012 20:33)