Pages: 1 [2] 3 4   Go Down
Author Topic: Problems with R/C 6ch transmission  (Read 4407 times)
0 Members and 1 Guest are viewing this topic.
Dubai, UAE
Offline Offline
Edison Member
*
Karma: 22
Posts: 1675
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged


Cadiz (Spain)
Offline Offline
Newbie
*
Karma: 0
Posts: 36
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Dubai, UAE
Offline Offline
Edison Member
*
Karma: 22
Posts: 1675
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged


Cadiz (Spain)
Offline Offline
Newbie
*
Karma: 0
Posts: 36
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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!!!!!
Logged

Dubai, UAE
Offline Offline
Edison Member
*
Karma: 22
Posts: 1675
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Logged


Cadiz (Spain)
Offline Offline
Newbie
*
Karma: 0
Posts: 36
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Cadiz (Spain)
Offline Offline
Newbie
*
Karma: 0
Posts: 36
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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!!!
Logged

Dubai, UAE
Offline Offline
Edison Member
*
Karma: 22
Posts: 1675
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged


Cadiz (Spain)
Offline Offline
Newbie
*
Karma: 0
Posts: 36
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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....
Logged

Dubai, UAE
Offline Offline
Edison Member
*
Karma: 22
Posts: 1675
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged


Cadiz (Spain)
Offline Offline
Newbie
*
Karma: 0
Posts: 36
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

of course
what is what i must lok for??
Logged

Dubai, UAE
Offline Offline
Edison Member
*
Karma: 22
Posts: 1675
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged


Cadiz (Spain)
Offline Offline
Newbie
*
Karma: 0
Posts: 36
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

no...
here are :

7105
FT24C02A
TG48754
CA33g
a clock...
Logged

Cadiz (Spain)
Offline Offline
Newbie
*
Karma: 0
Posts: 36
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.  smiley-twist
Logged

Dubai, UAE
Offline Offline
Edison Member
*
Karma: 22
Posts: 1675
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged


Pages: 1 [2] 3 4   Go Up
Jump to: