C syntax for MC9S08GT60

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

C syntax for MC9S08GT60

3,152 Views
Shankman
Contributor II
Hi,

I just wanted to know if anyone could explain this C syntax to me?

LED4 ^=1;

Thanks in advance

Kris
Labels (1)
0 Kudos
Reply
3 Replies

821 Views
Sten
Contributor IV
It can also be written as
 
LED4 = LED4 ^ 1;
 
which means
 
LED4 = LED4 XOR 1
 
which again means that if LED4 was 0 it will become 1 and if it was 1 it will become 0.
 
0 Kudos
Reply

821 Views
Shankman
Contributor II


Sten wrote:

It can also be written as


LED4 = LED4 ^ 1;


which means


LED4 = LED4 XOR 1


which again means that if LED4 was 0 it will become 1 and if it was 1 it will become 0.




Thanks heaps mate!! Makes sense now

Regards

Kris
0 Kudos
Reply

821 Views
RedMountain
Contributor I
There are quite a few good C guides out there on the web that I have found quite useful for quick reference, especially when able to search text quickly in web browsers. One that I use:

http://www.acm.uiuc.edu/webmonkeys/book/c_guide/
0 Kudos
Reply