Log in

View Full Version : What does this mean?


schenkin
26-01-2005, 08:05
I found this line in the default camera code, and I can't figure out what it means:

Pwm1_red ^= 1;

it sort of looks like early pascal, in which case it would just set the variable Pwm1_red to 1, but elsewhere in the code the more traditional "=" is used.

Anyone know what this means?

--Sam
--Team 486
--Positronic Panthers

Mike Betts
26-01-2005, 08:50
I found this line in the default camera code, and I can't figure out what it means:

Pwm1_red ^= 1;

it sort of looks like early pascal, in which case it would just set the variable Pwm1_red to 1, but elsewhere in the code the more traditional "=" is used.

Anyone know what this means?

--Sam
--Team 486
--Positronic Panthers
Please search this document (http://www.lysator.liu.se/c/bwk-tutor.html) and you should find the information you are seeking now and are likely to seek in the near future.

deh03766
26-01-2005, 10:35
[QUOTE=schenkin]I found this line in the default camera code, and I can't figure out what it means:

Pwm1_red ^= 1;

This expands to Pwm1_red = Pwm1_red ^ 1;

^ is the xor operator, and like other operators, can be combined with = to give the shorthand statement that confused you

schenkin
27-01-2005, 07:55
Thanks everyone!