Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

One question about interrupts.


  • Please log in to reply
1 reply to this topic

#1 irda

irda

    New Member

  • Members
  • Pip
  • 4 posts

Posted 10 March 2012 - 08:40 AM

Hello all I need to know if it is possible to active time interrupts with netduino and how. Which would be the minimun time elapse between interrupts. Could someone help me with an example, please? Best regards

#2 GlenS

GlenS

    Member

  • Members
  • PipPip
  • 23 posts
  • LocationTamworth, UK

Posted 11 March 2012 - 11:05 PM

Hello Irda,

I think what you need is the System.Threading.Timer class. The constructor takes a callback, some state and the parameters that represent when the timer is fired. The first indicates when the timing starts (zero is immediately) and the 2nd is the period in milliseconds.

i.e.

using System.Threading;
using Microsoft.SPOT;

namespace TimerTest
{
    public class Program
    {
        public static void Main()
        {
            // write your code here
            Timer timer = new Timer(new TimerCallback(OnTimer), null, 0, 1000);
            Thread.Sleep(Timeout.Infinite);
        }

        public static void OnTimer(object state)
        {
            Debug.Print("Timer fired");
        }

    }
}

Hope this helps

Glen




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.