Lecture23 - 0306-250 Assembly Language Programming Lecture Twenty-Three • Lab in Week Seven • Midterm Review Week Seven Connections • ATD –

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 0306-250 Assembly Language Programming Lecture Twenty-Three: • Lab in Week Seven • Midterm Review Week Seven Connections • ATD – Connect potentiometer (POT) from project board to HCS12 AN3 through MCU pin 24 – Get 10-bit unsigned digital value for voltage • PWM – Connect servo (white) control input to HCS12 PWM0 through MCU pin 9 – Connect servo to lab workstation power supply • (red) power input to +5 V • (black) ground input to GND – Connect project board GND to power supply GND – Generate 20-ms PWM servo control signal 2 Week Seven Pseudocode Initialize ATD, PWM, and SCI Repeat { Prompt user to adjust potentiometer Wait for user to adjust and then press a key Get A/D conversion of potentiometer voltage Print digital value Compute new servo position Print new servo position Adjust PWM to move servo to position } forever 3 Week Seven New Output Subroutine • Need to print unsigned word value • Write subroutine PutNumW – Input: D: Unsigned word value to print – Modify: CCR (after return, nothing else) • Ways to convert binary to ASCII – Divide successively by 10 until nothing left • Remainders are decimal digit values • Digits in reverse order – Divide by decreasing powers of 10 from 10,000 • Quotients are decimal digit values • Digits in order with leading zeroes • Need divide instruction: IDIV 4 IDIV S12CPUV2 Reference Manual, p. 186 5 Binary to ASCII: Successive Division by 10 D X X r D ¸ = Dividend Divisor Quotient Remainder 255 10 25 5 25 10 2 5 2 10 0 2 6 Binary to ASCII: Successive Division by Smaller Powers of 10 from Maximum Power of 10 D X X r D ¸ = Dividend Divisor Quotient Remainder 255 10000 0 255 255 1000 0 255 255 100 2 55 55 10 5 5 5 1 5 0 7 Midterm Review Lecture Twenty-Three: • Lab in Week Seven FMidterm Review Midterm Exam Coverage and Examples • Queue operations: 10% – Given: initial contents of queue buffer – Given: initial contents of queue structure – Determine contents after sequence of operations • Short answer concept questions: 25% – What is _____, (e.g., register, CCR flag, etc.), and how is it set, cleared, used, and/or useful? – Given two addressing modes, explain the difference between them. – Give an example of addressing mode _____. • Assembly instructions/programming: 65% Note: closed book, closed note, no calculator. List of HCS12 instructions (text Appendix B) will be provided. 9 Midterm Exam Programming • Write a single instruction Write one instruction that does _____. • Complete/correct a code fragment Given the desired functionality of a code fragment, complete or correct the given code fragment. • Write a code fragment (properly commented) Write a code fragment that does ____. • Write a subroutine (properly commented) Given input and output parameter specifications, write a subroutine that does ____. 10 ...
View Full Document

This note was uploaded on 05/06/2010 for the course EECC 0306-250 taught by Professor Roymelton during the Fall '10 term at RIT.

Ask a homework question - tutors are online