Documente Academic
Documente Profesional
Documente Cultură
Based on learning experience, every project that want to do there must be some objective
need to achieve after implementing this mini project. After setting objectives, in the conclusion
of the project student would state that they are able to achieve all these objectives. In this mini
project, there are several objectives that we have plotted:-
Through this project, the student used three push button. Every of push button will display
the different pattern. For switch 1, it will display pattern 1. The pattern 1 will display starting
from $6D at port B and $0E at port P and ends with $5E at port B and $07 at port P. For switch
2, it will display pattern 2. The pattern 2 will display starting from $01 at Port B and $0E at Port
P and ends with $20 at Port B and $0E at Port P. Furthermore, for switch 3, it will display pattern
3. The pattern 3 will display starting from $01 at Port B and $00 at Port P. For switch 3, the
output have LED 7-segment and buzzer. For buzzer used Port T.
From the flowchart, this project have been set for output and input. For the input, the student
used port H which is switch. For output, the student used three port which are port B, port T and
port P. Port B is LED on 7-segment, port T is for buzzer and port P is each of 7-segment. After
that, it will read from switch 1 which is $01. Then, the pattern 1 will display. If it not read the
from switch 1, it will read from switch 2. If the switch 2 is $02, then it will read the program for
pattern 2. After it display the pattern 1 and pattern 2, it will end the program.
Besides that, if it not read from switch 2, then it will read from switch 3. Then, it will read from
the program pattern 3 and display it. Furthermore, in pattern 3, the output is not just LED on 7-
segment, it also have buzzer. The program for buzzer is $20 and $00 at Port T. If it not read from
switch 3, it will end the program.
HARDWARE DESIGN
Circuit Design
DDR Table & DR Table
Table 1.1 until l.4 shows that how to provide hexadecimal number and applied it in assembly
language.
PP - # 7Segment (output)
PB – 7-Segment (output)
Table 1.5 shows the switch that student used in this project. For pattern 1 used SW1, pattern 2
used SW2 and pattern 3 used SW3.
COND PH7 PH6 PH5 PH4 PH3 PH2 PH1 PH0 HEX
SW1 X X X X 0 0 0 1 01
SW2 X X X X 0 0 1 0 02
SW3 X X X X 0 1 0 0 04
Table 1.5
Table 1.6 shows how to get pattern 1 in hexadecimal number using DR table and display it on
the seven-segment. PB – LED on 7-segment (active high)
Pattern 1
COND PB7 PB6 PB5 PB4 PB3 PB2 PB1 PB0 HEX 7-
SEG
X 1 1 0 1 1 0 1 6D 0E
X 1 1 1 0 1 1 0 76 0D
X 1 0 1 1 1 1 1 5F 0B
X 1 0 1 1 1 1 0 5E 07
Table 1.6
Table 1.7 shows that how to get pattern 2 in hexadecimal number using DR table.
Pattern2
COND PB7 PB6 PB5 PB4 PB3 PB2 PB1 PB0 HEX 7-
SEG
X 0 0 0 0 0 0 1 01 0E
X 0 0 0 0 0 0 1 01 0D
X 0 0 0 0 0 0 1 01 0B
X 0 0 0 0 0 0 1 01 07
X 0 0 0 0 0 1 0 02 07
X 0 0 0 0 1 0 0 40 07
X 0 0 0 0 1 0 0 40 0B
X 0 0 0 0 1 0 0 40 0D
X 0 0 0 0 1 0 0 40 0E
X 0 0 1 0 0 0 0 10 0E
X 0 0 0 1 0 0 0 08 0E
X 0 0 0 1 0 0 0 08 0D
X 0 0 0 1 0 0 0 08 0B
X 0 0 0 1 0 0 0 08 07
X 0 0 0 0 1 0 0 04 07
X 0 0 0 0 1 0 0 40 07
X 0 0 0 0 1 0 0 40 0B
X 0 0 0 0 1 0 0 40 0D
X 0 0 0 0 1 0 0 40 0E
X 0 1 0 0 0 0 0 20 0E
Table 1.7
Table 1.8 shows that how to get pattern 3 in hexadecimal number using DR table. Pattern3
COND PB7 PB6 PB5 PB4 PB3 PB2 PB1 PB0 HEX 7-
SEG
0 0 0 0 0 0 0 1 01 00
X 0 0 0 0 0 0 0 00 00
X 1 0 0 1 0 0 1 49 0E
X 1 0 0 1 0 0 1 49 0C
X 1 0 0 1 0 0 1 49 08
X 1 0 0 1 0 0 1 49 00
X 1 0 0 1 0 0 1 49 07
X 1 0 0 1 0 0 1 49 03
X 1 0 0 1 0 0 1 49 01
X 1 0 0 1 0 0 1 49 00
X 1 0 0 1 0 0 1 49 06
X 1 0 0 1 0 0 1 49 00
X 1 0 0 1 0 0 1 49 09
X 1 0 0 1 0 0 1 49 00
X 1 0 0 0 0 0 0 40 00
0 0 0 0 0 0 0 0 00 00
X 1 0 0 1 0 0 1 49 0E
X 1 0 0 1 0 0 1 49 0C
X 1 0 0 1 0 0 1 49 08
X 1 0 0 1 0 0 1 49 00
X 1 0 0 1 0 0 1 49 07
X 1 0 0 1 0 0 1 49 03
X 1 0 0 1 0 0 1 49 01
X 1 0 0 1 0 0 1 49 00
X 1 0 0 1 0 0 1 49 06
X 1 0 0 1 0 0 1 49 00
X 1 0 0 1 0 0 1 49 09
X 1 0 0 1 0 0 1 49 00
X 1 0 0 1 0 0 1 08 00
0 0 0 0 0 0 0 0 00 00
X 1 0 0 1 0 0 1 49 0E
X 1 0 0 1 0 0 1 49 0C
X 1 0 0 1 0 0 1 49 08
X 1 0 0 1 0 0 1 49 00
X 1 0 0 1 0 0 1 49 07
X 1 0 0 1 0 0 1 49 03
X 1 0 0 1 0 0 1 49 01
X 1 0 0 1 0 0 1 49 00
X 1 0 0 1 0 0 1 49 06
X 1 0 0 1 0 0 1 49 00
X 1 0 0 1 0 0 1 49 09
X 1 0 0 1 0 0 1 49 00
COND PT7 PT6 PT5 PT4 PT3 PT2 PT1 PT0 HEX
BUZZER X X 1 X X X X X 20
ON
Figure 1.8
Masking table:
PH – button switch
COND PH7 PH6 PH5 PH4 PH3 PH2 PH1 PH0 HEX
SW X X X X 1 1 1 1 0F
ON
SOFTWARE DESIGN
Flowchart
Flow Chart Explanation
Firstly, the student set port B as output which is LED on 7-segment, set port H as input
which is switch or push button, set port T as output which is buzzer and set port P as output for
7-segment. So, the input has one which is switch while output have three which are LED on 7-
segment, buzzer and 7-segment.
Next, it will read from switch 1. When switch 1 read #$01, the Pattern 1 will display LED
on 7-segment that have been programmed. When the Pattern 1 have been display, then it will
end. If it not read #$01, it will proceed to read switch 2.
Then, when it read switch 2 #$02, it will display the Pattern 2 which that have been
programmed. Then it will end. If not, it will proceed to switch 3. In switch 3, it will read #$02
then it will display Pattern 3. In Pattern 3, the output is LED on 7-segment and buzzer. If no,
then it will end the program.
Explanation of coding
movb #$49,portb
movb %11111111,portb
Movb #$0e,ptp
jsr delay3
movb #$20,ptt
jsr delay3
movb #$00,ptt
jsr delay3
Movb #$49,portb
Movb #$0c,ptp
jsr delay3
Movb #$49,portb
Movb #$08,ptp
jsr delay3
Movb #$49,portb
Movb #$00,ptp
jsr delay3
movb #$49,portb
Movb #$07,ptp
jsr delay3
Movb #$49,portb
Movb #$03,ptp
jsr delay3
Movb #$49,portb
Movb #$01,ptp
jsr delay3
Movb #$49,portb
Movb #$00,ptp
jsr delay3
movb #$49,portb
Movb #$06,ptp
jsr delay3
Movb #$49,portb
Movb #$00,ptp
jsr delay3
Movb #$49,portb
Movb #$09,ptp
jsr delay3
Movb #$49,portb
Movb #$00,ptp
jsr delay3
movb #$20,ptt
jsr delay3
movb #$00,ptt
jsr delay3
movb #$40,portb
movb #$00,ptp
jsr delay3
movb #$00,portb
movb #$00,ptp
jsr delay3
movb #$49,portb
movb %11111111,portb
Movb #$0e,ptp
jsr delay3
movb #$20,ptt
jsr delay3
movb #$00,ptt
jsr delay3
Movb #$49,portb
Movb #$0c,ptp
jsr delay3
Movb #$49,portb
Movb #$08,ptp
jsr delay3
Movb #$49,portb
Movb #$00,ptp
jsr delay3
movb #$49,portb
Movb #$07,ptp
jsr delay3
Movb #$49,portb
Movb #$03,ptp
jsr delay3
Movb #$49,portb
Movb #$01,ptp
jsr delay3
Movb #$49,portb
Movb #$00,ptp
jsr delay3
movb #$49,portb
Movb #$06,ptp
jsr delay3
Movb #$49,portb
Movb #$00,ptp
jsr delay3
Movb #$49,portb
Movb #$09,ptp
jsr delay3
Movb #$49,portb
Movb #$00,ptp
jsr delay3
movb #$20,ptt
jsr delay3
movb #$00,ptt
jsr delay3
movb #$08,portb
movb #$00,ptp
jsr delay3
movb #$00,portb
movb #$00,ptp
jsr delay3
movb #$49,portb
movb %11111111,portb
Movb #$0e,ptp
jsr delay3
movb #$20,ptt
jsr delay3
movb #$00,ptt
jsr delay3
Movb #$49,portb
Movb #$0c,ptp
jsr delay3
Movb #$49,portb
Movb #$08,ptp
jsr delay3
Movb #$49,portb
Movb #$00,ptp
jsr delay3
movb #$49,portb
Movb #$07,ptp
jsr delay3
Movb #$49,portb
Movb #$03,ptp
jsr delay3
Movb #$49,portb
Movb #$01,ptp
jsr delay3
Movb #$49,portb
Movb #$00,ptp
jsr delay3
movb #$49,portb
Movb #$06,ptp
jsr delay3
Movb #$49,portb
Movb #$00,ptp
jsr delay3
Movb #$49,portb
Movb #$09,ptp
jsr delay3
Movb #$49,portb
Movb #$00,ptp
jsr delay3
movb #$20,ptt //program for output buzzer
jsr delay3
movb #$00,ptt
jsr delay3
jmp again
Problem Solution
The Dragon12 – plus2 trainer board We change the COM port at miniIDE setting
are not function. and also apply at device manager in computer
with the same number of COM port at
miniIDE.
Error in assembly language code We found out the error at part declare switch 3
after build the file. (e.g. “branch out and edit the coding.
of range”).
e.g. AGAIN LDAA PTH
e.g. AGAIN LDAA PTH ANDA #$01
ANDA #$01 BEQ SW1
BEQ SW1
LDAA PTH
LDAA PTH ANDA #$02
ANDA #$02 BEQ SW2
BEQ SW2
LDAA PTH
LDAA PTH ANDA #$04
ANDA #$04 BNE NONE
BEQ SW3 JMP SW3
Since we always reset the Dragon12- We troubleshoot with close the software and
board there are error which is called create the new file.
debug.
Problem with the delay coding, time Adjust coding part at delay.
taken for our pattern display is too
short.
Buzzer are not function because Study the data sheet port for Dragon12-board.
wrong port.
RESULT
From this project task, students have been decided to create a seven segment pattern
with sound using Dragon12-plus trainer board. Students have chosen a push button as the input
and a seven-segment and buzzer as the output. Students have declared the push button at Port H,
the buzzer at Port T and the seven-segment at Port P and also Port B to turn on the LED inside
the seven-segment. From the theory, students can know how to write a program using DDR table
and DR table. For starting of the program, students must write ORG and address it at $2000.
org $2000
movb #$ff,ddrb
movb #$0f,ddrp
movb #$00,ddrh
movb #$ff,ddrt
For the input at PORTH, from PH7 until PH0 must be ‘0’ and the hex number is $00.
For the output at PORTB and PORTT, the entire pin must be ‘1’ to turn it on and the hex number
is &FF. Students have decided to do 3 patterns to display the seven-segment with the sound.
For the first pattern, students have used switch 1 (sw1) to turn on the seven-segment.
The display on the seven-segment at PORTB is active high, to turn on the LED student must put
‘1’ and to turn off the LED on the seven-segment, student must put ‘0’. In first pattern, the
seven-segment display must use is #1, #2, #3 and #4. To display the seven-segment, student must
use PORTP and the hexadecimal for #1, #2, #3, #4 are 0E, 0D, 0B, 07 and respectively. In this
pattern will be display such as ‘S’, ‘H’, ‘a’ and ‘d’.
Figure 0.1
Since the port is same, to display ‘h’ on the second 7-segment, the coding just change to $76 at
PORTB and $0D at PORTP. The display show at figure below.
Figure 0.2
Figure 0.3
Figure 0.4
Figure 1
Figure 1 shows a display for switch 2. For switch 2, the output used port B and port P. Port
B is for LED at 7-segment while port P is to on each of 7-segment. Firstly, it display at port B at
$01 and port P at $0E. After that, it delay for 8m second. Then, it display again using the same
port B which is $01 but the different port P which is $0D like Figure 2:
Figure 2
After that, it delay 8m second. Then, it display $01 at port B and $0b at port P. Figure 3 shows
the display:
Figure 3
Then, it delay for 8m second. Then, it display at the same port B which is $01 but different Port
P which is $07. Figure 4 shows the result:
Figure 4
At this time, it display a different Port B which is $02 and Port P $07:
Figure 5
Then, it goes to $40 Port B and $07 Port P. Next, it goes to the same port B and the
different Port P which is $0B, $0D, and $0E. After that, it display Port B $10 and Port P $0E.
Then it display at the same Port B which is $08 at the different Port P which are $OE, $0D, $0B,
and $07. Then, it display at the same port B which is $40 with a different Port P which is $07,
$0B, $0D and $0E. Lastly, it display at $20 port B and $0E port P. Every the change of display,
it delay for 8m second.
Besides that, from third pattern, students have used switch 3 (sw3) to turn on the seven-segment
with sound. The LED in Dragon12-plus at PORTB is active high, to turn on the LED students
must put ‘1’ and to turn off the LED students must put ‘0’ at DR table. For seven-segment
display in Dragon12-plus at PORTP, to turn on the #1 segment students must write ‘$0E’, #2
segment is ‘$0D’, #3 segment is ‘$0B’ and #4 segment is ‘$07’. To display the seven-segment
and to turn on the buzzer, student must use PORT P (ptp) ,PORTB and PORTT(ptt).
Figure 6
For the first step it will display at ‘$01 at portb and $00 at ptp at #1, #2, #3 and#4’ and it delay
for 8 mille second such as in Figure 6.
Figure 7
For the second step it will display at ‘$00 at portb and $00 at ptp at #1, #2, #3 and #4’ and it
delay for 8 mille second such an in Figure 7.
Figure 8
For the third step it will display at $49 at portb and $0e at ptp at #1 segment’ and it delay for 8
mille second. Then, it will produce sound at ‘$20 at ptt and $00 at ptt and it delay for 8 mille
second. After that, it will display at $49 at portb and $0C at ptp at #1 and #2 and it will delay for
8 mille second too such as in Figure 8.
Figure 9
For the fourth step it will display at $49 at portb and $08 at ptp at #1,#2 and #3 and it delay for 8
mille second such as in Figure 9.
Figure 10
For the five step it will display at $49 at portb and $00 at ptp at #1,#2,#3 and #4 and it delay for
8 mille second such as in Figure 10.
Figure 11
For the six step it will display at $49 at portb and $07 at ptp at #4 and it delay for 8 mille second
such as in Figure 11.
Figure 12
For the seven step it will display at $49 at portb and $03 at ptp at #3 and #4 and it delay for 8
mille second such as in Figure 12.
Figure 13
For the eight step it will display at $49 at portb and $01 at ptp at #2,#3 and #4 and it will delay
for 8 mille second such as in Figure 13.
Figure 14
For the nine step it will display at $49 at portb and $00 at ptp at #1,#2,#3 and #4 and it delay for
8 mille second such as in Figure 14.
Figure 15
For the ten step it will display at $49 at portb and $06 at ptp at #1 and #4 and it delay for 8 mille
second such as in Figure 15.
Figure 16
For the eleven step it will display at $49 at portb and $00 at ptp at #1,#2,#3 and #4 and it delay
for 8 mille second such as in Figure 16.
Figure 17
For the twelve step it will display at $49 at portb and $09 at ptp at #2 and #3 and it delay for 8
mille second such as in Figure 17.
Figure 18
For the third teen it will display at $49 at portb and $00 at ptp at #1,#2,#3 and #4. Then, it will
produce sound at ‘$20 at ptt and $00 at ptt and it delay for 8 mille second such as in Figure 18.
Figure 19
Next, it will display at $40 at portb and $00 at ptp at #1, #2, #3 and #4 and it delay for 8 mille
second such as in Figure 19. Then, the pattern will be repeated such as in Figure 7 until Figure
18.
Figure 20
Lastly, it will display at $08 at portb and $00 at ptp at #1, #2, #3 and #4 and it will delay for 8
mille second such as in Figure 20. Then, the pattern will be repeated such as in Figure 7 until
Figure 18.
CONCLUSION
In conclusion, from this mini project students have learned how to design software on
Dragon12-board, miniIDE, and 68HCS12. Before create the program in miniIDE, students have
to create the flowchart to show how the process of the system operation. Students also learned
how to program assembly language and the basic structure of Dragon12-board. For example,
students know the function of delay, movb, load instruction, branch equal (beq), branch not equal
(bne) and so on. From this project, students also learned the basic structure of Dragon12-plus
board such as PORTB for LED, PORTT for buzzer, PORTP for seven-segment and PORTH for
push button. Next, students have learned how to utilize hardware such as switch, seven-segment
display and produce sound at buzzer. Lastly, students have learned how to face a problem and
troubleshoot.
RECOMMENDATION
After complete this mini project, have some weakness about this project. Firstly, this
project only used seven-segment and buzzer, the students can upgrade this project to used the
LCD to make this program more interesting. Next, in this project students also can add a song by
using the buzzer. After that, to make this project more interesting students can change the switch
to the keypad because the push button only has 4 buttons but the keypad have 9 so students can
add more pattern in this project.