**Rotate** functions rotate bits within an Integer Register. Â There are typically 2 options:

- Rotate Left or Right?
- How many bits would you like rotated?

Rotate Left:

Example: 8 bit Int with a value 0xC5

11000101 = Value in binary

10001011 = Rotated Left 1 bit

00010111 = Rotated Left 2 bits

Rotate Right:

Example: 8 bit Int with a value 0xC5

11000101 = Value in binary

11100010 = Rotated Right 1 bit

01110001Â = Rotated Right 2 bits

**Shift** works just like Rotate, except for what happens to the end bits. Â On one side the bits are shifted out and the other bits are shifted in. Â There are typically 3 options:

- Shift Left or Right?
- How many bits would you like shifted?
- What value would you like shifted in? Â This can be a fixed value (0 or 1) or may come from a register.

Shift Left:

Example: 8 bit Int with a value 0xC5

11000101 = Value in binary

10001011Â = Shifted Left 1 bitÂ Â (Shifting in value 1)

00010111Â = ShiftedÂ LeftÂ 2 bitsÂ Â (Shifting in value 1)

Shift Right:

Example: 8 bit Int with a value 0xC5

11000101 = Value in binary

01100010Â = Shifted RightÂ 1 bitÂ Â (Shifting in value 0)

00110001Â = ShiftedÂ RightÂ 2 bitsÂ Â (Shifting in value 0)

: count(): Parameter must be an array or an object that implements Countable in

Hi,

Nice website. It would be nice to know how we could apply this function to an application.

Thanks

Yeah I should add a good example here. I’ll work on it.

Here’s an example using LED outputs to create a “knight rider” type pattern. Perhaps not as practical as entertaining.

http://www.opto22.com/community/showthread.php?t=412&p=1631&viewfull=1#post1631