EmbeddedRelated.com
Forums
Memfault Beyond the Launch

How to capture 25ms, Infrared (TSOP1138)?

Started by serg...@yahoo.com March 30, 2009
Dear friends,

I use WinARM and need your help. I have a LPC2124 have connected the TSOP data output to GPIO P0.8 and to CAP P.30. I will capture in 1us resolution and will output it after the 25ms are complete via UART0 to the terminal. I know these are 25000 samples. Who can give me an example to solve this big problem for me. Thanks in advanced.

BR,
Sergej

An Engineer's Guide to the LPC2100 Series

Hi Serge,

A-ha, you want to make IR spy...

What is the most difficult problem for you?
Reading an input? Sending via UART?

Regards
Vladimir

--- In l..., sergej.mueller@... wrote:
>
> Dear friends,
>
> I use WinARM and need your help. I have a LPC2124 have connected the TSOP data output to GPIO P0.8 and to CAP P.30. I will capture in 1us resolution and will output it after the 25ms are complete via UART0 to the terminal. I know these are 25000 samples. Who can give me an example to solve this big problem for me. Thanks in advanced.
>
> BR,
> Sergej
>

Why would you sample the output of a 38kHz IR demodulator at 1MHz? It seems
overkill to me.

Best,
Bogdan

On Mon, Mar 30, 2009 at 2:12 PM, wrote:

> Dear friends,
>
> I use WinARM and need your help. I have a LPC2124 have connected the TSOP
> data output to GPIO P0.8 and to CAP P.30. I will capture in 1us resolution
> and will output it after the 25ms are complete via UART0 to the terminal. I
> know these are 25000 samples. Who can give me an example to solve this big
> problem for me. Thanks in advanced.
>
> BR,
> Sergej
>
>


If you really want to make an IR spy, don't choose a sensor with an
integrated demodulator, it will only work well for signals that are
modulated with a frequency in the close proximity of the sensor's
demodulator frequency.

Best,
Bogdan

On Mon, Mar 30, 2009 at 4:06 PM, ljaschko wrote:

> Hi Serge,
>
> A-ha, you want to make IR spy...
>
> What is the most difficult problem for you?
> Reading an input? Sending via UART?
>
> Regards
> Vladimir
> --- In l... ,
> sergej.mueller@... wrote:
> >
> > Dear friends,
> >
> > I use WinARM and need your help. I have a LPC2124 have connected the TSOP
> data output to GPIO P0.8 and to CAP P.30. I will capture in 1us resolution
> and will output it after the 25ms are complete via UART0 to the terminal. I
> know these are 25000 samples. Who can give me an example to solve this big
> problem for me. Thanks in advanced.
> >
> > BR,
> > Sergej
> >
>


I want to make a IR Transmitter/Receiver for my own Standard. Duration of a complete transmission should < 25ms, 2 Start bits, 13 data bits, 1 crc bit.
OK it could be more than 1us ;-)
How can I solve this, I have ported a lot of other sourcecodes but it doesen't work. I am afraid. Who can make me an example with WinARM?
Thanks a lot.

BR,
Sergej

Dear friends,
>
>I use WinARM and need your help. I have a LPC2124 have connected the TSOP data output to GPIO P0.8 and to CAP P.30. I will capture in 1us resolution and will output it after the 25ms are complete via UART0 to the terminal. I know these are 25000 samples. Who can give me an example to solve this big problem for me. Thanks in advanced.
>
>BR,
>Sergej
>
On Mon, Mar 30, 2009 at 5:40 PM, wrote:
>
> I want to make a IR Transmitter/Receiver for my own Standard. Duration of a complete transmission should < 25ms, 2 Start bits, 13 data bits, 1 crc bit.
> OK it could be more than 1us ;-)

