required syntax to initialise pins in avr compiler

Thread Starter

snlkrishna6

Joined Mar 28, 2017
15
sir i am doing a project on dc motor control using at89s52 microcontroller using bluetooth
in keil compiler we use sbit to assign a pin to some variable
what is the syntax for assigning a pin avr compiler
 

DickCappels

Joined Aug 21, 2008
7,953
Using WINAVR I used this:

PORTA = 0b10000000;
DDRA = 0b01111111;
PORTB =0b00000111;
DDRB = 0b00001000;

Where PORTA is the output of PORTA, and DDRA is the data direction register of Port A. On the AVR controllers setting a bit in data direction register to "1" causes the corresponding port pin to be an output.
 

Thread Starter

snlkrishna6

Joined Mar 28, 2017
15
Using WINAVR I used this:

PORTA = 0b10000000;
DDRA = 0b01111111;
PORTB =0b00000111;
DDRB = 0b00001000;

Where PORTA is the output of PORTA, and DDRA is the data direction register of Port A. On the AVR controllers setting a bit in data direction register to "1" causes the corresponding port pin to be an output.
sir i connected a push button to pin 1^1
i want to read the signal from that button to a variable like 'start'
how to assign that pin to this variable
 
Top