Discussion in "AVR Discussion Forum" started by    sathish_org    Feb 13, 2008.
Wed Feb 13 2008, 12:50 am
#1
hi can any one help me??? i'm using atmeg8l contr... i wud lik to write de code in c. so can anyone say hw to assign a port pin to a variabl declarion(macro). jus hw v use to do 8051 controller in keil lik dis #define LED p1_0 similarly hw v hav to do in avr studio 4.12
Wed Feb 13 2008, 01:34 am
#2
#define LED PB0
Wed Feb 13 2008, 11:51 am
#3
AVR's ports are not bit addressable so you cannot define a particular pin.

and you have to install WINAVR along with AVR studio if you want to write C programs in AVR studio.
Wed Feb 13 2008, 12:01 pm
#4


#define LED PB0

abbas1707


oh my God!
how i wrote this...i was sleeping i think
Wed Feb 13 2008, 01:04 pm
#5
lets say LED is connected to PB.4 so.. you need to define this pin something like this..

#define LED 4

//to set this pin

PORTB |= 1 << LED;

// to clear this pin

PORTB &= ~(1 << LED);

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

TimmyJup
Wed May 08 2024, 12:22 am
Shawnarows
Tue May 07 2024, 10:16 pm
GlennVet
Tue May 07 2024, 04:46 pm
RonaldJoump
Tue May 07 2024, 10:15 am
Jasonkam
Mon May 06 2024, 10:00 pm
JamesroW
Mon May 06 2024, 09:37 am
Chrispes
Mon May 06 2024, 07:34 am
ArktiTic
Sun May 05 2024, 07:06 pm