Just got my first mbed lpc11U24 a couple of days ago.
I am trying to get some IR to USB functionality working.
Using mbed's RemoteIP class, this was easily put together.
I connected a TSOP2238 to 5v,GND and pin 21 and the
a key press on my NEC remote spits out the keycode via USB (pc.printf).
Sadly, once in a while the keycode is not recognized properly.
So I build the test code. (see below).
Every time an edge is detected, it sets pin23 respectively.
Hooking up a logic analyzer to pin 21 (B0) and pin 23 {B1), I was surprised to see that indeed my code is missing an edge once in a while.
I assume a LPC11U24 is fast enough for detecting edges ~ 1ms.
So what is going wrong?
I limited the code in the ISR as much as possible.
But no change.
Your input is appreciated.
Mat
---------
#include "mbed.h"
DigitalOut myledA(LED1);
DigitalOut myledB(LED2);
DigitalOut myledC(LED3);
DigitalOut myledD(LED4);
DigitalOut bitbang(p23);
InterruptIn evt(p21);
void isr_ledc()
{
myledC = !myledC;
bitbang = 1;
}
void isr_down()
{
bitbang = 0;
}
int main() {
evt.rise(isr_ledc);
evt.fall(isr_down);
while(1) {
myledA = 1;
wait(0.2);
myledA = 0;
wait(0.2);
}
}
Just got my first mbed lpc11U24 a couple of days ago.
I am trying to get some IR to USB functionality working. Using mbed's RemoteIP class, this was easily put together. I connected a TSOP2238 to 5v,GND and pin 21 and the a key press on my NEC remote spits out the keycode via USB (pc.printf).
Sadly, once in a while the keycode is not recognized properly. So I build the test code. (see below). Every time an edge is detected, it sets pin23 respectively.
Hooking up a logic analyzer to pin 21 (B0) and pin 23 {B1), I was surprised to see that indeed my code is missing an edge once in a while.
I assume a LPC11U24 is fast enough for detecting edges ~ 1ms. So what is going wrong?
I limited the code in the ISR as much as possible. But no change.
Your input is appreciated.
Mat
---------