Professional Way to solve this HCS12 Dragon12-JR

Showing results for 
Show  only  | Search instead for 
Did you mean: 

Professional Way to solve this HCS12 Dragon12-JR

Professional Way to solve this HCS12 Dragon12-JR

Work with pushbuttons and 7 segment display.

Write assembly (ASM) and C programs for the HCS12, as well as to work with the pushbuttons and 7-segment display on the Dragon12-JR board.  The programs find the largest and smallest numbers from an arbitrary list of eight 8-bit unsigned numbers and displays them on the 7-segment display as outlined in the following.


1. Write a program to do the following, in both ASM and C. Do not use MINA, MINM, MAXA, and MAXM instructions.

           a. Load an array of eight 8-bit unsigned numbers into RAM.

           b. Find the largest of these numbers and store it.

           c. Find the smallest of these numbers and store it.

           d. Wait for the pushbuttons (S1 or S2) to be pressed.

           e. The first time S1 is pressed, display the high nibble of the largest number; the second time S1 is pressed, display the low nibble of the largest number.
               For example, if the largest number is 0x3F, the 7-segment display should show “3” the first time S1 is pressed and “F” the second time it is pressed.

           f. Do the same for S2, except use the smallest number.

 2. Explain why debouncing is used with switches. Optional: Implement software debouncing for switch used above.



  1. These are unsigned numbers that your program will be searching through.  Make sure you are using the unsigned branch instructions in your ASM code.
  2. Your TA will be changing the numbers in your array to make sure it works for arbitrary 8-bit values. Please make sure the array is somewhere near the top of your program file.
  3. For interfacing to LEDs, 7 segment Displays, and pushbuttons see the schematic and manual of your development board. The type of the 7-segment LED on the Dragon12-JR board is common anode. All cathodes are driven individually by an output port and all anodes are internally connected together. The Dragon12-JR board uses port H to drive 7-segment cathodes.
  4. Skeleton files are provided to help you complete the asseignment.
  5. The 7-segment display communicates with the board via Port H whose address is $0260 (PTH).  Its data direction (input or output) is controlled by writing to Data Direction H register whose address is $0262 (DDRH). In order for PTH to be output (i.e. displaying something), you must set DDRH to $FF first (all bits high, all bits output).  The skeleton code does this for you this time.
  6. Almost every I/O port on the board works similarly to PTH; that is, you must set the direction of data on a corresponding data direction register before writing to or reading from it.
  7. The two pushbuttons (S1 and S2) are connected to PM6 and PM7. S1à PM6, S2à PM7
  8. A subroutine that displays the low nibble of register A is included with the skeleton ASM code. Just store a value in register A and issue jsr seg7_out to display the low nibble of A. You are required to understand how it works and to write a similar routine for the C version of your code.


This document was generated from the following discussion: Professional Way to solve this HCS12 Dragon12-JR,Work with pushbottons and 7 segment display

Labels (1)
No ratings
Version history
Last update:
‎04-02-2015 02:20 AM
Updated by: