F
frenchy
Howdy,
What input capture mode is best for capturing a servo PPM using a
PIC24FJ64GA002? I need to capture every edge (ICM2:ICM0 = 001), but
then the time between two captures isn't necessarily always the pulse
I am looking for....it might be the 18ms "dead time" between pulses.
I wish I could set it to capture the falling, then rising edges and
interrupt on the latter (my polarity is reversed if I use an inverting
common emitter buffer for interfacing). But according to the below
choices, if I want to detect both rising AND falling, it has no
intelligence as to whether the interrupt was caused by rising or
falling. Using a hardware peripheral like this, I didnt think I had
to implement all kinds of software checking to see what I ended up
with (to keep the ISR short)..
any comments would be helpful.
respectfully,
frenchy
bit 15-14 Unimplemented: Read as '0'
bit 13 ICSIDL: Input Capture x Module Stop in Idle Control bit
1 = Input capture module will halt in CPU Idle mode
0 = Input capture module will continue to operate in CPU Idle mode
bit 12-8 Unimplemented: Read as '0'
bit 7 ICTMR: Input Capture x Timer Select bit
1 = TMR2 contents are captured on capture event
0 = TMR3 contents are captured on capture event
bit 6-5 ICI1:ICI0: Select Number of Captures per Interrupt bits
11 = Interrupt on every fourth capture event
10 = Interrupt on every third capture event
01 = Interrupt on every second capture event
00 = Interrupt on every capture event
bit 4 ICOV: Input Capture x Overflow Status Flag bit (read-only)
1 = Input capture overflow occurred
0 = No input capture overflow occurred
bit 3 ICBNE: Input Capture x Buffer Empty Status bit (read-only)
1 = Input capture buffer is not empty, at least one more capture value
can be read
0 = Input capture buffer is empty
bit 2-0 ICM2:ICM0: Input Capture x Mode Select bits(1)
111 = Input capture functions as interrupt pin only when device is in
Sleep or Idle mode (rising edge
detect only, all other control bits are not applicable)
110 = Unused (module disabled)
101 = Capture mode, every 16th rising edge
100 = Capture mode, every 4th rising edge
011 = Capture mode, every rising edge
010 = Capture mode, every falling edge
001 = Capture mode, every edge (rising and falling) - ICI<1:0> bits do
not control interrupt generation
for this mode
000 = Input capture module turned off
thx,
frenchy
What input capture mode is best for capturing a servo PPM using a
PIC24FJ64GA002? I need to capture every edge (ICM2:ICM0 = 001), but
then the time between two captures isn't necessarily always the pulse
I am looking for....it might be the 18ms "dead time" between pulses.
I wish I could set it to capture the falling, then rising edges and
interrupt on the latter (my polarity is reversed if I use an inverting
common emitter buffer for interfacing). But according to the below
choices, if I want to detect both rising AND falling, it has no
intelligence as to whether the interrupt was caused by rising or
falling. Using a hardware peripheral like this, I didnt think I had
to implement all kinds of software checking to see what I ended up
with (to keep the ISR short)..
any comments would be helpful.
respectfully,
frenchy
bit 15-14 Unimplemented: Read as '0'
bit 13 ICSIDL: Input Capture x Module Stop in Idle Control bit
1 = Input capture module will halt in CPU Idle mode
0 = Input capture module will continue to operate in CPU Idle mode
bit 12-8 Unimplemented: Read as '0'
bit 7 ICTMR: Input Capture x Timer Select bit
1 = TMR2 contents are captured on capture event
0 = TMR3 contents are captured on capture event
bit 6-5 ICI1:ICI0: Select Number of Captures per Interrupt bits
11 = Interrupt on every fourth capture event
10 = Interrupt on every third capture event
01 = Interrupt on every second capture event
00 = Interrupt on every capture event
bit 4 ICOV: Input Capture x Overflow Status Flag bit (read-only)
1 = Input capture overflow occurred
0 = No input capture overflow occurred
bit 3 ICBNE: Input Capture x Buffer Empty Status bit (read-only)
1 = Input capture buffer is not empty, at least one more capture value
can be read
0 = Input capture buffer is empty
bit 2-0 ICM2:ICM0: Input Capture x Mode Select bits(1)
111 = Input capture functions as interrupt pin only when device is in
Sleep or Idle mode (rising edge
detect only, all other control bits are not applicable)
110 = Unused (module disabled)
101 = Capture mode, every 16th rising edge
100 = Capture mode, every 4th rising edge
011 = Capture mode, every rising edge
010 = Capture mode, every falling edge
001 = Capture mode, every edge (rising and falling) - ICI<1:0> bits do
not control interrupt generation
for this mode
000 = Input capture module turned off
thx,
frenchy