Go Down

Topic: Problems with R/C 6ch transmission (Read 5369 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
Read this
http://rcarduino.blogspot.com/2012/04/servo-problems-with-arduino-part-1.html
then watch this
http://rcarduino.blogspot.com/2012/04/servo-problems-part-2-demonstration.html

Rcarduino.blogspot.com

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
Read this
http://rcarduino.blogspot.com/2012/04/servo-problems-with-arduino-part-1.html
then watch this
http://rcarduino.blogspot.com/2012/04/servo-problems-part-2-demonstration.html

Rcarduino.blogspot.com

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
//


Read this
http://rcarduino.blogspot.com/2012/04/servo-problems-with-arduino-part-1.html
then watch this
http://rcarduino.blogspot.com/2012/04/servo-problems-part-2-demonstration.html

Rcarduino.blogspot.com

Carlos mononoke

Duane at this moment a haven,t any place for show my proyects but i want to do one blog.
Whent this happend of course I put the link to your work.
But, one more time, Thanks, this week i want to change my code for include RC control i will tell you how works all together.

Carlos mononoke

only one question? Can i asing the receiver to Analog i/o (A10 t0 A15 in the arduino mega) or this is not allow???
thanks!!!

DuaneB

Hi,
   You should be able to, try it.

   Why do you want to though ?

   I always think that analog pins are more valuable than digital pins as they have functionality so try to use them last.

   If its just because you are running out of pins, there are lots of ways around that problem.

Duane B
Read this
http://rcarduino.blogspot.com/2012/04/servo-problems-with-arduino-part-1.html
then watch this
http://rcarduino.blogspot.com/2012/04/servo-problems-part-2-demonstration.html

Rcarduino.blogspot.com

Carlos mononoke

I am trying but when I veryfy say that A13 is not declare in this scoope;
I soupouse that may be is becouse is not allow by library ....
-------------------------------------------------------------------code---------------------------------
PCintPort::attachInterrupt(A13, calcThrottle,CHANGE);
------------------------------------------------------------
I want to use this pins only becouse I have made a shield for the mega and in the last moment I decide to include RC control so I am trying to keep the shield.... you know if i change the shield i must change all the circuits that i have done and I need to finish the proyect....

DuaneB

There is a plan B.

I have just spent the past few minutes hacking two RC Receivers to access all the channels through a single pin.

Are you up for taking the case off your receiver to see if yours supports this ?

Duane B
Read this
http://rcarduino.blogspot.com/2012/04/servo-problems-with-arduino-part-1.html
then watch this
http://rcarduino.blogspot.com/2012/04/servo-problems-part-2-demonstration.html

Rcarduino.blogspot.com

Carlos mononoke

of course
what is what i must lok for??

DuaneB

There will be one or more chips inside, if we are lucky one of them will have the number 4015 on it - that chip is what gives us a plan B.

Duane B
Read this
http://rcarduino.blogspot.com/2012/04/servo-problems-with-arduino-part-1.html
then watch this
http://rcarduino.blogspot.com/2012/04/servo-problems-part-2-demonstration.html

Rcarduino.blogspot.com

Carlos mononoke

no...
here are :

7105
FT24C02A
TG48754
CA33g
a clock...

Carlos mononoke

well if is imposible to use the APins(or so complicated) i could sacrify one RGBLed an cut the shield for use the Digiltal 7 to 13, is less beuty but yes i am in this point.  ]:D

DuaneB

What is the receiver make and model - I will have a scan around and see what alternatives might be inside - we are looking for a counter IC or a shift register IC.

Duane B
Read this
http://rcarduino.blogspot.com/2012/04/servo-problems-with-arduino-part-1.html
then watch this
http://rcarduino.blogspot.com/2012/04/servo-problems-part-2-demonstration.html

Rcarduino.blogspot.com

Go Up