Careful with the terminology. You probably mean 1 _parity_ bit. "1 crc
bit" might not work as well :)
Don't expect to do highspeed with TSOP1138, and be sure to read page 3
of its datasheet
(http://www.datasheetcatalog.com/datasheets_pdf/T/S/O/P/TSOP1138.shtml)
where it lists the contraints your IR protocol must meet. You're
probably best using a commercial protocol (the list of supported
protocols is also on page 3 of its datasheet).

> How can I solve this, I have ported a lot of other sourcecodes but it doesen't work. I am afraid. Who can make me an example with WinARM?

Can you be more specific? What exactly doesn't work?

Best,
Bogdan
>
> Dear friends,
> >
> >I use WinARM and need your help. I have a LPC2124 have connected the TSOP data output to GPIO P0.8 and to CAP P.30. I will capture in 1us resolution and will output it after the 25ms are complete via UART0 to the terminal. I know these are 25000 samples. Who can give me an example to solve this big problem for me. Thanks in advanced.
> >
> >BR,
> >Sergej
> >
> >
>

I don't know how to start, should I use EXTINT or CAP?

#define BUT1PIN 8
#define VICVectCntl0_ENABLE (1<<5)
#define VIC_Channel_Timer0 4
#define TxTCR_COUNTER_ENABLE (1<<0)
#define TxTCR_COUNTER_RESET (1<<1)
#define TxMCR_INT_ON_MR0 (1<<0)
#define TxMCR_RESET_ON_MR0 (1<<1)
#define TxIR_MR0_FLAG (1<<0)

void inittimer()
{
VICVectAddr0 = (unsigned long)IR_Isr;
VICVectCntl0 = VICVectCntl0_ENABLE | VIC_Channel_Timer0; // use it for Timer 0 Interrupt:
VICIntEnable = (1<
PINSEL1 |= 0x30000000; // P0.30 as CAP0.0

T0PR = 60; // prescaler 60, timer runs at 60 MHz / 60 = 1 MHz
T0MR0 = 12000; // 12 ms High (idle) Timeout
T0MCR = TxMCR_INT_ON_MR0 | TxMCR_RESET_ON_MR0;
T0CCR = 0x0007; // Capture on both edges and enable the interrupt
T0TC = 0; // Reset timer
T0TCR = TxTCR_COUNTER_ENABLE; // Timer0 Enable
}

void IR_Isr(void)
{
T0TC = 0; // Reset timer

for (int i=0;i<1000;i++)
{
if (IO0PIN & (1< {
felder[i]=1;

}
else
{
felder[i]=0;
}
}
T0IR = TxIR_MR0_FLAG; // reset interrupt flag
VICVectAddr = 0; // Acknowledge interrupt by reseting VIC
disableIRQ();
for (int i=0;i<1000;i++)
{
PrintByte(felder[i]);
}
}

int main (void)
{
IO0DIR &= ~((1< gpio_initialisierung();
mam_initialisierung();
pll_initialisierung();
uart0_initialisierung(UART_BAUD(115200));
enableIRQ();
inittimer();

}

Dear friends,
>
>I use WinARM and need your help. I have a LPC2124 have connected the TSOP data output to GPIO P0.8 and to CAP P.30. I will capture in 1us resolution and will output it after the 25ms are complete via UART0 to the terminal. I know these are 25000 samples. Who can give me an example to solve this big problem for me. Thanks in advanced.
>
>BR,
>Sergej
>
Hi:

Given that you connected the data output to the Timer Capture pin, the easiest way to decode the data would be to use timer capture feature. In this case, instead of sampling every us the data line (which is probably unfeasible), you set up the timer to capure the data line "transitions" (rising and falling edges) and to interrupt on capture. In the ISR, you can save the captured times.The captured times are proportional to the number of bits (either 1 or 0).

After capturing all the times, you post-process them, to extract the bit sequence, check for parity errors, and then transmit your data to the UART.

Depending of the Timer clock settings, you can obtain bit resolutions well below 1us.

Regards,

Alex
--- In l..., sergej.mueller@... wrote:
>
> Dear friends,
>
> I use WinARM and need your help. I have a LPC2124 have connected the TSOP data output to GPIO P0.8 and to CAP P.30. I will capture in 1us resolution and will output it after the 25ms are complete via UART0 to the terminal. I know these are 25000 samples. Who can give me an example to solve this big problem for me. Thanks in advanced.
>
> BR,
> Sergej
>

I am a starter, could you make some lines of code so that I check it. Thanks.
Dear friends,
>
>I use WinARM and need your help. I have a LPC2124 have connected the TSOP data output to GPIO P0.8 and to CAP P.30. I will capture in 1us resolution and will output it after the 25ms are complete via UART0 to the terminal. I know these are 25000 samples. Who can give me an example to solve this big problem for me. Thanks in advanced.
>
>BR,
>Sergej
>
I hate to but in but, you first said that you've ported quite a bit of code before but need some help with this, and then a member sent you a solution to the problem. Now, you say that your only a starter and need the rest of the project! So what is it? Are you just starting out or are you looking for someone to do all your work?

________________________________
From: l... [mailto:l...] On Behalf Of s...@yahoo.com
Sent: Monday, March 30, 2009 12:48 PM
To: l...
Subject: [lpc2000] Re: How to capture 25ms, Infrared (TSOP1138)?
I am a starter, could you make some lines of code so that I check it. Thanks.

Dear friends,
>
>I use WinARM and need your help. I have a LPC2124 have connected the TSOP data output to GPIO P0.8 and to CAP P.30. I will capture in 1us resolution and will output it after the 25ms are complete via UART0 to the terminal. I know these are 25000 samples. Who can give me an example to solve this big problem for me. Thanks in advanced.
>
>BR,
>Sergej
>




Memfault Beyond the Launch