PCON is not a bit addressable register. Write a C code segment that makes sure that SMOD0 (bit 6) is cleared to ‘0’ and SMOD1 (bit 7) is set or cleared based on a defined value (i.e #define SMOD1 (1) would cause bit 7 to be set.). Hint: This can be done with as few as two instructions (one to clear and one to set).
C code to make 6th bit of SMODO clear
if(SMODO & (1<<6))SMODO ^= (1<<6);
C code to make 7th bit of SMOD1 set
SMOD1 &= (1<<7);
PCON is not a bit addressable register. Write a C code segment that makes sure that...
You are writing code to control 8 stage lights in the Performing Arts Center. You start by accessing an 8-bit unsigned char value through a pointer called register. This value is used to turn lights on (1) and off (0). The diagram below is the bit map of a sample value for the stage lights, but the actual value will differ. bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 0 1 1 0 1 0 0 1 Your job is...
Assembly language 64 bit please !
An example file for set up
==========+
;| Data Segment BEGINS Here |
;+======================================================================+
segment .data
;Code this expression: sum = num1+num2
num1 dq 0 ;left operand of the addition operation
num2 dq 0 ;right operand of the addition operation
sum dq 0 ;will hold the computed Sum value
RetVal dq 0 ;Integer value RETURNED by function calls
;can be ignored or used as determined by the programmer
;Message string prompting for the keyboard...
A)What is the maximum delay that can generated by an 8 bit Timer with a prescale divider value of 0 and a system clock frequency of 16 MHz? B) In the HCS12, port T is a bidirectional port. Write a short segment of code (C and Assembly) that illustrates how to initialize port T so that bits 7-4 may be used as outputs and bits 3-0 may be used as inputs: C)If you are using an output compare with interrupts...
Module 6 - Cash Register (10 Points) We are going to write a program that simulates a customer's transaction at a cash register. You will organize your code using functions. Each of the functions below counts for 2 points. You must create functions allowing the user to: 1. Add an item to the order. No name or list of items is needed simply prompt the user for a dollar amount to add. 2. Clear all transactions. Set the amount of...
Goal You'll design and build a multifunction register. The register needs to meet the following requirements: 1) The register holds a 4-bit number named Q. 2) The register has a 2-bit control input, C, that selects the function that the register will perform on the next rising clock edge 3) The register has a 4-bit data input named B. ) One of the four functions that your register needs to be able to perform is to load B into the...
I just need part (d) answered
7) [24 marks] Consider the following MIPS code segment that is executed on a 5-stage pipeline architecture that does not implement forwarding or stalling in hardware. (1) add $4, $1, $1 (2) add $7, $4, $9 (3) lw $2, 400S8) (4) sub $8, $1, $2 (5) SKSs, so($2) (6) sub $2, $8, $4 (7) lw $3, 2($1) (8) add $8, $4, $2 Identify the data dependences that cause hazards. You are to use the...
Application Problem: Answer the following questions at the bottom of the worksheet: You are configuring a microcontroller (uC) to sample a signal connected to an input pin. Part of the initial setup requires that you clear (turn off) bits #17 and #2 in a 32-bit register, while leaving all other bits unchanged. To work with specific bits, we typically use a second number, called a mask, which has the bit positions we need to alter set to 1, and all...
Write MIPS code for each of the following instructions, Your assembly should implement the C code directly – i.e.,do not ’optimize’ the C code to change the order of operations or reduce computations. Use commands only like add, sub, lw, sw, immediate Part 1. x = 3-13*x; Do not use multiply. One way of doing the multiply without a multiply instruction is by using many add instructions (x+x+...+x). For this problem, you should do it with fewer additions. Hint: We...
FIRST ACTIVITY: (100/100) . SIMPLE 4-BIT ARITHMETIC LOGIC UNIT (ALU): This circuit selects between arithmetic (absolute value, addition) and logical (XOR, AND) operations. Only one result (hexadecimal value) can be shown on the 7-segment display This is selected by the input sel (1..0) B A-BI A+B A xnor B A nand B Input EN: If EN-1result appears on the 7 segment display. If EN=0 → all LEDs in the 7 segment display are off Arithmetic operations: The 4-bit inputs A...
C# Code: Write the code that simulates the gambling game of craps. To play the game, a player rolls a pair of dice (2 die). After the dice come to rest, the sum of the faces of the 2 die is calculated. If the sum is 7 or 11 on the first throw, the player wins and the game is over. If the sum is 2, 3, or 12 on the first throw, the player loses and the game is...