Let's Make Robots!

How to use Arduino interrupt in GR Sakura?

Hi,

I successfully ran a code snippet on Arduino . The arduino code uses timer 1 for interrupt and looks like this...

void setup() {
  cli();//clear interrupt
  //set timer1 interrupt at 1Hz
  TCCR1A = 0;// set entire TCCR1A register to 0
  TCCR1B = 0;// same for TCCR1B
  TCNT1  = 0;//initialize counter value to 0
  OCR1A = 15624;// set compare match register for 1hz increments // = (16*10^6) / (1*1024) - 1
  TCCR1B |= (1 << WGM12);// turn on CTC mode
  TCCR1B |= (1 << CS12) | (1 << CS10);  // Set CS12 and CS10 bits for 1024 prescaler
  TIMSK1 |= (1 << OCIE1A);// enable timer compare interrupt
  sei();//allow interrupts

}

and in ISR

ISR(TIMER1_COMPA_vect){

//command for interrupt here

}

The above code worked well for arduino and compiled successfully.

But sakura web compiler gives errors. (Says it doesn't know cli,TCCR1A,TCCR1B etc..)

How do I make arduino interupts to work with GR sakura?

Here's the cloud compiler if you're interested in it:
http://www.renesas.com/products/promotion/gr/index.jsp#cloud .I clicked guest login and selected gr sakura board v1.07.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

I found the answer to my problem (as hinted by bajdi) so case closed.

For anyone else who stumbles here I decided to write a blog on it ( Introduction to GR Sakura ).

Here's the link: http://letsmakerobots.com/node/38479.

Cheers!

Since this website is about teaching, what is GR Sakura? Sounds like a Japanese car polish or a brand of Saki.

Actually you really should of started with an explanation of and link to GR Sakura. It's not exactly a houshold name.

Then it probably would have helped if you explained why your using it, what do you want to do with it?

But a brand of sake?!!What? (That had me laughing alright!).

Regading your second query...I'll post what I did with it on LMR ofcourse! (Though that might take a while)

A user friendly function interface for Interrupts ? Like a library of some sort like it has for servo..etc ? I had to write like 15 lines of code for a 1 sec interrupt .Something like InterreptTimer1(1000) could have been cool...

On second thought I think I will have to dig the datasheet...

That interrupt code is pure AVR code. You will need to dive in to the datasheet of that Renesas mcu...