First page Back Continue Last page Overview Graphics
Laboratory 5.3 : Bit Instructions
1. Using the BSET instruction, write a short program to turn on the LED connected to bit 2 at port S (address $d6).
The appropriate data direction bit will also need to be set. The BSET instruction can be used for this as well.
After running your program the LEDs can be turned off by modifying memory location $d6 with the debugger.
Write a zero to memory location $$d6 to turn out the LEDs.
2. Add code to the above program. Using the branch instruction(s), write a program that waits for switch 2 (bit 1) to go low (on), then lights LED 6 (use either the BSET or BCLR instruction). The program should loop until switch 2 goes low (use either the BRCLR or BRSET instruction) before lighting the LED. Remember to set all the switches high before running the program. The switches are accessed at port $ae (Port T). Use a breakpoint to stop program execution after the wait loop. When using a breakpoint the program will run at full execution speed until the breakpoint is encountered.