1 / 9

Input from Port 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.

gavivi
Download Presentation

Input from Port D

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 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.

  2. MicroStamp Pin Functions Note: Port D bits 0 & 1 are used by the serial cable to download our programs. Do not use.

  3. 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!

  4. 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.

  5. You may choose to use SW0-2

  6. Example: inputtst.asm This is the same example program as before. It is NOT the solution to the last lab!

  7. Example cont.

  8. Example cont.

  9. 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.

More Related