Lab4_7-segment_display.YoannaRodriguez.pdf - CSULB EE346 Dr...

This preview shows page 1 - 2 out of 6 pages.

1.The PTH bits were adjusted to examine the digital display on LED 7-Segment Display. #include "Reg9s12.h" ORG $2000 ;Flash ROM Address for Dragon12 Light LDS #$4000 ;Stack LDAA #$FF STAA DDRB ;PORTB as output LDAA #$FF STAA DDRP ;PTP as output OVER LDAA #%01011011 ;7-Segment value to display 2 STAA PORTB LDAA #%00001110 ;Ground PTPO for the most left digit (try #%00001101); Shifts the location of digit STAA PTP ;also try #%00001011 and #%00000111 BRA OVER ;CPU jumps to label OVER until command is executed; thus, forming a loop. END ;This line of code will end the program when it is reached. The truth table above shows the binary input (A B C D) for each corresponding digital value (o – 8) which results in the binary output (0 g f e d c b a) displayed on the PORTB and PTP, where the PTP acts as the ground. The line of code “OVER LDAA #% 01011011 STAA PORTB” represents the binary output in LED 7-Segment Display from binary input 0010 (aka digital value, 2). Note, the label ‘OVER’ forms a loop as the CPU performs a jump to this label when it reaches code “BRA OVER” as indicated by BRA (branch always – unconditionally), thus displaying the number 2 indefinitely on the LED 7-Segment Display as shown in Figure 1. A B C D 0 g f e d c b a 0 0 0 0 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0 0 1 0 1 0 1 1 0 0 1 1 1 1 0 0 0 1 0 0 1 0 0 1 1 1 1 1 1 0 0 0 0 0 1 1 0 0 1 0 1 1 0 1 1 0 1 0 0 1 1 1 1 0 1 1 0 0 1 1 0 0 1 1 0 1 1 0 1 0 1 1 1 1 1 0 1 0 0 0 0 0 1 1 1 0 1 1 1 1 1 1 1 0 1 1 0 1 1 1 1 0 1 2 3 4 5 6 7 8 8.

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture