Why use `^` to get specific sbit in C51?

320 Views Asked by At
sbit OV = PSW^2

^ here is just XOR(ref) operator right? Not overloading or something.

How could I get sbit with the XOR operator?

1

There are 1 best solutions below

0
Hoki On

You shouldn't ask a question about C51 and then reference a document from the A51 manual, they are different things (although they do share similarities as well).

In your statement, the ^ is NOT the xor operator:

In the definitiopn of sbit in the C51 manual, they explain that the character ^ is used to denote the bit position in the byte address of the SFR.

This syntax is only valid for Declaration code lines.

If used inside the program, then the ^ operator is the standard bitwise xor operator from the standard C language (not specific to C51).