EngineersGarage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise
You are here: Home / Replies / i dint get you… are you

i dint get you… are you

|

Microcontroller › AVR › how to make running led using atmega16 › i dint get you… are you

February 15, 2011 at 7:02 am #5534
dagakshay
Participant

i dint get you…

are you asking for PORTB=(1<<n);

 

PORTm is use to send output on port m in avr…

 

suppose i want to make PB3 means 3rd pin of  port B as high and rest all as low i can write it as

PORTB=0b00001000; // b stands for binary…

PORTB=0x80; // here x stand for hexadecimal…

or

PORTB=(1<<PB3);

PORTB=(1<<3);

 

 

if you want to put multiple pin as output (in a port) you can use:

PORTm=(1<<n)|(1<<n’)|(1<<n”);

 

but remember in above statement on n n’ n” pin will be high and rest all will be low…

 

and if you want to change only a single pin with out affecting the rest of port values use bit wise operation…. 

RSS Recent Posts

  • Panasonic RQ-A170 Walkman recorder November 16, 2025
  • Looking for obsolete item from Parallax November 16, 2025
  • Can a small solar panel safely trickle-charge old NiMH AA batteries? November 16, 2025
  • TraxMaker Pro? I only have the non-Pro version. Looking for the Pro version that has the integrated pick and place coordinates export. November 16, 2025
  • ESP32-S3 started outputting NMEA GPS location frames after EMC disturbance — what mode is this? November 15, 2025

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2025 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise