RC5 help

Go To Last Post
14 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Guys,
I have been at this a few days now, and I think its time to break down and ask for some help. I hate to ask since this is a learning thing for me, and I really want to figure this thing out myself.

I have modified the avr410.asm code to work in a 90S8515.
Got it working ok, except that I cannot see any of the IR commands coming through.

What i have done is ported the code to an 8515, and added simple TX and RX routines to print the response to the avr terminal program.

No matter what I do, I cannot get the code to recognize any of the commands. I checked with my scope, and the receiver is definately receiving, even if it was receiving garbage, it should still show me something, but it it not showing anything at all with the exception of the "Press a key" and "You Pressed:" strings, so I know the uart routines are working ok.

The code I am using is attached. I am not using a SFH 506-36 IR receiver as per the avr410 Application Note. (don't have one yet) Instead, I removed the part from an old VCR I have. I know its not the right frequency but, shouldn't I still get some response, even if it is garbage?

I am 100% certain that the hardware is wired up correctly, as per the avr410 Application Note.

QUESTION #1:
I am still very new with AVR, (especially interrupts) and I am wondering if it might be an interrupt problem?

QUESTION #2:
If I want to use a different IR receiver (different frequency) what would I have to change in the program to compensate if anything?

Thanks for any help!
Glad to have this site around!!!

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
I removed the part from an old VCR I have. I know its not the right frequency

If you're talking about the IR modulation frequency (36kHz or 40kHz or
whatever), the transmitter and receiver have to match. I'm pretty sure
(limited experiments a long time ago) there's really no cross-detection
between the two frequencies -- indeed, I assumed that was a feature.
You can't fix this in the AVR since the SFH-506 (or whatever) removes
that level of modulation and the AVR never sees it.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

yes mckenney,
the remote control and the IR receiver module are from the same component(VCR).

Please forgive me if this is a stupid question, I was wondering if the detect routine(from the avr410.asm or the code attached) is set up for 36KHz, and if so can the routine be changed to say 40KHz or whatever receiver I am using?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

AVR410 assumes that the on/off timing of the I/R are pretty much 50% duty cycle, whilst in real life they are not. I posted some code a while ago with the fix. If you do a search for AVR410 on this forum you shoud find it.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks John, I will try it.
One QUESTION though,
is this the way the TIM0_OVF routine should look?

TIM0_OVF:
in S,sreg ;Save Status register
;Next 2 line added for 8Mhz ***
com flip ;Update every 2nd overflow
breq TIM0_OVF_exit
inc timerH

TIM0_OVF_exit:
out sreg,S
reti

I figure out most of the other changes, I will let you know if it worked.

Thanks again!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

First of all as another poster said the avr410 asumes very strict timming in the dutty cycle of the incoming pulses, which you will find out (as i did) that is not always the case.
Whether its 36Khz and 40Khz does not effect the duty cycle and/or the software as these pulses are filtered out from the ir receiving module.
What does gets effected if you have a mismatch between the receiver and transmiter is the range
Also if you moved the code to another part check that interrupt and timer registers are set up correctly but i would suggest either to find the modifications mentioned by js (haven't tested to tell you the truth) or look for another piece of code that autodetects the pulse duty cycles

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I figured out John's mods, Thank you John.

I Changed the crystal to 8MHz, changed my uart settings, I even changed the code to run on a 2313 as John did, and still nothing. I am certain that I modified the routines correctly, and double checked them.

I also figured out what the mistakes were in the avr410.asm by looking at the application note from atmel.

I know that the receiver is detecting a signal because I am getting all kinds of readings on the out pin of the IR receiver with my scope. What I am trying to do is print the response to the terminal prog. Still cannot get a response from the avr.

The IR receiver and remote that i am using belong to an old vcr.

The TIM0_OVF interrupt should not be a problem since it was ported to 8515 because of the .org directive? (.org OVF0addr)

Anyone else get the avr410 code to work?

I did download another piece of code here:
http://www.lancos.com/rc5.asm.html

However avrstudio detects 20 errors. I am sure that there is a problem with the macro.inc file.

Anyone know of any avr RC5 links? I searched and searched but did not come up with anything.

Please help, ANYONE??

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

jbosley wrote:
Anyone know of any avr RC5 links? I searched and searched but did not come up with anything.

User Projects section of the Academy - #106 & #184.

Dave

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

thanks dharper
already got those
there is no schematic for either one.

not 100% sure on how to build

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Time for a silly question: Are you fairly certain that your transmitter (TV
remote, I assume?) talks RC5 and not, e.g. MD80?

It may be time to enable some of the LED debug in the code. My reading
is that detect is fairly picky, and will return nothing if it gets much
garbage.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

McKenney,
I am not 100% sure on that
but it is a phillips VCR & remote
(That is the ir receiver came out of the VCR, which is matched to the remote)

I also have 9 other remotes
RCA, SONY,GE etc. some universal ones

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I dont have an assembler one ...

But i use Peter Dannegers code afrom avrgcc and it works like a charm

http://www.mikrocontroller.net/a...

It works 99.9999% here ,you have to extend it to extendec rc5 for the nre remotes but thats just 2 lines in c.

/Bingo

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have send you the code I have by replying to your PM. I think there is a led attached to port pb2 or pb6 to indicate when a good code is received. If the led pulses then you have received a good code and if you don't see it in you terminal program then you have to look at you serial comms.
All my connection to the led and IR receiver are on the 6 pin connector used for ISP programming.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

i got the project184 to work right from this site.

Now I just have to figure out what the codes mean......

Thanks to everyone for your help! I am sure I can figure it out now, that it is receiving.