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
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.
:
Edited by Moderator
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.
(Wilhelm M. - are you watching?) Well now how about that?:
1 | ldi temp0, 1<<WGM12 ; CTC mode |
2 | xout TCCR1A, temp0 |
WGM12 resides in TCCR1B.
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
Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
Log in with Google account
No account? Register here.