Question
The objective of this system is to implement an an odd-bit detection system. There are three bits of inputs and one bit of output. The
The objective of this system is to implement an an odd-bit detection system. There are three bits of inputs and one bit of output. The output is in positive logic: outputing a 1 will turn on the LED, outputing a 0 will turn off the LED. Inputs are negative logic: meaning if the switch not pressed is the input is 1, if the switch is pressed the input is 0.
PE0 is an input
PE1 is an input
PE2 is an input
PE3 is the output
The specific operation of this system
Initialize Port E to make PE0,PE1,PE2 inputs and PE3 an output
Over and over, read the inputs, calculate the result and set the output
The input/output specification refers to the input, not the switch. The following table illustrates the expected behavior relative to output PE3 as a function of inputs PE0,PE1,PE2
PE2 PE1 PE0 PE3
0 0 0 0 even number of 1s
0 0 1 1 odd number of 1s
0 1 0 1 odd number of 1s
0 1 1 0 even number of 1s
1 0 0 1 odd number of 1s
1 0 1 0 even number of 1s
1 1 0 0 even number of 1s
1 1 1 1 odd number of 1s
You could also consider the specification the LED output as a function of the switch input. The following table illustrates the expected behavior relative to LED output PE3 as a function of switch inputs
Sw2 Sw1 Sw0 LED
press press press Off even number of 1s
press press not On odd number of 1s
press not press On odd number of 1s
press not not Off even number of 1s
not press press On odd number of 1s
not press not Off even number of 1s
not not press Off even number of 1s
not not not On odd number of 1s
where press means the switch is pressed and not means the switch is not pressed.
This is the provided code:
THUMB AREA DATA, ALIGN=2 ;global variables go here ALIGN AREA |.text|, CODE, READONLY, ALIGN=2 EXPORT Start Start ; initialization code goes here loop ; put your main engine here B loop ; put any subroutines here ALIGN ; make sure the end of this section is aligned END ; end of file
Program 1 Assembly language
Do what is listed here:
;****************** main.s ***************
; Program written by: Yerraballi and Valvano
; Date Created: 1/15/2018
; Last Modified: 8/22/2018
; Brief description of the program: Solution to Lab1
; The objective of this system is to implement odd-bit counting system
; Hardware connections:
; Output is positive logic, 1 turns on the LED, 0 turns off the LED
; Inputs are negative logic, meaning switch not pressed is 1, pressed is 0
; PE0 is an input
; PE1 is an input
; PE2 is an input
; PE3 is the output
; Overall goal:
; Make the output 1 if there is an odd number of 1's at the inputs,
; otherwise make the output 0
; The specific operation of this system
; Initialize Port E to make PE0,PE1,PE2 inputs and PE3 an output
; Over and over, read the inputs, calculate the result and set the output
; NOTE: Do not use any conditional branches in your solution.
; We want you to think of the solution in terms of logical and shift operations
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started