Forum Replies Created
Viewing 3 posts - 1 through 3 (of 3 total)
-
AuthorPosts
-
RahulParticipant
hello all,
I have a code whic i think everything is ok but while compiling it gives many errors…can any one help me to debug it. I have this for measurinf pulse width of PPM signal received by 8 channel receiver.
# define PPM_Number_of_Channels 8int failSafePulses = 0;int PPM_IN[input+1]; // Pulse Width of input signalunsigned int rise[input+1] ; //rising edge clockunsigned char ch; //PPM channel counterunsigned int fall; // Record PPM fall timeBoolean framok; // Are all measurement ok#define PPM_FAILSAFE_INPUT_MIN 1500#define PPM_ADJUST 1000void capture_int(void){T2CON = 0b1000000000000000 ; // turn on timer 2 with no prescalerTRISD = 0b1111111111111111 ; // make the d port input, to enable IC1 and IC2TRISFbits.TRISF6 = 1 ; // make F6 an input to enable the 3rd switchIC1CON = IC2CON = IC7CON = IC8CON = 0b0010000010000001 ; //IMC<2:0> = 001 (Capture every rising and falling edge)IPC0bits.IC1IP = IPC1bits.IC2IP = IPC4bits.IC7IP = IPC4bits.IC8IP = 6 ; // priority 6IFS0bits.IC1IF = IFS0bits.IC2IF = IFS1bits.IC7IF = IFS1bits.IC8IF = 0 ; // clear the interruptIEC1bits.IC7IE = 1 ; // turn on interrupt for input 1return ;}void __attribute__((__interrupt__,__no_auto_psv__)) _IC7Interrupt(void){unsigned int time ;unsigned int pulse;IFS1bits.IC7IF = 0 ; // clear the interruptwhile ( IC7CONbits.ICBNE ){time = IC7BUF ;}#if ( NORADIO == 0 )if (!PORTBbits.RB4) //first change!{fall = time ;}else{pulse = ((time – fall ) >> 1 )+ PPM_ADJUST ;if (pulse > 10000) //sync pulse{ch = 1;frameOK = true;}else{PPM_IN[ch] = pulse;if (ch < PPM_NUMBER_OF_CHANNELS + 1 )ch++; //scan next channelelse{if(frameOK == false){failSafePulses = 0 ;flags._.radio_on = 0 ;LED_GREEN = LED_OFF ;}if( (PPM_IN[FAILSAFE_INPUT_CHANNEL] > FAILSAFE_INPUT_MIN) && (PPM_IN[FAILSAFE_INPUT_CHANNEL] < FAILSAFE_INPUT_MAX ) )failSafePulses++ ;ch = 1;frameOK = true;}if ( (pulse < PPM_FAILSAFE_INPUT_MIN ) ){frameOK = false;}}}#endif}thank youRahulRahulParticipantHello AJISH ALFRED,
I already bought 8 channel receiver its from Graupner “SMC 16 SCAN 35”. working at 35 Mhz. I am using the microcontroller of PIC33 family.
RahulParticipantHello everyone,
Can anyone help me how can we implement RF remotecontrol 8 channel receiver interface with PPM.
Thank you
-
AuthorPosts
Viewing 3 posts - 1 through 3 (of 3 total)