--_002_201111051634pA5GYBKQ022188mailhubdmz4mitedu_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Great, sorry for my mistake, I got confused with the dsPIC input capture mo= dule. In some days I will definitely experiment (both SIM and ICD3) with IC on a PIC32MX460F512L (should act just like your 795) and report. Perhaps it's just the simulator, it's far from being perfect, this regardle= ss of what the help says. Greets, MarI/O At 12.42 2011.11.04, you wrote: >>From Microchips "PIC32 Family Reference Manual, Sect. 15 Input Capture.pd= f": > > >"Each PIC32MX device may have one or more Input Capture modules. Each >module can select >between one of two 16-bit timers for the time base or one 32-bit timer, >which is formed by >combining two 16-bit timers. Refer to the specific device data sheet for >the timers that can be >selected. >For 16-bit Capture mode, setting ICTMR (ICxCON<7>) to ?0? selects Timer3 >for capture. Setting >ICTMR (ICxCON<7>) to ?1? selects Timer2 for capture. >An Input Capture module configured to support 32-bit capture may use a >32-bit timer resource >for capture. By setting ICC32 (ICxCON<8>) to ?1?, a 32-bit timer >resource is captured. The 32-bit >timer resource is routed into the module using the existing 16-bit timer >inputs. Timer2 provides >the lower 16 bits and Timer3 provides the upper 16 bits, as shown in >Figure 15-2." > > >By the way, I'm using the PIC32MX795F512L. > > >Isaac > > >Em 4/11/2011 06:24, Electron escreveu: >> At 04.14 2011.11.04, you wrote: >>> I'm simulating a C32 application with MPLAB-SIM that uses input capture= .. >>> The timer increments and the input capture interrupt is being fired, bu= t >>> the register IC1BUF doesn't get updated, stays at zero all the time. >>> >>> The MPLAB IDE help says that input capture is implemented and works OK >>> in the simulator. >>> >>> I am using 32-bit capture mode (TMR3:TMR2). >> Are you sure that input capture works in 32bit mode? I would have wanted >> to use it but by reading the data sheet I had the impression it wouldn't >> work. >> >> I would suggest you to try if it works in 16bit mode, maybe the problem >> is this. >> >> I am interested in your findings, I will experiment in this regard too >> in some days. >> >> Cheers, >> Mario >> >> >>> Did anybody stomp with this already? Im I doing some mistake? >>> >>> >>> Some code: >>> >>> //=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >>> >>> void InitPPM( void ) >>> { >>> =20 >>> //---------------------------------------------------------------------= ----- >>> // Initialize the pins >>> >>> // IC1 is mapped to pin RD8 >>> TRISDbits.TRISD8 =3D 1; // Pin is an input >>> >>> // Enable the IC module in 32-bit mode, capturing every edge. >>> IC1CON =3D 0x00008306; >>> =20 >>> =20 >>> //---------------------------------------------------------------------= ----- >>> // Initialize the timer >>> >>> PR3 =3D (unsigned short)( TMR32_PERIOD_REGISTER >= > >>> 16 ); >>> PR2 =3D (unsigned short)( TMR32_PERIOD_REGISTER >= >=20 >>> 0 ); >>> >>> TMR3 =3D 0; >>> TMR2 =3D 0; >>> >>> // Start timers 3 and 2 as a single 32 bit timer >>> T2CON =3D 0x00008008; >>> =20 >>> =20 >>> //---------------------------------------------------------------------= ----- >>> // Enable the interrupts >>> >>> INTSetVectorPriority( INT_INPUT_CAPTURE_1_VECTOR, >>> INT_PRIORITY_LEVEL_2 ); >>> INTSetVectorSubPriority( INT_INPUT_CAPTURE_1_VECTOR, >>> INT_SUB_PRIORITY_LEVEL_0 ); >>> INTClearFlag( INT_IC1 ); >>> INTEnable( INT_IC1, INT_ENABLED ); >>> } >>> >>> //=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >>> >>> unsigned long PPM1TRise =3D 0; >>> unsigned long PPM1TFall =3D 0; >>> unsigned int PPM1Overflows =3D 0; >>> unsigned long PPM1PulseWidth =3D 0; >>> unsigned int PPM1State =3D 0; >>> >>> void __ISR( _INPUT_CAPTURE_1_VECTOR, ipl2 ) IntIC1Handler( void ) >>> { >>> unsigned long Temp; >>> >>> Temp =3D IC1BUF; >>> >>> INTClearFlag( INT_IC1 ); >>> >>> if( PORTDbits.RD8 ) >>> { >>> // Signal rise >>> PPM1TRise =3D Temp; >>> PPM1Overflows =3D 0; >>> PPM1State =3D 1; >>> } >>> else >>> { >>> // Signal fall >>> if( PPM1State =3D=3D 1 ) >>> { >>> PPM1State =3D 0; >>> if( PPM1Overflows < 2 ) >>> { >>> PPM1TFall =3D Temp; >>> PPM1PulseWidth =3D PPM1TFall - PPM1TRise; >>> } >>> else >>> { >>> // TODO: Lost the PPM signal >>> } >>> } >>> } >>> } >>> >>> //=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >>> >>> --=20 >>> http://www.piclist.com PIC/SX FAQ & list archive >>> View/change your membership options at >>> http://mailman.mit.edu/mailman/listinfo/piclist > >--=20 >http://www.piclist.com PIC/SX FAQ & list archive >View/change your membership options at >http://mailman.mit.edu/mailman/listinfo/piclist --_002_201111051634pA5GYBKQ022188mailhubdmz4mitedu_ Content-Type: text/plain; name="ATT00001.txt" Content-Description: ATT00001.txt Content-Disposition: attachment; filename="ATT00001.txt"; size=208; creation-date="Sat, 05 Nov 2011 09:39:08 GMT"; modification-date="Sat, 05 Nov 2011 09:39:08 GMT" Content-Transfer-Encoding: base64 LS0gDQpodHRwOi8vd3d3LnBpY2xpc3QuY29tIFBJQy9TWCBGQVEgJiBsaXN0IGFyY2hpdmUNClZp ZXcvY2hhbmdlIHlvdXIgbWVtYmVyc2hpcCBvcHRpb25zIGF0DQpodHRwOi8vbWFpbG1hbi5taXQu ZWR1L21haWxtYW4vbGlzdGluZm8vcGljbGlzdA0K --_002_201111051634pA5GYBKQ022188mailhubdmz4mitedu_-- .