|
Ordering Information |
|
.: Ordering using our PayPal powered shopping cart (PayPal
account not required).
|
CAN232 : $79 |
|
|
|
|
|
CANUSB : $89 |
|
|
|
|
|
I2C232 : $79 |
|
|
|
|
|
I2CUSB : $89 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Click here to View Cart and check out.
|
|
|
|
|
 |
 |
 |
Chapter 3f1 - Variable Data with the 4 LED Output
Project (continued) |
|
C provides some shortcuts that can make programming easier.
Instead of using x = x + 0x10 we could write this in a
shorthand method as x +=
0x10;. The "plus equals" means that
whatever x is we sant to add 0x10 to it. Example programs will
be employing this method from here on out.
The following shows some common shorthand methods used in
calculations.
|
Statement |
Description |
|
x++; |
Autoincrement x, i.e. x = x + 1, x equals x plus 1 |
|
x--; |
Autodecrement x, i.e. x = x - 1, x equals x minus 1 |
|
x += 5; |
Add 5 to x |
|
x -= 4 |
Subtract 4 from 4 |
|
x *= 2; |
Multiply x by 2 |
|
x /= 10; |
Divide x by 10 |
|
x &= 0x0c; |
And x with 0x0c (mask bits 2 and 3) |
|
x |= 0x0f |
Or x with 0x0f (set the low order 4 bits) |
|
 |
|