QuestionQuestion

1. Answer the following :
a. In a microcontroller, R/W memory is assigned the address range from 1100H to 12FFH; calculate the size of R/W memory.
b. Calculate the Hex equivalent of the decimal number -138 and show its binary representation in an 8-bit processor.

2. Answer the following:
a. What is the size and function of BSR register? Explain the significance of its size.
b. What is the function of a control bus?

3. Answer the following:
a. Identify the contents of W register and the status of flags by filling the blanks as these instructions are being executed.

Instruction W N OV Z C
Initial Values 0 0 0 0 0
MOVLW   0x82
ADDLW   0x22

b. Describe the action associated with CALL instruction.

4. Answer the following :
a. What is the purpose of the List File of an assembled program and what does it include?
b. Write instructions to add two hex numbers 8AH and 76H. Calculate the result (manually) and identify the status of all flags.


5. Answer the following:
a. Find the size of the delay of the code snipped below if the crystal frequency is 4 MHZ.

MYREG EQU 0x08 ; use location 08 as counter

DELAY MOVLW 0xFF
MOVLW MYREG

AGAIN NOP
NOP
DECF MYREG, F
BNZ AGAIN

RETURN

b. Assume that WREG = F0H. Perform the following operations. Indicate the result and the register where it is stored. Note: The operations are independent of each other.
i) ANDLW   0x45
ii) XORLW 0xEE
iii) IORLW 0x90   

6. Answer the following :
a. How many registers are available as the stack in PIC18 microcontroller and what is the size of the stack pointer?
b. If the CALL instruction, located at 0032H, is executed, specify the address that is stored on the stack.

7. Write a program to (a) load value 11H into locations 0‐5, and (b) add them together and place the result in WREG as the values are added. Use EQU to assign the names R0 – R5 to locations 0‐5. Show a Flowchart for your solution. Simulate your program in MPLABX IDE simulator and attach the printout of your simulation.

8. Write a program to subtract 7F9AH from BC48H and save the result in RAM memory locations starting at 40H. Show a Flowchart for your solution. Simulate your program in PIC18 IDE simulator and attach the printout of your simulation.

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

1. Calculate the byte to be loaded in the SPBRG register to set the baud in the asynchronous mode = 9600 if Fosc = 16 MHz and the BRGH bit is cleared in the TXSTA register.
Desired Baud rate = Fosc / (64X + 64) = Fosc / (64 (X + 1)
X is the value of the SPBRG register
X = 16 MHz / (64 (X + 1)) = (250000 / Desired Baudrate) – 1 = (250000/ 9600) – 1
= 26.04 – 1 = 25.04 (nearest integer value = 25)
So, X = SPBRG = 25.

2. Write a subroutine to initialize the EUSART in asynchronous mode to meet the following specifications: (1) 9600 baud with Fosc = 16 MHz, (2) one start and stop bits and 8-bit data, and (3) enable transmit and receive.
EUSART_Init
BSF TRISC,TX ;Set RC7 and RC6 as inputs
BSF TRISC,RX
MOVLW B’00100000’ ;Enable transmit, 8-bits, low speed baud
MOVWF TXSTA ;asynchromous mode
MOVLW B’00000000’ ;No, baudrate detection, 8-bit baud
MOVWF BAUDCON
MOVLW D’25’ ;SPBRG value for 9600 baud @ 16 MHz Fosc
MOVWF SPBRG
MOVLW B’10010000’ ;Enable serial port, 8-bits, receive enable
MOVWF RCSTA ;No check for Framing or Overrun errors
RETURN...

By purchasing this solution you'll be able to access the following files:
Solution.zip.

50% discount

Hours
Minutes
Seconds
$409.50 $204.75
for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Computer Science - Other Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats