I was doing a project and I noticed the program going unexpectedly wrong. I was doubtful about the button inputs so I made a simple program to check this capability of the MCU.
I am using Atmega 16A. I wrote this simple prog:
Ignore 0x11, it still means that Pin B0 should be set high (even though it was a typo).
Now the MCU is being supplied a voltage of 5 volt DC. When the Pin A0 is grounded, the voltage on pin B0 is 3.21V and when its disconnected from ground, Pin B0 is at a voltage of 1.63 V
What's going wrong?
I am making a binary clock and without the buttons, the clock was working fine. Now I had to add the time set buttons and problems started to appear....
Any clues where I am going wrong?
I am using Atmega 16A. I wrote this simple prog:
Code:
#include <avr/io.h>
int main(void)
{
DDRA = 0x00;
DDRB = 0x11;
while(1)
{
if(bit_is_clear(PINA, 0)){
PORTB = 0x11;
}
else
PORTB = 0x00;
}
}
Ignore 0x11, it still means that Pin B0 should be set high (even though it was a typo).
Now the MCU is being supplied a voltage of 5 volt DC. When the Pin A0 is grounded, the voltage on pin B0 is 3.21V and when its disconnected from ground, Pin B0 is at a voltage of 1.63 V
What's going wrong?
I am making a binary clock and without the buttons, the clock was working fine. Now I had to add the time set buttons and problems started to appear....
Any clues where I am going wrong?