Problem with atmega16
The problem is i am getting the desired output only if i switch off and switch on my power supply(i am not getting my output immediately).What could be the problem?
Could you post or upload your code and a schematic of you interface between the ATMEGA16L and the HT-12D, so that one of us could review it?
I have attached the schematic with code.
The circuit looks ok..but the oscillator resistor for the HT12D should be 47K and not more than that. Just use a fixed 0.25 watt in place. Too note that the HT12E must use a 1M resistor. Cheers
Looking at your code:
#include<avr/io.h>
int main()
{
unsigned char y;
DDRB=0b00000000;
PORTB=0b11110000;//enabling pull ups for PB7-PB3
y=PINB;
DDRA=0b11111111;//Port A o/p
DDRC=0b11111111;//Port C o/p
if(y==0b00010000)//Forward
{
PORTA=0b10000000;
PORTC=0b00000000;
}
else if(y==0b00100000)//Backward
{
PORTA=0b01000000;
PORTC=0b00000000;
}
else if(y==0b00110000)//Left
.....
.....
.....
else
{
PORTA=0b00000000;
PORTC=0b00000000;
}
return 0;
}
It's a straight one shot, no loop, so if you're lucky it catches the first transmitted command and then ends. Try encapsulating the " if, else" statements in a:
while(1)
{
Your if, else statements
}
And change the resistor values as Pranam77 suggested and you should be good to go.
Ciao
Like above said. You do all the setup inside the main loop too. You can put that outside the main loop, so you sort of setup your system first - and only once. This should sort the problem out or get you a lot further.
Thank u.I got the expected output after including the while loop.However i am getting only 1.5V(instead of 5V as expected) as HIGH at the output pins.What could be the problem?
Which output pins? All of PORTA and PORTC?
How are you measuring the output voltage?
I'll take another look at the schematic.
Ciao
The pins from which i need HIGH voltage i am getting as 1.5V instead of 5V.I measured with respect to ground(common for both ht 12 D and microcontroller).
---------- Post added at 14:45 ---------- Previous post was at 14:00 ----------
I am getting 5V at the output for other programs like glowing or blinking LED.
Do you have pull-up resistors installed? If not I would suggest adding them.
Is the Jtag disabled ?
Thank you! I found out the mistake it was with my program.Now I am getting 5V at the outputs as expected.
