AVR learning air conditioner infrared remote control code

Publisher:大树下的大白菜yLatest update time:2012-09-18 Source: 51heiKeywords:AVR Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
/***************************************/
/* Target: avr microcontroller ATmega8l */               
/* Crystal: 3.6864Mhz                  */
/* 2007.8.20                           */
/* Source code of a learning air conditioner infrared remote controller written by a foreigner*/
/* AT24C512 stores the time data of 2 keys, */
/* Output through the serial port during learning and transmission*/
/* Both key learning and serial port learning are possible
/*With multi-keyboard communication interface
/***************************************/


//IRD-1V20 module address write EEPROM (2)

#include 
#include 
#include 
#include  
#define SYSCLK     3686400UL
#define uchar      unsigned char
#define uint       unsigned int
#define ulint      unsigned long

#define IRD_START TCCR2=0X19
#define IRD_STOP TCCR2=0X00
/* I2C device slave address  1 A0、A1、A2--GND == 0xa0  
                             2 A0、A1、A2--VCC == 0xa6 */
/* 24c512 =65536 bytes,anykey include  <1000 bytes     */  


#define devicecode       0x01                   	   
#define TWI_SLA_24C512   0xa0
//#define address 0x02 //Remote controller address   
//#define TWI_SLA_PCF8563  0xa2



#define MAX_ITER         200
#define TW_WRITE         0
#define TW_READ          1
// MT


#define TW_REP_START    0x10
#define TW_START        0x08
#define TW_MT_ARB_LOST  0x38
#define TW_MT_SLA_ACK   0x18
#define TW_MT_SLA_NACK  0x20
#define TW_MT_DATA_ACK  0x28
#define TW_MT_DATA_NACK 0x30
// MR

#define TW_MR_SLA_ACK   0x40
#define TW_MR_SLA_NACK  0x48
#define TW_MR_ARB_LOST  0x38
#define TW_MR_DATA_NACK 0x58
#define TW_MR_DATA_ACK  0x50

#define led_off        PORTC|=(1<= MAX_ITER) return -1;
begin:
    TWCR = (1<>8;                /* high 8 bits of addr */
        TWCR = (1<

Since the code is too long and the length of this article is limited, the complete code of this version can be downloaded from http://www.51hei.com/ziliao/file/IRD-1V21.rar

This was obtained from a foreign forum. It has been tested and the crystal oscillator uses an external 3.6864Mhz. The internal rc crystal oscillator may not be stable.

Keywords:AVR Reference address:AVR learning air conditioner infrared remote control code

Previous article:AVR MCU LED Experiment
Next article:Design and implementation of fatigue driving detection device based on ATMaga8

Recommended ReadingLatest update time:2024-11-16 19:51

Proteus introductory tutorial: AVR microcontroller simulation example
Introduction: This article is an introductory tutorial for Proteus and a simulation example of AVR microcontroller. 1. Simulation example of AVR microcontroller This example is to realize AVR driving LCD1602 and use oscilloscope to monitor the data line. Before you start, you need to prepare the simulation file,
[Microcontroller]
Proteus introductory tutorial: AVR microcontroller simulation example
JTAG is used to download hex files in Changxue multifunctional AVR experimental box
1) Hardware connection is the same as the JTAG simulation above 2) Open the studio and click cancel. 3) Open the menu Tools-program AVR-Connect 4) The following interface appears, select JTAG ICE-Auto, and then click connect 5) If the following interface appears, congratulations, JTAG has been connected to
[Microcontroller]
JTAG is used to download hex files in Changxue multifunctional AVR experimental box
Technical knowledge sharing: AVR microcontroller introduction and feature analysis
AVR microcontroller is a RISC microcontroller launched by Atmel in 1997. RISC (Reduced Instruction Set Computer) is relative to CISC (Complex Instruction Set Computer). RISC does not simply reduce instructions, but improves the computing speed by making the computer structure simpler and more reasonable. RISC gives p
[Power Management]
Bascom AVR MCU simulation OLED display
800000 Config Clockdiv = 1 ' make sure the chip runs at 8 MHz Config Scl = Portc.5 ' used i2c pins Config Sda = 0 ' ' -------------------------------------------------------------------------------------------- ' SSD1306 -   I2C.BAS ' ( c) MCS Electronics 1995-2015 ' Sample to demo the 128x64 I2C OLED display ' '----
[Microcontroller]
Bascom AVR MCU simulation OLED display
ABDAC peripheral audio playback design on AVR32 MCU
  The ABDAC peripheral on the AVR32 MCU is ideal for generating audio playback. This article explains how to do this and includes a link to a sample driver that generates a sine wave output.   Many embedded applications increasingly feature audio playback capabilities, whether simple audio feedback in response to us
[Microcontroller]
ABDAC peripheral audio playback design on AVR32 MCU
Track following robot using AVR microcontroller ATmega16
In this project, we will make another gadget using AVR Atmega16 microcontroller. If you are new to AVR microcontrollers, then you can refer to the previous AVR projects and tutorials. Building a robot is a challenge for all electronics enthusiasts. This challenge can be maximized if the robot can perform certain act
[Microcontroller]
Track following robot using AVR microcontroller ATmega16
AVR microcontroller related summary
1. The AVR document requires that it is best not to nest interrupts, and only this interrupt can be executed before the next interrupt is executed; 2. When the ADC is sampled, if there is an external pull-up of 51K, the circuit is broken, and the measured voltage value is 5V (the working voltage is 5V), which means t
[Microcontroller]
AVR microcontroller related summary
AVR MCU BootLoader function application source code and detailed introduction
1. Title: Application of BootLoader Function of AVR MCU 2. Introduction of Featured Chip Technology and Instructions: Most Mega series MCUs in AVR MCU have the function of self-programming of on-chip boot program, namely BootLoader function. MCU realizes self-programming by running a BootLoader program resident in
[Microcontroller]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号