Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
01/08/01 08:47
Read: times


 
#7957 - RE: Talk to a Chinese in Chinese......
Hi Daxx,

Sorry I didn't reply in time. I haven't also gone through all the postings. May be somebody already has given you the right pill to cure..... anyway,

Its as easy as .......


I have decoded over two dozens of IR remotes of different brands and formats including RC-5 etc.

All metal box IR detecters' out put is TTL compatible, it can directly drive your micro pin low or high, no Schimit or Op amps required....its already tailored good.

In fact you need a digital pulse storage Scope. If you don't have it, Just do what Rauf, has advised you.

Make a serial link between your micro and your terminal via RS-232.

Connect the metal box to any pin you like (not the Rx and Tx, you know whay.....)

Using timer in 16bit mode is OK but its a fast counter, I use DJNZ which takes more than one cpu cycle so it allows you to counter for even longer delays for slower remotes with long pulse widths.

Code as follows:

IR bit p0.0
counter equ R0


mov counter,#0ah ; arbitrarily starting value.

loop

push counter

IR $ ; wait until the IR sends a beam.....

djnz counter,$

mov c,IR ; capture IR

call delay ; to allow you to release the button

jc high

mov A,#'0' ; the pulse was low
sjmp record

high

mov A,#'1' ; the pulse was high

call send ; show pulse 1 or 0 on screen

POP counter

mov a,counter

call send ; show counter value as well

inc counter

sjmp loop

Delay..... ; suitable delay of say 2 seconds

Send...... ; serial communication routine for RS-232 use baud 9600 with 11.0592 MHz.

end


Mind you the pulse stream will always start like This:

0000000000000111111111110000000000001111111111111100000000000000000000000000000000000000001111111111110000000000001111111111111111111100000000000000000000000000000000000000000000000000111111111111........

Always increase the value of R0 after DJNZ to increase the next loop delay. (use the POPed value of R0 to give it an increment.)

Keep getting 0s until you get the first 1 (high), here stop and note the value of R0. This is the reading for Low width of the pulse. This way get the reading for the high width of the pulse.

This way you can record the entire code stream for one button.

Mind you the code repeats if you keep button pressed. But there is considerable long chain of 1111111111s between two valid code streams.

Now:

You have the values of counter for each low and high time of the IR pulse. As long as you are using the same crystal you don't have to convert the counter values into time units. Just use the values you got this way.

But be cautious, the IR pulse width changes over distance and due to ambient IR also. Always use 15% smaller values of the actual counter values to avoid errors by transmitting at any angle and distance.

OK:

you can easily devise a code for IR decoding your own, using these counter values. Or you can always ask me.


Pleae note, my approach is more like hit and trial by taking snap shot of the IR stream rather than calculating the delays in a mathematical way.

My approach has never fialed......

Good Luck

Simon

List of 48 messages in thread
TopicAuthorDate
IR please help...            01/01/70 00:00      
RE: IR please help...            01/01/70 00:00      
RE: IR please help...            01/01/70 00:00      
for aka j            01/01/70 00:00      
RE: IR please help...            01/01/70 00:00      
RE: IR please help...            01/01/70 00:00      
4 kelvin            01/01/70 00:00      
RE: IR please help...            01/01/70 00:00      
RE: IR please help...            01/01/70 00:00      
RE: IR please help...            01/01/70 00:00      
RE: IR please help...            01/01/70 00:00      
4 taylor            01/01/70 00:00      
4 aka j            01/01/70 00:00      
4 rauf            01/01/70 00:00      
RE: IR please help...            01/01/70 00:00      
4 kelvin            01/01/70 00:00      
4 eric            01/01/70 00:00      
SFH506-36 works oke...            01/01/70 00:00      
RE: IR please help...            01/01/70 00:00      
RE: 4 aka j            01/01/70 00:00      
RE: Serial port and basic            01/01/70 00:00      
RE: Serial port and basic            01/01/70 00:00      
for eric            01/01/70 00:00      
for steve            01/01/70 00:00      
for steve            01/01/70 00:00      
RE: Serial port and basic            01/01/70 00:00      
RE: Serial port and basic            01/01/70 00:00      
RE: Serial port and basic            01/01/70 00:00      
RE: Serial port and basic            01/01/70 00:00      
RE: IR please help...            01/01/70 00:00      
RE: Talk to a Chinese in Chinese......            01/01/70 00:00      
RE: a correction....            01/01/70 00:00      
RE: a correction....            01/01/70 00:00      
RE: a correction....            01/01/70 00:00      
for Simon            01/01/70 00:00      
RE: Talk to a Chinese in Chinese......            01/01/70 00:00      
RE: Talk to a Chinese in Chinese......            01/01/70 00:00      
RE: for aka j            01/01/70 00:00      
RE: IR please help...            01/01/70 00:00      
RE: for Daxx teryn            01/01/70 00:00      
RE: for Daxx teryn            01/01/70 00:00      
RE: for aka j            01/01/70 00:00      
RE: for Daxx teryn            01/01/70 00:00      
RE: for Daxx teryn            01/01/70 00:00      
IR help            01/01/70 00:00      
2nd serial port by software            01/01/70 00:00      
RE: 2nd serial port by software            01/01/70 00:00      
RE: 2nd serial port by software            01/01/70 00:00      

Back to Subject List