RC equipment usually isn't that picky when it comes to pulse and pause lengths. 500 microseconds for pulse and 10000 for pause should be a good starting point.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
Anonymous
-
2013-04-21
Hm, cat get it.
got some other code, but i want to use your lib
voidsetupPPM(){// configure Timer1 for PPM generationnoInterrupts();TCCR1A=B00110001;// COM1B1, COM1B0, WGM10 set to 1 (8-bit register)TCCR1B=B00010010;// WGM13 & CS11 set to 1 (8-bit register)TCCR1C=B00000000;TIMSK1=B00000010;// All interrupts are individually masked with the Timer Interrupt Mask Register TIMSK1TIFR1=B00000010;// Int on compare BOCR1A=PPM_PERIOD;// PPM frequency (double buffered Output Compare 16-bit Register)OCR1B=PPM_LOW;// (double buffered Output Compare 16-bit Register), hard-wired to PPM_PIN interrupts();}// Generate PPM sequenceISR(TIMER1_COMPA_vect){staticbyteChan_idx_byt=CHANNELS;staticwordChan_pulse_int[CHANNELS];// pulse widths (microseconds)staticwordSum_int=0;if(Chan_idx_byt<CHANNELS){wordchanpulse_int=Chan_pulse_int[Chan_idx_byt++];// send current channel pulseOCR1A=chanpulse_int;Sum_int+=chanpulse_int;}else{// send final sync pulseChan_idx_byt=0;OCR1A=PPM_PERIOD-Sum_int;Sum_int=0;// Read input controls and update Chan_pulse_int[]// Execution time: [2308, 2324] microseconds < OCR1Afor(bytechan_byt=0;chan_byt<CHANNELS;chan_byt++){wordcontrol_value_int=0;#ifdef TEST_MODEif(RunMode_int==RUNMODE_TEST)control_value_int=get_test_value(chan_byt);else#endifcontrol_value_int=read_control(chan_byt);Chan_pulse_int[chan_byt]=compute_channel_pulse(chan_byt,control_value_int,true);}if(RequestPpmCopy_bool){// copy the PPM sequence values into global array for the "print ppm" commandfor(bytechan_byt=0;chan_byt<CHANNELS;chan_byt++)PpmCopy_int[chan_byt]=Chan_pulse_int[chan_byt];RequestPpmCopy_bool=false;}}}// Compute the channel pulse corresponding to given analog value// chan_byt : 0-based, channel number - 1// ana_value_int : read from input: [0,1023]// enable_calibration_bool : true=apply calibration data to analog input controls, false=do not apply calibration// Return value: PWM pulse width, microsecondswordcompute_channel_pulse(bytechan_byt,wordana_value_int,booleanenable_calibration_bool){wordretval_int=0;floatvalue_flt=ana_value_int;// Map analog inputs to PPM ratesretval_int=map(constrain(value_flt,0,1023),0,1023,pwm_min,pwm_max);// Limit pulse pulse width between CHAN_PWL, CHAN_PWHretval_int=constrain(retval_int,pwm_min,pwm_max);returnretval_int;}
Last edit: dvdouden 2013-04-21
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
That code looks okay. I'd probably do things a bit differently but I don't see any big issues. If you want to use my code, check out the PPMOut class and its example.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
Anonymous
-
2013-04-21
Hm, i have tried to find the differences. but i dont find the catch...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
Anonymous
-
2013-04-21
btw, i use the following timing params for the code above:
const word PPM_PERIOD = 20000; // microseconds; send PPM sequence every 20ms for 6 channels
const word PPM_LOW = 400; // microseconds; fixed channel sync pulse width in the PPM signal
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
Anonymous
-
2013-04-22
PPM_PERIOD = 20000 is ok for the above code. My problem is: dont know what to pulse & pause in your code. :)
Tried some combin ations but still no luck. The servo at the receiver is shacking in al directions every second
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
Anonymous
-
2013-04-22
Great, SourceForge won't let me post under my own name again...
Aaah, you should've said that in the first place ;)
400 for pulse, about 4000 for pause should be enough. PPMOut has a variable frame width, I'm not sure how well FRSky will deal with that, but it shouldn't be a problem (a lot of (cheap) transmitters work this way).
If that doesn't work, try replacing updateTimings in PPMOut.cpp with the following:
void PPMOut::updateTimings()
{
uint16_t* scratch = m_timings;
uint16_t pause = m_pauseLength;
// copy all pre-calculated timings
for (uint8_t i = 0; i < m_channelCount; ++i)
{
// set pulse length
*scratch = m_pulseLength;
++scratch;
// set timing
*scratch = m_channelTimings[i] - m_pulseLength;
pause -= m_channelTimings[i];
++scratch;
}
// set final pulse length
*scratch = m_pulseLength;
++scratch;
// set pause length
*scratch = pause - m_pulseLength;
// update number of timings
m_timingCount = (m_channelCount + 1) * 2;
}
and set pause length to 20000, this will make PPMOut generate a fixed width frame.
Last edit: dvdouden 2013-04-22
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
Anonymous
-
2013-04-22
Ah! Thanks, will try it later @home!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
im trying this lib with my FrSKY modules. Got one DHT Hack Module on my Arduino Mini (5V, 16MHz) and a CPPM receiver at my Mega.
Receiver is working (need to use pin 53 for CPPM input)
But the sender... Dont know how to setup the pulse & pause lengths... any help ? :)
Regards, Frederik
RC equipment usually isn't that picky when it comes to pulse and pause lengths. 500 microseconds for pulse and 10000 for pause should be a good starting point.
Hm, cat get it.
got some other code, but i want to use your lib
Last edit: dvdouden 2013-04-21
That code looks okay. I'd probably do things a bit differently but I don't see any big issues. If you want to use my code, check out the PPMOut class and its example.
Hm, i have tried to find the differences. but i dont find the catch...
btw, i use the following timing params for the code above:
const word PPM_PERIOD = 20000; // microseconds; send PPM sequence every 20ms for 6 channels
const word PPM_LOW = 400; // microseconds; fixed channel sync pulse width in the PPM signal
http://diydrones.com/profiles/blogs/why-frsky-cppm-signal-is-so-disappointing
try 18000 or 27000 for PPM_PERIOD, it seems to be what FRSky is using.
PPM_PERIOD = 20000 is ok for the above code. My problem is: dont know what to pulse & pause in your code. :)
Tried some combin ations but still no luck. The servo at the receiver is shacking in al directions every second
Great, SourceForge won't let me post under my own name again...
Aaah, you should've said that in the first place ;)
400 for pulse, about 4000 for pause should be enough. PPMOut has a variable frame width, I'm not sure how well FRSky will deal with that, but it shouldn't be a problem (a lot of (cheap) transmitters work this way).
If that doesn't work, try replacing updateTimings in PPMOut.cpp with the following:
and set pause length to 20000, this will make PPMOut generate a fixed width frame.
Last edit: dvdouden 2013-04-22
Ah! Thanks, will try it later @home!
Ok, patched PPM Code working like a charm :)
My Projekt btw: http://dt.pe/GAl2nw
Great! Glad it works, I'll put in on my patch list :)
And holy f..., is that a remote controlled lawnmower? O_O
DvdOuden (SourceForge acting up again)
Last edit: dvdouden 2013-04-23
It is ;)
Small Video. Much use of the Library (ppmin, expo & dualrate)
http://youtu.be/hcQXAF7YBXM
That's just awesome :)