You are on page 1of 1

Label:

Input: RD0 set as an output


RD1 set as an output
RD2 set as an input
RD3 set as an input
RD7 set as an input
LED1 on an output on RD0
LED2 on an output on RD1
Switch 1 on RD2
Switch 2 on RD3
Switch 3 on RD7
All Switches are initially open

Output: If Switch 1 is set, then LED1 lights


If Switch 2 is set, then LED2 lights
If Switch 1 and Switch 2 are then cleared, then LED1 and LED2 lights
If Switch 3 is set, then LED1 and LED2 turn off
If Switch 3 is then cleared, then LED1 and LED2 turns off
If Switch 3 is clear and Switch 1 or Switch 2 is set, then LED1 or LED2 turns
on

Process: Turn on LED1 or LED2 when Switch 1 or Switch 2 is set respectively. Turn
off both LEDs when Switch 3 is set.

Step 1) Set RD2 as input


Step 2) Set RD3 as input
Step 3) Set RD7 as input
Step 4) Set RD0 as output
Step 5) Set RD1 as output
Step 6) Clear R01 and R02
Step 7) Check if RD2 is set
Step 7.1) TRUE
Step 7.1.1) Set RD0
Step 7.1.2) goto step 8
Step 7.2) FALSE
Step 7.1.2) goto step 8
Step 8) Check if RD3 is set
Step 8.1) TRUE
Step 8.1.1) Set RD0
Step 8.1.2) goto step 9
Step 8.2) False
Step 8.1.2) goto step 9
Step 9) Check if RD7 is set
Step 9.1) TRUE
Step 9.1.1) Clear RD0 and RD1
Step 9.1.2) goto step 9
Step 9.2) FALSE
Step 9.2.1) got step 7

You might also like