如果我寫如何評估二進制數字的真假?
PORTA =0b00000001;
PORTB =0b00000000;
PORTC =0b11111111;
PORTD =0b10100110;
if(PORTA){
//will this block be true?if yes then why and how it is evaluated
}
if(PORTB){
//smae here,to check true or false.
}
if(PORTC){
//if true then why or false,why?
}
if(PORTD){
//same
}
如果上述說法是錯誤的,那麼如何檢查端口的狀態?
'0'是錯誤的,其他所有的都是真的。 –
「檢查端口狀態」是什麼意思?你想做什麼? – interjay
@interjay其實我想知道的是,無論是端口是true或false.in我的代碼,我寫了,PORTC = 0b11111111;那麼我使用,如果(!PINC)它來總是虛假的,當我這樣寫它,如果(〜PINC),那麼它總是成真,我很困惑怎麼辦呢 – shafeeq