jeanslpo.blogg.se

Arduino uno pinout with port numbers
Arduino uno pinout with port numbers




Arduino uno pinout with port numbers Arduino uno pinout with port numbers

For example, you can set PB5 to HIGH without affecting the remaining pins of the PORTB To selectively set a single or multiple bits, one uses the logical OR. Use of logical operations in port manipulation Selective setting of bits Here, too, the restriction applies that digitalRead is selective while the PINB query in this form checks whether only PB5 is HIGH. PINB = 0b100000 instead of digitalRead(13) LOW or HIGH, of an input pin via the corresponding PINx (x = B, C, D) register. On the other hand, digitalWrite is selective.

Arduino uno pinout with port numbers

Stop! Of course, the equivalence only applies to the effect on pin 13 (PB5) because the first assignment switches all other PORTB pins to LOW. PORTB = 0b100000 equals digitalWrite(13, HIGH) To stick to the example above of Arduino pin 13: Here PORTB as an example: PORTB data registerĪ pin is HIGH if you have set the corresponding bit. If you want to set an I/O pin that you had previously set to OUTPUT into the HIGH state, you will access the responsible port data register (PORTx) as part of port manipulation. pin 5 and pin 3, then the statement looks like this:ĭDRB = 0b101000, or hexadecimal: DDRB = 0x28, or decimal: DDRB = 40 The port data register PORTx If you want to set several pins of port B to OUTPUT, e.g. By this I mean expressions such as PORTD |= (1> right shift In many articles, including my last one on IR remote controls, I have used logical operations and port manipulation.






Arduino uno pinout with port numbers