Is the following instruction right?
sbit led_state = P5^1 led_state= ~led_state
No, both statements are wrong: you miss ";" at the end. :-) To be serious, naturally, it will work, and this approach is the most effective. You can easily verify it yourself using your simulator. Regards, M.
sbit led_state = P5^1; led_state = ~led_state; I suspect:
sbit led_state = P5^1; led_state = ~led_state;
led_state = !led_state;
sbit led_state = P5^1; led_state ^= 1; How about this?