AVR Assembler: Debugging IR Remote Control Transmitter

OP #7518466
Rate this post
useful
not useful

Hello,

I'm trying to develop a simple infrared remote-control transmitter, using an ATmega88A, assembler and the NEC modulation (please see https://www.mikrocontroller.net/articles/IRMP_-_english#NEC_+_extended_NEC for details on that).

My program isn't working correctly yet – after testing with a receiver failed, I connected a red LED to the output which produced the result that can be seen in the attached video: the LED blinks, but the transmission stretches out for circa one second, which is far too long – an NEC transmission should take about 60 ms.

I initially suspected wrong timer settings, but couldn't find any error. After reading through my code again and again, I decided to post it here in the hope that someone might have a look at it and maybe find the problem.

Thank you in advance for any help.

Best regards

– Johannes

Attached files:
Moderator (Company: Titel) #7518607
Rate this post
useful
not useful

Johannes F. wrote:

I connected a red LED to the output which produced the result

A flashing LED is way too little to debug a serial interface. You should connect a oscilloscope instead. Because with that you can determine the real pulse times and check it against the mentioned https://www.mikrocontroller.net/articles/IRMP_-_english#NEC_+_extended_NEC and find out the factor your timing is wrong.

When its "fairly ecacxt" the factor 8 you shuld check the correct setting of the clkdiv8 fuse in your AVR.

OP #7518611
Rate this post
useful
not useful

Lothar M. wrote:

You should connect a oscilloscope instead.

Yes, that's true of course, but unfortunately I don't have a DSO at the moment.

Lothar M. wrote:

When its "fairly ecacxt" the factor 8 you shuld check the correct setting of the clkdiv8 fuse in your AVR.

I already checked that; it's not programmed (i.e. value 1). I used the UART successfully with the same hardware directly before I flashed the current program, so the clock frequency has to be correct.

OP #7518953
Rate this post
useful
not useful

S. L. wrote:

WGM12 resides in TCCR1B.

Oh yes, that was a mistake – thank you!

I corrected that and, in addition, another error (forgot to clear the COM0A0 bit of TCCR0A in the ir_carrierOff macro, which caused the LED not to be switched off at the end of every other transmission).

Now, it works perfectly.

Again, S. L., thanks for your help!

Have a nice evening, – Johannes

Attached files:

Reply

Please log in before posting.

or

Log in with Google account

Registration is free and takes only a minute.

Register now