Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

ir sensor interface to avr

Status
Not open for further replies.

Disha Karnataki

Full Member level 5
Full Member level 5
Joined
Jul 20, 2013
Messages
249
Helped
9
Reputation
18
Reaction score
8
Trophy points
18
Location
india
Visit site
Activity points
2,231
i have atmega 8L-8pu & i interfaced ir sensor tsop1738 & using a remote control the sensor is as here:https://www.edaboard.com/threads/131915/
here is the datasheet of the ic: http://www.atmel.com/images/atmel-2486-8-bit-avr-microcontroller-atmega8_l_datasheet.pdf
I connected the tsop1738 o/p to the INT0 PIN(i.e PORT D 2) of the micrcontroller.
Later i dumped the program & then the ISR routine program was executing continuously even without me pressing any key on the remote control. this sensor had to trigger for low level on the INT0 pin.
Later after sometime i figured that the INT0 pin was low irrespective of the any sensor connected to it & hence always interrupt occured.
It is sure that the interrupt pin is damaged.
so i am now left with only one interrupt pin INT1 which is donot want to damage it.
here is the code:
according to me there might be mistake in initializing the port can any one suggest me what is wrong :
Code:
#include<avr/io.h>
#include<avr/interrupt.h>
#include<util/delay.h>
//#include"lcd118010.h"
int main(void)
{
DDRD=0X00;             //configuring as i/p                          
PORTD=0X0F; //sensor connected to PD2 PIN    //i   guess i am wrong somwhere here   plz   verify it i want to verify & dump the final program.  
GIMSK|=1<<INT1;           //initializing the interrupt-1
MCUCR=0X00;       
sei();               //enabling global interrupts
while(1)
{
//----
}
}

SIGNAL(SIG_INTERRUPT1)   //isr for interrupt-1 @ INT1
{
//some work done
}
 
Last edited:

Hi,

Its unlikely that just one pin of your Atmel has gone bad. How are you powering the IR module? Maybe its generating spurious transitions on the output.

Connect a 330 ohm resistor between your Atmel +5v and the module's Vcc, and also add a capacitor of about 10uF across the module's power pins.
 

ok i just connected the the sensor & now the pin didnot get damaged working fine.
now i am getting some undesired results here is the code:
Code:
#include<avr/io.h>
#include<avr/interrupt.h>
#include<util/delay.h>
//#include"lcd118010.h"
int main(void)
{
DDRB=0X0F;   //O/P
PORTB=0X00;
DDRD=0X00;
PORTD=0X0F;
GIMSK|=(1<<INT1);             //enabling ext interrupt-1
MCUCR |= (1<<ISC11);      //triggers when falling edge detected
sei();                //enable global interrupt
while(1)
{      
PORTB=0X01;
_delay_ms(1000);
PORTB=0X05;
_delay_ms(1000);
}
}

SIGNAL(SIG_INTERRUPT1)            //external interrupt 1 ISR
{
PORTB=0X0A;
_delay_ms(1000);
PORTB=0X05;
_delay_ms(1000);
return;
}
problem i am facing is:
only the ISR IS being executed as soon as i disconnect the sensor the main body gets executed.
As we know that the tsop1738 o/p will go low once any key is pressed on the remote control.
Now i have not pressed any then too the ISR is executing & as i disconnect main gets executed now what is the problem?
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top