After programming my Atmega16A I tried running it along with all in the circuit.
heres the circuit. its a cellphone controlled robot car **broken link removed**
I tested it using a phone and called the other phone connected to the circuit then try pressing button "2" for forward but the motor didnt run.
Im trying to find out what part I might have done something wrong, so I will start with the ATmega16A uC.
heres the program of it.
#include <mega16.h>
void main(void)
{
unsigned int k, h;
DDRA=0x00;
DDRD=0XFF;
while (1)
{
k =~PINA;
h=k & 0x0F;
switch (h)
{
case 0x02:
{
PORTD=0x89;
break;
}
case 0x08:
{
PORTD=0x86;
break;
}
case 0x04:
{
PORTD=0x85;
break;
}
case 0x06:
{
PORTD=0x8A;
break;
}
case 0x05:
{
PORTD=0x00;
break;
}
}
}
}
Is this your first attempt to program your design?
If so, you may want to add some LEDs to a few the unused port pins of the ATMEGA16A.
Doing so can come in handy during the debugging process by providing visual cues.
First, verify the device is in fact being programmed correctly, writing a simple LED blinker program or rotate one of the tires for a specific duration.