90 likes | 221 Views
Input from Port D. In this project, we will use port D as input and port A as output, by connecting three input bits of port D to logic switches, and connecting three output bits of port A to LEDs. Your assignment will be to extend the program we worked on in the last lab.
E N D
Input from Port D In this project, we will use port D as input and port A as output, by connecting three input bits of port D to logic switches, and connecting three output bits of port A to LEDs. Your assignment will be to extend the program we worked on in the last lab. Port_a bits 4,5,6 for output, will be wired to LEDs (as before). Port_d bits 2,3,4 for input, will be wired to three of the 0-1 logic switches on the IDL-800.
MicroStamp Pin Functions Note: Port D bits 0 & 1 are used by the serial cable to download our programs. Do not use.
Exclusive OR • A useful function for complementing bits is the Exclusive-OR operation, often abbreviated as XOR. Our assembly language has EORA and EORB. 1100 XOR 0110 ------ 1010 The XOR puts in 1 in the output if either inputs are 1, BUT NOT BOTH!
Complementing with XOR • XOR can be used to complement bits: • Say we want to complement bit 2, but we don’t know (and don’t care) what bit two currently is: (bits) 3,2,1,0 Original 1101 XOR with 0100 ------ Result 1001 (bits) 3,2,1,0 changed 1001 XOR with 0100 ------ Result 1101 • Only the bit desired is flipped, all other bits, regardless of whether they are 0 or 1, are unchanged.
Example: inputtst.asm This is the same example program as before. It is NOT the solution to the last lab!
Your Assignment for Next Monday Lab Preparation: • If your program from the last lab, did not work correctly, continue to work with and debug that program using the wookie. In either case, revise your program to use the XOR operation (EORA or EORB). • Next, modify your WORKING program, so that the input PD_2 controls PA_4 output determining how fast PA_4 flashes. 0-slow, 1-fast. The other inputs/outputs work to echo the state of the switches without flashing. • PD3 PA5 • PD4 PA6 • Test your program on the wookie. • Modify your program to work on the 68HC11/Microstamp. Hands-On portion next Monday: • Wire your input switches, assembly, download, and test/debug your program from step 4 on the MicroStamp. • Demonstrate your working program to your instructor.