• AVR Freaks

Counting NCO Pulses, LED, Delay

Author
acharnley
Super Member
  • Total Posts : 270
  • Reward points : 0
  • Joined: 2016/05/01 06:51:28
  • Location: 0
  • Status: offline
2019/04/08 06:28:39 (permalink)
0

Counting NCO Pulses, LED, Delay

I'm struggling to figure out a combination of peripherals that can solve the following without firing an interrupt. Presently I have the NCO, DSM, only one 8 bit timer (using two), Timer 0 (roll-over) and Timer 1,3 (countings, no rollover). One CCP is spare, two at a push.

Problem
  • I have the NCO providing a square wave at 4Hz/250ms. Initially this is fed to an LED (may go through the DSM).
  • I need to count 4 pulses and then stop for 5 pulses. The sequence should then repeat. (the NCO is using the LF clock so could go off that).

Each way I spin it I come to a dead-end. Timer 1/3/5 sound perfect for counting pulses but don't roll-over without using a CCP, of which I'd need two.

Cheers,
Andrew










#1

2 Replies Related Threads

    qhb
    Superb Member
    • Total Posts : 9985
    • Reward points : 0
    • Joined: 2016/06/05 14:55:32
    • Location: One step ahead...
    • Status: online
    Re: Counting NCO Pulses, LED, Delay 2019/04/08 06:35:32 (permalink)
    0
    acharnley
    ...
    Presently I have the NCO, DSM, only one 8 bit timer (using two), Timer 0 (roll-over) and Timer 1,3 (countings, no rollover).

    Was this sentence also meant to have the word "spare" in it somewhere?
     
    #2
    acharnley
    Super Member
    • Total Posts : 270
    • Reward points : 0
    • Joined: 2016/05/01 06:51:28
    • Location: 0
    • Status: offline
    Re: Counting NCO Pulses, LED, Delay 2019/04/08 07:54:01 (permalink)
    0
    I believe so.

    I can only make it work without interrupts using two 8 bit timers (which I really don't want to do, need two of 'em for differing PWM frequencies). 

    So one timer runs in monostable, a second freewheels and resets the first. Both clocked off the NCO.
    #3
    Jump to:
    © 2019 APG vNext Commercial Version 4.5