- This topic has 4 replies, 4 voices, and was last updated 13 years, 1 month ago by .
Viewing 5 posts - 1 through 5 (of 5 total)
Viewing 5 posts - 1 through 5 (of 5 total)
- You must be logged in to reply to this topic.
|
Microcontroller › AVR › Program code for input
if port A of ATMEGA16 is the input and is connected to the switch…..then how will i read the inputs..i mean wat should be the program code for it??PLS HELP…
since you are using a switch so the onput will be either +5 v or 0 v
so you can use two function to read the input
bit_is_set(parameter1,parametre2)
and
bit_is_clear(parameter1,parameter2)
U can make the port A pin as input as well as output…
For example
For reading as input.. put
DDRA=0x00;
u can refer the following link
http://www.engineersgarage.com/embedded/avr-microcontroller-projects/led-interface-circuit