PORTC is used for both input and output |
Source is written using Atmel Studio 7:
/*
* setResetSinglePort.c
*
* Created: 4/25/2020 7:27:50 PM
* Author : admin
*/
#include <avr/io.h>
#define setButton (PINC&0b10000000)
#define resetButton (PINC&0b01000000)
int main(void)
{
DDRC=0b00111111; // PC7 AND PC6 ARE INPUT
PORTC=0b11000000; //SET PULLUP HIGH FOR PC7 AND PC6
/* Replace with your application code */
while (1)
{
if (setButton==0) PORTC=0b11000001;
if (resetButton==0) PORTC=0b11000000;
}
}
Back to main tutorial page ATMega32 tutorials in C with Atmel Studio 7.
No comments:
Post a Comment