This lab is a comprehensive exercise for HCS12 parallel port (7-segment displays
ID: 1846707 • Letter: T
Question
This lab is a comprehensive exercise for HCS12 parallel port (7-segment displays) and assembly codes. A number is first tested by using idiv; if it is an odd number, then an ;oddT will be displaced at drive 7-segments; otherwise, an "even" is displaced. This lab is able to train students with the ability of operating die Dragon board, familiarizing with die parallel ports, and debugging assembly program s. Material and Equipment Diagonl2+USB Evaluation board including a USB cable and an adaptor MinilDE software Requirements: Program an assembly code to test a given number using kSv. If it is an odd number, display an "odd" (lower case) on die 7-segment displays; if it is an even number, show an :EUElT' on die 7-segment displays. You need to use ports B. and P. Please draw flow chart to show your logic flow. Procedure Draw a flow chart to show the logic flow Program the assembly codes on MinilDE Operate MinilDE software and the Dragonl2-USB Board to input the codes you made Build, load and run the codes to see what the 7-segment will display. Debug until it is successful. NOTE; The 7-segments are connected to port B in the following patternExplanation / Answer
Hi, The code can go something like this:
ldd $805 ;place the number in the memory location to dividend D
ldx #2 ;load the constant 2 into divisor X
idiv ; perform the division, the quotient is stored in X and remainder is stored in D
cmpd #1 ;compare remainder to 1
beq l1 ; if equal go to label l1 (odd)
ld PB #121 ;if even load PortB to be 1111001 in binary, i.e. 121 in decimal (big 'E' in 7-segment display)
l1: ld PB #92 ; if odd, load portB to be 1011100 in binary i.e. 92 in decimal (small 'o' in 7-segment display)
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.