Major Programming Assignment Subroutine BitMapper Essay

SoccerBoss
Category:
Engineering
Price: $40 USD

Question description

BitMapper.pdf 

Description: 

 In many low-level applications bits in input and output words

 connect to individual signals (such as the T&C Code).

 Frequently the need arises to re-shuffle the bits in a word,

 to match up signals from an input to output. 

 For example, a certain industrial control application may

 have an input word from sensors, connected up to bits

 according to: 

 b7 b6 b5 b4 b3 b2 b1 b0 

 -----------------------------------------------

 | H | G | F | E | D | C | B | A |

 -----------------------------------------------

 Interpretation of each sensor signal:

 A: Fan On

 B: Tank pressure greater than P1_t

 B: Tank pressure less than P2_t

 C: Pump On 

 D: Valve #1 Open 

 E: Valve #2 Open 

 F: Motor temperature greater than T1_m

 G: Motor temperature less than T2_m

 H: Power On

 In this example, the signals must be put out on an output

 port to panel lights for the operator. Because of the way

 the panel is wired, it is necessary to arrange the signals

 according to:

 b7 b6 b5 b4 b3 b2 b1 b0 

 -----------------------------------------------

 | B | A | H | G | C | F | E | D |

 -----------------------------------------------

 The job of subroutine BitMapper is to move the signals

 from the pattern in the input to the needed pattern in

 the output word. 

 Note: you may want to use some local variables in the

 subroutine. Keep in mind that these must be variables on

 the stack. An example using stack variables is in the

 Reference Materials in SFrame.asm (page 5-29).

 The operation of Subroutine BitMapper is also described in

 the Banner Heading, Below.II. Testing: A testing routine (an executive routine to test

 BitMapper) is included below. 

III. Demonstration: Demonstrate the operation of your program in

 Wookie. This program does not run on the RSP.

IV. Note the Major Programming requirements (in the syllabus), and

 the EE 367 Programming Style Guidelines (in the Reference

 Materials).

 This assignment will be graded with the Major Program Eval

 sheet, and with careful review of attention to the Guidelines.

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 ;; Main:

 ;; Test routine for BitMapper. Main:

 ;; * Reads data from Port E, 

 ;; * Passes that data through BitMapper, 

 ;; * Then displays result on Port B. 

 ;;

 ;; Inputs: Data read on Port E. 

 ;;

 ;; Outputs: none. 

 ;;

 ;; Side Effects: Display data on Port B. 

 ;;

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 ;; Constants Block

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

PortB EQU $1004 ;; Address of PortB

PortE EQU $100A ;; Address of PortE

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 ;; Data Block

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 ORG $0000 ;; Start of RAM memory

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 ;; Code Block

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 ORG $C000

 LDS #$00FF

Main:

 ;; Setup inputs as needed 

 LDAA PortE

 ;; Call your subroutine here

 JSR BitMapper

 ;; Display the output of BitMapper

 STAA PortB

 JMP Main ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 ;; Subroutine BitMapper

 ;; 

 ;; BitMapper remaps the bits in an 8-bit word 

 ;; according to:

 ;;

 ;; Input Bits:

 ;; -----------------------------------------------

 ;; | H | G | F | E | D | C | B | A |

 ;; -----------------------------------------------

 ;;

 ;; Output Bits:

 ;; -----------------------------------------------

 ;; | B | A | H | G | C | F | E | D |

 ;; -----------------------------------------------

 ;;

 ;; 

 ;; Inputs:

 ;; Reg A: One Byte of data with 8 bits.

 ;;

 ;; Outputs: 

 ;; Reg A: One Byte of data with 8 bits rearranged 

 ;; according to the figure above. 

 ;; 

 ;; Side Effects: None. 

 ;; 

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


Tutor Answer

(Top Tutor) Daniel C.
(997)
School: UC Berkeley
PREMIUM TUTOR
Studypool has helped 1,244,100 students
Ask your homework questions. Receive quality answers!

Type your question here (or upload an image)

1819 tutors are online

Brown University





1271 Tutors

California Institute of Technology




2131 Tutors

Carnegie Mellon University




982 Tutors

Columbia University





1256 Tutors

Dartmouth University





2113 Tutors

Emory University





2279 Tutors

Harvard University





599 Tutors

Massachusetts Institute of Technology



2319 Tutors

New York University





1645 Tutors

Notre Dam University





1911 Tutors

Oklahoma University





2122 Tutors

Pennsylvania State University





932 Tutors

Princeton University





1211 Tutors

Stanford University





983 Tutors

University of California





1282 Tutors

Oxford University





123 Tutors

Yale University





2325 Tutors