Input from Port D - PowerPoint PPT Presentation

1 / 9
About This Presentation
Title:

Input from Port D

Description:

... of port D to logic switches, and connecting three output bits of port A to LEDs. ... Port_a bits 4,5,6 for output, will be wired to LEDs (as before) ... – PowerPoint PPT presentation

Number of Views:54
Avg rating:3.0/5.0
Slides: 10
Provided by: kennesawst
Category:
Tags: input | leds | port

less

Transcript and Presenter's Notes

Title: Input from Port D


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 dont
    know (and dont 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.
Write a Comment
User Comments (0)
About PowerShow.com