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

KevinTab
Sun Apr 28 2024, 05:35 am
Tumergix
Sun Apr 28 2024, 12:59 am
StevenDrulk
Sat Apr 27 2024, 08:47 pm
StephenHauct
Sat Apr 27 2024, 09:38 am
Adamsaf
Sat Apr 27 2024, 07:12 am
Robertphype
Sat Apr 27 2024, 12:23 am
ktaletrryp
Fri Apr 26 2024, 10:55 pm
Robertrip
Fri Apr 26 2024, 11:20 am