Professional Way to solve this HCS12 Dragon12-JR,Work with pushbottons and 7 segment display

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

Professional Way to solve this HCS12 Dragon12-JR,Work with pushbottons and 7 segment display

3,026 Views
alyaa1190
Contributor I

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.

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

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

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

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

           5.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.

          6.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.

 

 

 

 

Hints:

  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.

Original Attachment has been moved to: assem-#-what-required.txt.zip

Original Attachment has been moved to: C-required.txt.zip

Labels (1)
0 Kudos
Reply
2 Replies

1,991 Views
Mana97
Contributor I

 How can I open the files for Assembly and C codes ?

Where I can find the answers?

0 Kudos
Reply

2,246 Views
iggi
NXP Employee
NXP Employee

Thank you for your post!

Since this is a useful information rather than a question/issue, i have converted it to a document:

Professional Way to solve this HCS12 Dragon12-JR,Work with pushbottons and 7 segment display

Regards,

iggi

0 Kudos
Reply