how to interfacing with ir remot in atmega8

Status
Not open for further replies.

achuth002

Junior Member level 3
Joined
Feb 4, 2013
Messages
26
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
hyderabad
Visit site
Activity points
1,442
hi all
how interfacing with ir remote in operating with atmega8 controller
and explain the circuit diagram
i can try the read the ir remote but not understanding
 

hi all
how interfacing with ir remote in operating with atmega8 controller
and explain the circuit diagram
i can try the read the ir remote but not understanding

Can you give more details what you need? You want IR remote control using ATMega8 uC ?

Existing IR remote controller such as TV,DVD,... will be used or you need TX also ?



Try to read text description in projects, often author of project give some explanation and description.



Check this project:

AVR Project – ATmega8 Based Multi channel IR Remote
(With NEC Protocol Remote Controller)
https://extremeelectronics.co.in/avr-projects/avr-project-–-atmega8-based-multi-channel-ir-remote/
 

i canwrite the program the display the continues error is disply.
see the my code is
Code:
#include<avr/io.h>
#include<util/delay.h>
#include<avr/interrupt.h>

#include "uart.h"
#include "IRremote.h"

unsigned char dimmerFlag = 0;


void Interrupt0_Init(void);
void Interrupt1_Init(void);

void overflow1(void);

void DimmerPortPinsInit(void);
void operateDimmer(unsigned char port);

void main()
 {
	unsigned char IRData = 0;
	unsigned char rc5data = 0;	
	
	_delay_ms(20);

	UART_Init(25);

	UART_TransmitString("Testing dimmer in interrupt and overflow: \r\n");

	//set the switch in port pins
	DimmerPortPinsInit();

	//set the interrupt0
	Interrupt0_Init();

	//set the interrupt1
	Interrupt1_Init();

	//set the overflow1
	overflow1();

	IRData = 0; dimmerFlag = 0;

	sei();

	while(1)
	{
		IRData = 0;
		
		UART_TransmitString("IR data witing \r\n");

		while (RC5BitHigh());
		UART_TransmitString("IR data received \r\n");

		rc5data = rc5decode();
		IRData = (rc5data & 0xFF);

		switch(IRData)
		{
			case 110:
				operateDimmer(1);
				_delay_ms(250);
			break;

			case 109:
				operateDimmer(2);
			break;

			case 102:
				operateDimmer(3);
			break;

			default:
				UART_TransmitString("IR ERROR \r\n");
		}
		_delay_ms(250);
	}
}

SIGNAL(SIG_INTERRUPT0)
{
	// send signal to dimmer ckt
	operateDimmer(1);
}

SIGNAL(SIG_INTERRUPT1)
{
	// send signal to dimmer ckt
	operateDimmer(2);
}

SIGNAL(SIG_OVERFLOW1) 
{    
	// send signal to dimmer ckt
	TCNT1 = 0xFFFE;
	operateDimmer(3);
}


void Interrupt0_Init(void)
{
	//set the interrupt0 falling edge
	MCUCR |= _BV(1);
	//set the interrupt0
	GICR  |= _BV(6);
}

void Interrupt1_Init(void)
{
	//set the interrupt1 falling edge
	MCUCR |= _BV(3);
	//set the interrupt1
	GICR  |= _BV(7);
}

void overflow1(void)
{
	//set the timer2 in falling edge
	TCCR1A = 0x00;
	TCCR1B = 0x06;

	TCNT1 = 0xFFFE;

	//set the timer overflow interrupt enable
	TIMSK |= _BV(2);
	
}

void DimmerPortPinsInit(void)
{
	DDRB |= _BV(1) | _BV(2) | _BV(3);

	PORTB |= _BV(1) | _BV(2) | _BV(3);

	_delay_ms(50);

	PORTB &= ~( _BV(1) | _BV(2) | _BV(3));
}


void operateDimmer(unsigned char port)
{
	// send signedl to dimmer ckt
	UART_TransmitString("Switch :");
	UART_TransmitByte(port+48);
	UART_TransmitByte('\r');
	UART_TransmitByte('\n');

	PORTB |= _BV(port);

	_delay_ms(50);

	PORTB &= ~(_BV(port));
	_delay_ms(250);
}
this code out put is can display is
PHP:
Testing dimmer in interrupt and overflow:
ISwitch :1
Switch :1
Switch :1
Switch :1
Switch :1
Switch :1
Switch :1
Switch :1
Switch :1
Switch :1
Switch :1
Switch :1
Switch :1
Switch :1
Switch :1
Switch :1

tell me the any mistakes of the program

my intesnce of the out put is display the key is press the ir remote can display the assign the value is disply the output
tell me the any mistakes of the program and corrected of this program
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…