Go Down

Topic: Problems with R/C 6ch transmission (Read 4 times) previous topic - next topic

DuaneB

There is a lot of good information in this link

http://rcarduino.blogspot.com/2012/04/how-to-read-multiple-rc-channels-draft.html

Your question relates specifically to this part of the post -

2) Variable Access

And the reason you should not put serial print in the time sensitive parts of the code -

3) Fast Interrupt Service Routines

Let me know if that makes sense of not.

Duane B

Carlos mononoke

Yes,I´ve read it yesterday and i thing i understand, but what i don´t understand well is if i read something
in the interrupt but just when all is finish is not the same that read when we go back to the loop.
I am thinking in this particular case, when we hava the variable that is needed update and we go back to the loop for make a copy.
is not the same read this variable that we will copy in the loop??? well is not the same and i see the real case no when i did this i have unexpected values and when i read in the loop i have expected values.... but for me it´s a little extrange.

DuaneB

When you are in the interrupt, no other interrupts can happen.

If you do something slow in the interrupt like Serial.println no interrupts can happen for a long time, this means that we will get inaccurate values because we are not able to respond to the new interrupts until we finish the current one. When we do get to respond the values we read will be wrong.

So it is the same variable, but by using Serial.println in the interrupt we were ensuring that it would become inaccurate.

You want to get in and out of interrupts as quickly as possible

If you look here you will see that I am reading timers directly instead of using micros, you can also see the improvement in accuracy in the graphs -

http://rcarduino.blogspot.com/2012/11/how-to-read-rc-channels-rcarduinofastlib.html

Stay with the code you are using for now, once you are a familiar I would like to help you try this code, its faster but a bit new.

Duane B

Carlos mononoke

aha, i understand you, thanks a lot Duane. now i ill try to update the RC to my proyect, i am doing a puppet.
but i will follow your web, and in some days i hope to probe your  fast library.
Only one thing , I want to include you in the acknowlegement of my proyect,you have help me a lot,
Can you mail me your name to alehop@mononokeproducciones.com

THANKS Duane B!!!!!

DuaneB

Hi,
   If you keep some variation of this with a link to the RCArduino blog, that would be great as acknowledgement.

   Also if you let me know what you build I will put a link to your project on the RCArduino blog.

Duane B
   

Code: [Select]

// MultiChannels
//
// rcarduino.blogspot.com
//
// A simple approach for reading RC Channels using pin change interrupts
//
// See related posts -
// http://rcarduino.blogspot.co.uk/2012/01/how-to-read-rc-receiver-with.html
// http://rcarduino.blogspot.co.uk/2012/03/need-more-interrupts-to-read-more.html
// http://rcarduino.blogspot.co.uk/2012/01/can-i-control-more-than-x-servos-with.html
//
// rcarduino.blogspot.com
//



Go Up