putled

Class: B

(legend)

Operand Stack Heap Condition Codes
  • Initial (operands):
    value or reading
  • Final (return values):
    N/A
N/A N/A

Description

-

Takes a single operand and lights the LEDs as follows.

If the operand is a value: It uses the lowest five bits of the operand to determine how to actuate the LEDs. The lowest three bits denote the 3 LEDs; bit 0 is red, bit 1 is green, and bit 2 is yellow. The next two bits (3 and 4) specify which operation to apply; 00 is set, 01 is off (active on 0), 10 is on, and 11 is toggle. For example, 31 (0x1f) toggles all three LEDs, 19 turns the red and green off (leaving yellow unchanged), and 0x2 sets the LEDS to be red off, green on, and yellow off.

Operation
Binary Value
Decimal Value
set only red on
00001
1
set only green on
00010
2
set only yellow on
00100
4
Toggle red
11001
25
Toggle green
11010
26
Toggle yellow
11100
28
Toggle all 3 LEDs
11111
31
Turn off red
01110
14
Turn off green
01101
13
Turn off yellow
01011
11
Turn off all 3 LEDs
01000
8
Turn on red
10001
17
Turn on green
10010
18
Turn on yellow
10100
20
Turn on all LEDs
10111
23


If the operand is a reading, it simply displays the lower 3 bits in on the LEDs.



This page was last updated on December 6, 2005 6:16 PM.
This work is supported by the ONR MURI Project CONTESSA and the NSF under grant number CCR-9970939.