Page 1/12 Exam 1 Instructions: Turn off cell phones beepers and other noise making devices. Show all work on the front of the test papers. If you need more room make a clearly indicated note on the front of the page "MORE ON BACK" and use the back. The back of the page will not be graded without an indication on the front. You may use any of your approved class textbooks or Motorola manuals. You may not use any notes (mine or yours) examples homework labs books or calculators. Put your name at the top of each test page and be sure your exam consists of 3 distinct pages. The space provided does not necessarily represent the amount of writing necessary. You must pledge and sign this page in order for a grade to be assigned. In programs the use of comments results in more partial credit. Read each question carefully and follow the instructions. The point values for problems may be changed at prof s discretion. Part of your grade on tests quizzes labs etc. is based not only on solving the problem you are presented with but the manner in which you solve it. For example there is a difference between two programs that meet the given specifications but one is an elegant extensible 20-line solution while the other is an obfuscated 100-line program that also meets the specifications but would be difficult to extend later. Just as your future employer would value the latter program less than the first so will I in grading your assignments. This exam counts for 30-32.25% of your total grade. Unless otherwise stated assume the following: Go Gators! The oscillator frequency is precisely 4Mz. Good luck! The code should run on a 6C12B32 with 64k of external RAM and without the D-Bug4744 monitor but with the internal EEPROM RAM and Registers of your 6C12 chip. You may assume all internal register equates (at $0000 $01FF) are already done e.g. PORTT equ $00AE. Also already done are all the bit equates that you may need using the standard I have used in class and on the posted web examples (e.g. BIT0 equ %00000001 BIT76 equ %11000000 INV7 equ %01111111). PEDGE: On my honor as a University of Florida student I certify that I have neither given nor received any aid on this examination nor I have seen anyone else do so. PRINT YOUR NAME SIGN YOUR NAME DATE (5 July 07) Regrade comments below. Give page # and problem # and reason for the petition. Relax! May the Schwartz be with you! Pages Available Points 2 11 3 15 4 10 5-6 12 7-10 26 11-12 26 TOTA 100
Page 2/12 Exam 1 [5%] 1. Draw a complete mixed-logic circuit diagram to implement the below equation. Include pin numbers on your diagram and use appropriate 4 min switch circuits and an ED circuit. Use switches resistors and ED s as needed. The only IC (chip) you can use is the 74 32 (shown) but draw a logic diagram not a layout. Pick and label appropriate activation levels for A B and Y. Show the switches in their true positions. A functional block diagram of a 74 32 is shown to the right. Y = /(A * /B) 1 2 4 5 9 10 32 3 6 12 13 11 [6%] 2. Answer the following questions about asynchronous serial communication. (3%) a) If a transmitter sends data out at a frequency of 2000z how long (in seconds) does it take to send out 2000 bytes of data (using the normal serial formatting that we used)? 3 min (Show all work.) (3%) b) What was the purpose of the RS-232 chip used in lab 4? 2 min
Page 3/12 Exam 1 [2%] 3. ow many -bit ports can be added to your 6C12? Circle the best answer: 2 min 0 1 2 16 37 more than 37 Why did you circle the above answer? Explain. [4%] 4. There were two -bit 3-state transparent latches on the 6C12 development board before you added hardware in the expansion area of the board. What were their purposes? 3 min [1%] 5. Which 6C12 system works with the USB port on our 6C12 development board? 1 min [4%] 6. The UART chip we used in lab had several address lines. Describe the purpose of these address pins. 3 min [4%] 7. Why do we have pseudo-vectors on our UF-designed 6C12 boards? 3 min
Page 4/12 Exam 1 [10%]. Describe the stack on the 6C12 as it relates to a subroutine. Assume a subroutine named Sub_Ex1 is located at address $4744. Write a sample subroutine calling instruction (just min as you did many times in lab and as I did in class) at location $3701 in the box below (left). Write the stack pointer initialization instruction in the appropriate box below (right). Initialize the stack pointer at an appropriate location in internal 6C12 RAM. Address $3701 Subroutine call instruction Describe the stack... to a subroutine: Address $C000 Stack pointer initialization Draw the stack 1) after the stack is initialized 2) before the subroutine is called but after $42 is pushed on the stack 3) at the start of the subroutine execution 4) after $EF is pushed on the stack 5) after a PUA instruction and 6) after the return from the subroutine. In each case show an arrow at the location of the stack pointer. Show (valid) addresses for each of the used stack locations. Address 1-After Init 2-Before call 3-Just after call 4-After $EF push 5-After $PUA 6-After return
Page 5/12 Exam 1 15 min [12%] 9. Circle and correct the problems with the following serial port (operating at 3700 z) code? Assume Out_Char and In_Char are as used in class with data passed in register A. * Constants EOS equ 04 ESC equ 1B * Data string to be printed to the screen DATA "May the Schwartz be with you!" * Main Program outputs the above string to the * screen then waits for the user to press ESC * * INPUT: Wait for user to press ESC. * OUTPUT: String at X. * DESTROYS: A X. * REGS USED: None. * CAS: INIT_SCI OUT_STR IN_CAR. MAIN org $0F0 lds #$900 ;initialize stack pointer jmp INIT_SCI ;initialize SCI ldx DATA ;load the pointer to the string into x for OUT_STR jmp OUT_STR ;print the string to the screen jmp IN_CAR ;read in a character OOP anda ESC ;check if the character is ESC beq FINIS ;if it is ESC then finish bra OOP ;otherwise read in another character FINIS * Subroutine to output the string starting at X * * to the screen * * INPUT: X. * OUTPUT: String at X. * DESTROYS: A X * REGS USED: None * CAS: OUT_CAR OUT_STR. OUT_STR ldaa 1X ;load in a character anda EOS ;check if the character is EOS bne DONE ;if the character is EOS then finish jmp OUT_CAR ;otherwise print the character to the screen bra OUT_STR ;loop back to get the next character DONE rts * MORE ON NEXT PAGE
Page 6/12 Exam 1 [10%] 9. (Continued) * Subroutine to setup the 6C12 SCI system * * Baud Rate 3700 data bits 1 stop bit * * INPUT: None. * OUTPUT: Initializes SCI. * DESTROYS: A. * REGS USED: DDRS SC0BD SC0BD SC0CR1 * CAS: None. INIT_SCI bclr DDRS BIT1 ; Set data direction to output for bset DDRS BIT0 ; PortS bit1 (the Tx pin) ; and input for PortS bit0 (Rx) ldaa #0 ; Set baud rate to 3700 staa SC0BD ; 2Mz / 16 / 13 = 3700z ldaa #13 ; staa SC0BD ; ldaa #0 ; 1 start/stop bit data bits ; staa SC0CR1 ; no wakeup ldaa #INV32 ; Enable Tx and Rx; staa SC0CR2 ; all interrupts disabled rts
Page 7/12 Exam 1 [26%] 10. In this problem you will continuously increment an (external) output port at $C37F 5 min (OutPort) at a calculated rate (after first initializing OutPort to zero). To determine the time between OutPort increments first read an (external) input port at $D123 (InPort). The value read is in time units of ms (±5%) e.g. if InPort=3 then the time between OutPort increments is 3*ms =24ms (±5%). Note that the value of InPort is guaranteed to be between 2 and 173. You do not have to read InPort any more often than the active time between increments. Write a complete program to accomplish this task. You can not use delay loops (as we did in labs 1 and 2). The program for this problem should run on your UF 6C12 board with the monitor program. The IRQ vector is located at $FFF2; the pseudo-vector is at $36. The TOF vector is located at $FFDE; the pseudo-vector is at $01. The RTI vector is at $FFF0; the pseudo-vector is at $033. (3%) a) Describe the algorithm and 6C12 system that you plan to implement to solve this 5 min problem in some detail. Describe the initializations you will need to do in the main routine. Describe the initializations you will need to do to any interrupt service routine(s) you plan to use. (13%) b) Write a main routine initializing all things necessary. This code should never stop executing i.e. repeat it continuously. This routine should do all the necessary 10 min initializations. Note that in the next part of this problem you will write any required subroutine(s) and/or interrupt service routine(s) to complete the required program. Assume all code must be placed in the internal RAM of our 6C12. Assume our Debug4744 monitor program is available on the board. (Note: Comments are helpful!)
Page /12 Exam 1 (cont.) 10. b) [Repeated part b for your convenience.] Write a main routine initializing all things necessary. This code should never stop executing i.e. repeat it continuously. This routine should do all the necessary initializations. Note that in the next part of this problem you will write any required subroutine(s) and/or interrupt service routine(s) to complete the required program. Assume all code must be placed in the internal RAM of our 6C12. Assume our Debug4744 monitor program is available on the board. (Note: Comments are helpful!) abels Instructions Comments
Page 9/12 Exam 1 (cont.) 10. b) (Note: Comments are helpful!) abels Instructions Comments clr OutPort * ldaa #0 * staa OutPort
Page 10/12 Exam 1 (10%) 10. c) Write the subroutine(s) and/or interrupt service routine(s) to complete the required min program. abels Instructions Comments
Page 11/12 Exam 1 [26%] 11. The 6C73 is a new microcontroller very much like the 6C11 and 6C12. The only 20 min differences are discussed here. The timing diagrams for reading and writing are given. ike the 611 and 612 the 673 has a timemultiplexed address/data bus. Note the two ECK-like signals on this device F1 and F2. Note also that the high part of the address bus is tri-stated during the second half of the F1-cycle. Reset (not shown) is active-high for this device. Use the circuit elements on the next page to help you with the following hardware expansion. Do not add chips other than those given unless absolutely necessary. Add a single 16kx block of RAM starting at address $3000. Add an input port (-pins labeled InPort) and an output port ( pins labeled OutPort) both addressable by any address in the range $C000-$DFFF. Add two single bit input signals [labeled INTR1() and INTR2()] that will cause a single maskable interrupt when both of these signals are simultaneously true. This is the entire system. Do not use more address decoding than absolutely necessary i.e. use partial address decoding. This µ6c73 has on-board registers at 0-$1FF internal RAM from $00-$BFF internal EEPROM from $D00-$FFF and internal ROM from $E000- $FFFF. Do not overlap added memory and I/O with internal resources or other used address ranges. In addition to the chips/gates shown you may add SSI gates (AND NOR etc) if necessary but the best solutions (i.e. those that will earn you the most points) will use the fewest and simplest additional gates. F1 F2 R/~W A7-A0 / D7-D0 A15-A F1 F2 R/~W A7-A0 / D7-D0 A15-A A7-A0 6C73 Read Cycle A15-A D7-D0 6C73 Write Cycle A7-A0 A15-A Please USE ABES instead of wires! Please USE ABES instead of wires! i-z D7-D0 i-z RAM Addr Range: $3000 - $ = % - % InPort Addr Range: $C000 - $DFFF = % - % OutPort Addr Range: $C000 - $DFFF = % - % 6C73 pin used for INTR1 and INTR2:
Page 12/12 Exam 1 11. Please USE ABES instead of wires! Addr 7-0 / D 7-0 Addr 15- XIRQ IRQ R R/~W W 6C73 F1 F2 Reset 14 16k x bit RAM A 13 -A 0 D 7 -D 0 WE OE CS PAD 7 -PAD 0 PS 7 -PS 0 PT 7 -PT 0 PP 7 -PP 0 D 7-0 -bit Flip- Q 7-0 D 7-0 -bit Flip- Q 7-0 D 7-0 G -bit atch Q 7-0 D 7-0 G -bit atch Q 7-0 -bit Tri-State In 7- Out 7- OE D 7-0 G -bit atch Q 7-0 D 7-0 G -bit atch Q 7-0 -bit Tri-State In 7- Out 7-0 OE