View unanswered posts | View active topics It is currently Tue Jul 22, 2014 10:51 am






Reply to topic  [ 6 posts ] 
Will ISR's be supported? 
Author Message
Rookie

Joined: Mon May 14, 2012 3:24 pm
Posts: 43
Post Will ISR's be supported?
Will ISR's be supported at some future date?


Mon May 14, 2012 5:17 pm
Profile
Site Admin
Site Admin

Joined: Wed Jan 24, 2007 10:42 am
Posts: 601
Post Re: Will ISR's be supported?
Hmm... ROBOTC has never really had any type of user controllable interrupts. We handle most of the timing overflow (PWM), Serial (UART tx/rx), analog reads in the firmware to provide the level of control to use these devices without having to know how to use interrupts. It's a little harder too because ROBOTC doesn't compile down to native AVR code like the Arduino language does, so it's not a matter of just including a library and "being done with it".

What type of ISR would you be looking for? Something like a pin-change ISR for encoders?

_________________
Timothy Friez
ROBOTC Developer - SW Engineer
tfriez@robotc.net


Tue May 15, 2012 9:17 am
Profile
Rookie

Joined: Mon May 14, 2012 3:24 pm
Posts: 43
Post Re: Will ISR's be supported?
tfriez wrote:
What type of ISR would you be looking for? Something like a pin-change ISR for encoders?


Well that would be the primary reason. For example we have a number of different Pololu motors with various encoder resolutions.

There are other examples where interrupts are beneficial, say like a digital PIR sensor, but one could probably get away with polling that on a separate task if necessary. You can't poll encoders however.


Tue May 15, 2012 10:19 am
Profile
Expert

Joined: Thu Sep 29, 2011 11:09 pm
Posts: 184
Location: Michigan USA
Post Re: Will ISR's be supported?
Not to speak for the TO, but I personally need pin interrupts (as you said), as well as timer interrupts. Both of these are essential for what I use Arduino for.

_________________
Matt


Tue May 15, 2012 10:20 am
Profile WWW
Senior Roboticist
User avatar

Joined: Wed Sep 28, 2011 10:13 pm
Posts: 630
Location: If I told you, I'd have to kill you.
Post Re: Will ISR's be supported?
Excuse my ignorance, I'm still new to this, but what's an interrupt?

_________________
A.K.A. inxt-generation
Self-proclaimed genius, and future world dominator.
My Brickshelf Folder
"Don't they teach recreational mathematics anymore?" - The Tenth Doctor
Bow down to Nikola Tesla, King of the Geek Gods.


Tue May 15, 2012 11:47 am
Profile WWW
Rookie

Joined: Mon May 14, 2012 3:24 pm
Posts: 43
Post Re: Will ISR's be supported?
NeXT-Generation wrote:
Excuse my ignorance, I'm still new to this, but what's an interrupt?

An interrupt service routine (ISR) is a function that is executed when a change happens on the Arduino. Normally it's when a particular digital pin changes value (goes from low to high or high to low). When that happens, the Arduino interrupts whatever code was being executed and immediately executes the ISR function.

Simple example: a button is hooked up on digital pin 2. If that button is pushed it forms a circuit making digital pin 2 go from low to high. When that happens the Arduino stops what it was doing and calls your ISR function.

Here is a real basic example from the Arduino website http://arduino.cc/en/Reference/AttachInterrupt .

Code:
int pin = 13;
volatile int state = LOW;

void setup(){
  pinMode(pin, OUTPUT);
  attachInterrupt(0, blink, CHANGE);
}

void loop(){
  digitalWrite(pin, state);
}

void blink(){
  state = !state;
}


In the code the function blink() is called whenever interrupt 0 changes (interrupt 0 is digital pin 2 just to make it confusing :D )

I normally use interrupts for quadrature encoders on motors. As a motor spins, a pulse (actually two) is sent from the encoder to the Arduino. I count each pulse using an ISR and I can determine how much the motor has spun and in which direction. The NXT motors for example have encoders inside them and they too send pulses to the NXT (through pins 5 & 6 to be exact).

There are also timer interrupts as (as well as interrupts for I2C, SPI, UART, etc...).


Tue May 15, 2012 1:17 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 6 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.