4_ smt160

Discussion in 'The Projects Forum' started by BorealDude, Jul 10, 2013.

  1. BorealDude

    Thread Starter New Member

    May 20, 2013
    9
    0
    hi

    my question is about smt160.
    i wanna use 4 sensors with an atmega16.
    the problem is that i've only 3 timers to measure the dutycycle.
    is there any software solution to this or i've to change my micro.

    thanks
     
  2. GopherT

    AAC Fanatic!

    Nov 23, 2012
    6,057
    3,818
    You can use interrupts and one timer.
    1) Have the sensor trigger an interrupt,
    Within the interrupt service routine...
    2) have the Isr determine the delay time,
    3) determine which sensor triggered the interrupt
    4) record the time to memory register
    5) make sure no other sensors have been triggered since the ISR started
    6) reset the interrupt flag
    7) exit the interrupt (continue into delay loop or do other work until next interrupt is called)
     
    BorealDude likes this.
  3. BorealDude

    Thread Starter New Member

    May 20, 2013
    9
    0
    thank you my friend.
    its ok for at most 3 sensors ( because we have only 3 external interrupts ).
    what about for 4 sensors?
     
Loading...