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

Timer Interrupts


  • Please log in to reply
3 replies to this topic

#1 sfugarino

sfugarino

    Member

  • Members
  • PipPip
  • 29 posts
  • LocationSuwanee, GA

Posted 15 March 2014 - 04:42 AM

I was looking at some Arduino code that uses timer interrupts and was wondering if there was an equivalent using the MF. There are something like 8 timers on the STM32F205RF. The Arduinoo code looks like this:

void init_interrupts(void)
{
/* First disable the timer overflow interrupt while we're configuring */
TIMSK1 &= ~(1<<TOIE1);

/* Configure timer2 in normal mode (pure counting, no PWM etc.) */
TCCR1A &= ~((1<<WGM11) | (1<<WGM10));
TCCR1B &= ~((1<<WGM13) | (1<<WGM12));


/* Disable Compare Match A interrupt enable (only want overflow) */
TIMSK1 &= ~(1<<OCIE1A);

// Prescalar = 8. Time between interrupts ~=32ms;
TCCR1B &= ~(1<<CS12); // Clear bit
TCCR1B |= (1<<CS11); // Set bit
TCCR1B &= ~(1<<CS10); // Clear bit

/* Finally load and enable the timer */
TCNT1 = tcnt1;
TIMSK1 |= (1<<TOIE1);
}


I suppose one would have write custom firmware to get at timer registers.


REF:

http://www.protostac...n-an-atmega168/

#2 Nevyn

Nevyn

    Advanced Member

  • Members
  • PipPipPip
  • 1072 posts
  • LocationNorth Yorkshire, UK

Posted 15 March 2014 - 06:44 AM

Depends upon the accuracy you are after.  NETMF has timers built in to the framework.  Have a look at this article if you are interested in finding out more.

 

Regards,

Mark


To be or not to be = 0xFF

 

Blogging about Netduino, .NET, STM8S and STM32 and generally waffling on about life

Follow @nevynuk on Twitter


#3 sfugarino

sfugarino

    Member

  • Members
  • PipPip
  • 29 posts
  • LocationSuwanee, GA

Posted 15 March 2014 - 05:48 PM

Exactly what I was looking for, thanks.

#4 sfugarino

sfugarino

    Member

  • Members
  • PipPip
  • 29 posts
  • LocationSuwanee, GA

Posted 22 March 2014 - 08:04 AM

I found some code for the Cerberous boards that, I guess, uses custom firmware. Would tiis code work for Netduino? Also how about adding a HAL in the future that would give similar access to the controller's register. Arduino has this, chipKit does, and apparently GHI does or can. See the attached file.

Attached Files






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.