I am currently doing some embedded programming on microcontroller. What i don't understand is how do i test a pin in a particular port if it is high or low in C?
lets say i want to see if port A pin 1 is high. can i use masking? How does masking is used actually?
lets say i have
if i useCode:porrtAmask = 2 ; //00000010
I know that AND will only result 1 if both is but will it tell me that port A pin 1 is high?Code:if(mask & portregister); //portregister is the place where MCU //keeps the data
00000010 ==> this is 0x02H
so how the if loops above works?