Equivalent for PORTB in Arduino Mega 2560


hello,

like in subject know equivalent instruction:


code: [select]

portb |= 0x01;
portb &= ~0x01;


which working in arduino uno control whether digital pin 8 13 high or low in arduino mega 2560.

thank you

same, different port register , value and/or with, depending on pin.



see pinout chart (google image search find nice pinout diagrams - search board , word pinout). typically show port pin p, followed letter of port, bit within port (for example pb0 pin referred to).

so pb0,
portb |= 0x01;
portb &= ~0x01;

while pg5, be
portg |= 0x10;
portg &= ~0x10;

note can toggle pin in single operation writing 1 pinx register, ex:
pinb=0x01;




Arduino Forum > Using Arduino > Microcontrollers > Equivalent for PORTB in Arduino Mega 2560


arduino

Comments

Popular posts from this blog

DHT11 Time out error using v0.4.1library

Sketch upload fails with Java error (___REMOVE___/bin/avrdude)!

Arduino Uno + KTY81/210 temperature sensor