Port Manipulation question
hey, i'm trying replace of digitalwrites in code port manipulation speed reasons.
however, i'm wondering, how change state of 1 pin without effecting others? example, if set 1 pin high, few seconds later, want set pin next high also, how can leave other pin high without having set high again?
regards,
dan
however, i'm wondering, how change state of 1 pin without effecting others? example, if set 1 pin high, few seconds later, want set pin next high also, how can leave other pin high without having set high again?
regards,
dan
use bitwise or set bits 1 , bitwise , set bits 0.
code: [select]
portb |= 0b00000110; // set bits 1 , 2 high
portb &= ~0b00001010; // set bits 1 , 3 low (the '~' bitwise inversion changing 0b00001010 0b11110101)
Arduino Forum > Using Arduino > Programming Questions > Port Manipulation question
arduino
Comments
Post a Comment