0% found this document useful (0 votes)
563 views5 pages

Sheet 01

This document contains a study sheet for a third year computer engineering course covering microprocessor systems. It lists 34 practice problems related to microcontroller architecture, assembly language programming, I/O port programming, arithmetic and logic instructions. The problems cover topics from chapters 0 through 5 in the course textbook including memory addressing, assembly code, branching, data transfers, and conversions between BCD and ASCII formats.

Uploaded by

Rania Nabil
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
563 views5 pages

Sheet 01

This document contains a study sheet for a third year computer engineering course covering microprocessor systems. It lists 34 practice problems related to microcontroller architecture, assembly language programming, I/O port programming, arithmetic and logic instructions. The problems cover topics from chapters 0 through 5 in the course textbook including memory addressing, assembly code, branching, data transfers, and conversions between BCD and ASCII formats.

Uploaded by

Rania Nabil
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

CSE 312 Microprocessor based Systems

Ain Shams University Faculty of Engineering Computer and Systems Department

Spring 2013 Third Year CSE

Sheet 1 (Covering Chapters 0 to 5)


March 9th, 2012

Chapter 0 INTRODUCTION TO COMPUTING


1. Find the total amount of the memory in units requested, for each of the following CPUs, given the size of the address buses: a) 16-bit address bus. (in K) b) 24-bit address bus. (in megs) c) 32-bit address bus. (in megabytes and gigabytes) d) 48-bit address bus. (in megabytes, gigabytes, and terabytes)

Chapter 1 THE HCS12/9S12 MICROCONTROLLER HISTORY AND FEATURES


2. What components are usually put together with the microcontroller onto a single chip? 3. In an embedded controller with on-chip ROM. Why does the size of the ROM matter?

Chapter 2 HCS12 ARCHITECTURE AND ASSEMBLY LANGUAGE PROGRAMMING


4. What is the result of the following code and where is it kept? LDAA #$15 ADDA #$13 5. Which of the following instructions is (are) illegal? a- LDAA #500 b- LDAA #50 c- LDAA #00 d- LDAA #$255 e- LDAA #$25 f- LDAA #$F5 g- ADDA mybyte , #$25 6. Which of the following instructions is (are) illegal? a- ADDA #$300 b- ADDA #$50 c- ADDA #$500 d- ADDA #$255 e- ADDA #12 f- ADDA#$F5 g- ADDA #$25 7. 8. 9. 10. Show a simple code to load values 30H and 97H into locations 805H and 806H, respectively. Show a simple code to load value 55H into locations 300H and 308H. Show a simple code to load value 5FH into Port B. Which of the following is an invalid use of the immediate addressing mode? a- LDDA #$24 b- LDAA $30 c- LDAA #$60

11. Identify the addressing mode for each of the following: a- STAA PORTB b- LDAA #$50 c- STAA $800 d- LDAA #0 e- CLRA f- ABA 12. Indicate the size of instruction for each of the following: a- STAA PORTB b- LDAA #$50 c- STAA $800 dLDAA #0 e- CLRA f- ABA

Chapter 3 BRANCH, CALL, AND TIME DELAY LOOP


13. Find the number of the times the following loop is performed: REGA EQU $800 REGB EQU $801 LDAA #200 STAA REGA BACK LDAA #100 STAA REGB HERE DEC REGB BNE HERE DEC REGA BNE BACK 14. Write two versions of a program to transfer a block of data one byte at a time. Use a) The LDAA and STAA instructions, and b) The MOVW instructions. Compare the size of the two programs. Which one takes fewer ROM locations? 15. Write two versions of a program to transfer a block of data one word at a time. Use a) The LDD and STD instructions, and b) The MOVW instruction. Compare the size of the two programs. Which one takes fewer ROM locations?

Chapter 4 HCS12/9S12 I/O PORT PROGRAMMING


16. Write a program to get 8-bit data from PORTA and send it to PORTB and PORTH. 17. Write a program to get 8-bit data from PORTD and send it to PORTA and PORTH. 18. Write a program to toggle all the bits of PORTA and PORTB continuously A) Using AAH and 55H B) using the complement instruction. 19. Write a program to toggle PB2 and PB5 continuously without disturbing the rest of the bits. 20. Write a program to toggle PB3, PB7 and PB5 continuously without disturbing the rest of bits. 21. Write a program to monitor bit PH3. When it is HIGH, send 55H to PORTB.

Chapter 5 ARITHMETIC, LOGIC INSTRUCTIONS, AND PROGRAMS


22. Find the C, Z and H flags for each of the following: a) LDAA #$3F ADDA #$45 b) LDAA #$99 ADDA #$58 c) LDAA #$FF STAA MYREG SEC LDAA #0 ADCA MYREG d) LDAA #$FF ADDA #$1 e) LDAA #$FF STAA MYREG SEC LDAA 0 ADCA MYREG f) CLC LDAA #$FF STAA MYREG LDAA #0 ADCA MYREG 23. Write a program to add all the digits of your ID number and save the result in a RAM location. The results must be in BCD. 24. Write a program to add the following numbers and save the result in a RAM location. $25, $59, $65 25. Modify Problem 24 to make the result in BCD. 26. Write a program to a. Write 25H to Ram locations $1820-$1823, and b. Add all these RAM locations, contents together, and save the result in RAM location $1860. 27. Find the contents of register A after each of the following instructions: a) LDAA #$65 ANDA #$76 b) LDAA #$70 ORAA #$6B

c) LDAA #$95 EORA #$AA d) LDAA #$5D ANDA #$78 e) LDAA #$C5 ORAA #$12 f) LDAA #$6A EORA #$6E g) LDAA #$37 ORAA #$26 28. Assume that MYREG = 85H. Indicate if it skips after compare is executed in each of the following cases: a) LDAA #$90 CMPA #$85 BHI OVER INA ADDA #$2 OVER b) LDAA #$70 CMPA #$85 BLO OVER INA ADDA #$2 OVER c) LDDA #$85 CMPA #$85 BLO NEXT INA ADDA $2 NEXT d) LDAA #$5D CMPA #$85 BHI NEXT INC A ADDA $2 NEXT

29. Find register A contents after each of the following is executed: a) LDAA #$65 CLC RORA RORA b) LDAA #$39 CLC ROLA ROLA c) CLC LDAA #$D4 RORA RORA RORA d) CLC LDAA #$A7 ROLA ROLA 30. Write a program that finds the number of the zeros in an 8-bit data item. 31. Write a program that finds the position of the first high in an 8-bit data item. The data is scanned from D0 to D7. Give the result for 68H. 32. Write a program that finds the position of the first high in an 8-bit data item. The data is scanned from D7 to D0. Give the result for 68H. 33. Write a program to convert the following packed BCD number to ASCII. Place the ASCII codes in data RAM locations starting at $840. 34. Write a program to convert the following ASCII numbers to a packed BCD. MYASC_1 EQU 8 MYASC_2 EQU 9

Most of problems in this sheet are copied from the text book: HCS12 Microcontroller and Embedded Systems: Using Assembly and C with Code Warrior, Muhammad Ali Mazidi, Janice Mazidi, Danny Causey, Pearson Prentice Hall ,2009.

You might also like