¿ªÔÆÌåÓý

Re: CW Mistakes


 

Jerry

For a test, insert reads of the micerosecond timer and then?
subtract difference from?
subsequent reads.? That way?
you can place calls to this?
subroutine where you need?
them to build a picture of timing involved.? I used a DEBUG level?
To select what stage reports its
timing.??

Arv
_-_

On Sun, May 16, 2021, 7:15 PM jerry@... <jerry@...> wrote:
On 2021-05-16 16:15, Evan Hand wrote:
> All,
>
> While I agree that there is enough sample time for the ADC, I have not
> seen any analysis on the polling time of the main loop of the program.

I once worked on an embedded project with the following architecture,
which is more or less what I use when starting a project from scratch:

? 1.? A main loop.? Each run through the loop takes a defined time ( we
used 50ms, or 20 times a second ).

? 2.? A timer interrupt.? On that project, it happened every 2 ms.? ? ?
It bumped a counter on every invocation.

? 3.? The main loop would time out its 50ms by counting the counter done
by the 2ms interrupt.

? 4.? When the main loop finished whatever useful things it was doing, it
would set a pin high and wait till the timer count was 50ms.? Then it
would set the pin low, and go back to the beginning of the loop.

5.? We would stick an oscilloscope on that pin, and it would tell us if
the CPU was too busy.? As the CPU loaded up, the pulse would get
shorter and shorter, because the CPU was spending less time just waiting
at the end of the 50ms loop.

? ?This was done by an Intel 8031 running at 9MHz, with VERY limited
resources.

? ?At the top of the main loop, the stack pointer was always at the same
number.? If it wasn't, we knew something was badly wrong, and the
processor would log the occurrence and reset.

? ?We also set the top 3 bytes of the stack to 0x55.? If it wasn't 0x55
anymore, we knew we were close to blowing the stack.

? ? ? ? ? ? ? ? ? ? ?- Jerry KF6VB




>? The program could be doing other things during the sampling process
> that extends the time of the loop.
>
> Another point to remember is Nyquist requirements.? You must poll at
> least twice the speed of the fastest signal, and based on my
> industrial control experience 4 times faster is better.
>
> 73
> Evan
> AC9TU
>
>
> Links:
> ------
> [1] /g/BITX20/message/88431
> [2] /mt/82850528/243852
> [3] /g/BITX20/post
> [4] /g/BITX20/editsub/243852
> [5] /g/BITX20/leave/10189903/243852/952924773/xyzzy





Join [email protected] to automatically receive all group messages.