0% found this document useful (0 votes)
29 views7 pages

Microcontrollers Sheet Mechatronics Dep Mte XX

Microcontrollers Sheet Mechatronics Dep Mte Xx
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views7 pages

Microcontrollers Sheet Mechatronics Dep Mte XX

Microcontrollers Sheet Mechatronics Dep Mte Xx
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 7

Faculty of Engineering -- MUST

Mechatronics Department
Microcontroller Laboratory (MTE XX)
SHEET 1

(1) Write an assembly program to add the value $48 to the


value $39 and store the results in the memory location $C2.
During the program:
monitor the values of PC, ACC, CCR, M ($C2).

PROGRAM PC ACC CCR M ($C2)


ORG $0300 $0300 $00 111. I… XX
LDA #$48 $0302 $48 111. I… XX
ADD #$39 $0304 $81 111HIN.. XX
STA $C2 $0306 $81 111HIN.. $81

(2) Write an assembly program to add the value $94 to the


value $93 and store the results in the memory location $C2
During the program:
monitor the values of PC, ACC, CCR, M ($C2).

PROGRAM PC ACC CCR M(C2)


ORG $0300 $0300 $00 111. I… XX
LDA #$94 $0302 $94 111- IN-- XX
ADD #$93 $0304 $27 111- I--C XX
STA $C2 $0306 $27 111- I--C $27

(3) Write an assembly program to add the value $78 to the data
stored in the memory location $C1, which is ($88). Store the
results in the memory location C2.
During the program:
monitor the values of PC, ACC, CCR, M ($C2).

PROGRAM PC ACC CCR M(C2)


ORG $0300 $0300 $00 111. I… XX
LDA #$88 $0302 $88 111- IN-- XX
STA $C1 $0304 $88 111- IN-- XX
LDA #78 $0306 $78 111- I-- XX
ADD $C1 $0308 $00 111H I-ZC XX
STA $C2 $030A $00 111H I-ZC $00
(4) Write an assembly program to add the value $48 to the
value $39 and the carry, which is stored in CCR and store
the results in the memory location $C2.
During the program:
monitor the values of PC, ACC, CCR, M ($C2).

PROGRAM PC ACC CCR M(C2)


ORG $0300
LDA #$48
ADC #$39
STA $C2

(5) Write an assembly program to subtract the value $15


from the value $97 and store the results in the memory
location $C4. During the program:
monitor the values of PC, ACC, CCR, M ($C4).

PROGRAM PC ACC CCR M(C4)


ORG $0300
LDA #$97
SUB #$15
STA $C4

(6) Write an assembly program to add the value $78 to the data
stored in the memory location $C1, which is ($88) and the
carry stored in CCR. Store the results in the memory location
$C2. During the program:
monitor the values of PC, ACC, CCR, M ($C2).

PROGRAM PC ACC CCR M(C2)

(7) Write an assembly program to subtract the value $97 from


the value $15 and store the results in the memory location
$C4. During the program: During the program:
monitor the values of PC, ACC, CCR, M ($C4).

PROGRAM PC ACC CCR M(C4)


(8) Write an assembly program to subtract the value $65 from
the value $65 and store the results in the memory location
$C4. During the program:
monitor the values of PC, ACC, CCR, M ($C4).

PROGRAM PC ACC CCR M(C4)

(9) Write an assembly program to subtract the value $15 and


the carry stored in CCR from the value $97. Store the results
in the memory location C4. During the program:
monitor the values of PC, ACC, CCR, M ($C4).

PROGRAM PC ACC CCR M(C4)


Faculty of Engineering -- MUST
Mechatronics Department
Microcontroller Laboratory (MTE XX)
SHEET 2

1 – Design a microcontroller program to add the data stored


in memory location $C0 to the binary value (%00110111). Store
the result in $D0.

2 – Design a microcontroller program to add 16 –bit number


stored in memory location $C0 and $C1 to the 16-bit number
stored in memory locations $C3 and $C4. The MSB 8-bits are in
$C0, $C3. Store the results in memory locations $D0 and $D1,
with the MS 8- bits in $D0 and LS 8-bits in $D1.

3 – Design a microcontroller program to shift the data stored in


memory location $C0 left one bit and place the result in $D0.

4 – Design a microcontroller program to shift the data stored in


memory location $C1 right one bit and place the result in $D1.

5 – Design a microcontroller program to multiply the data


stored in memory location $C0 with the data stored in memory
location $C1. Store the higher byte of the result in $D0 and the
lower byte in $D1.

6 – Design a microcontroller program to perform the AND


operation between the data stored in memory location $C0 and the
value $C1. Store the result in $D0

7 – Design a microcontroller program to perform the AND


operation between the data stored in memory location $CE and the
data stored in $CF. Store the result in $E0.

8 – Design a microcontroller program to perform the OR


operation between the data stored in memory location $C0 and
value $C1. Store the result in $D0

9 – Design a microcontroller program to perform the OR


operation between the data stored in memory location $CA and data
stored in $CB. Store the result in $E0.
10 – Design a microcontroller program to perform the XOR
operation between the data stored in memory location $C0 and data
stored in $C1. Store the result in $D0.

11 – Design a microcontroller program to perform the XOR


operation between the data stored in memory location $CD and data
stored in $CF. Store the result in $DC.

12 – Design a microcontroller program to perform the NAND


operation between the data stored in memory location $C0 and the
value $C1. Store the result in $D0

13 – Design a microcontroller program to perform the NAND


operation between the data stored in memory location $C0 and the
data stored in $D9. Store the result in $DC.

14 – Design a microcontroller program to perform the NOR


operation between the data stored in memory location $C0 and
value $C1. Store the result in $D0

15 – Design a microcontroller program to perform the NOR


operation between the data stored in memory location $C0 and data
stored in $C8. Store the result in $DE.

16 – Design a microcontroller program to perform the XNOR


operation between the data stored in memory location $C0 and data
stored in $C1. Store the result in $D0.

17 – Design a microcontroller program to perform the XNOR


operation between the data stored in memory location $C0 and data
stored in $F3. Store the result in $E5.

18 – Design a microcontroller program to determine the two’s


complement the data stored in $C0. Store the result in $D5.

19 – Design a microcontroller program to determine the one’s


complement the data stored in $C0. Store the result in $D5.

20 – Design a microcontroller program to place the least


significant four bits of the data stored in $C0 in the memory
location $C3.
Faculty of Engineering -- MUST
Mechatronics Department
Microcontroller Laboratory (MTE XX)
SHEET 3

(1) Use a microcontroller program that calculates the sum of


series of numbers. The length of the series is stored in
memory location $CF and the series begins in memory
location $D0. The program stores the sum in memory location
$C1 and assume that the sum is 8-bit number (or it ignore
carries).

(2) Use a microcontroller program that calculates the sum of


series of numbers. The length of the series is stored in
memory location $CF and the series begins in memory
location $D0. The program stores the sum in memory
locations $C1 (MSB) and $C2 (LSB).

(3) Use a microcontroller program that calculates the largest


value of a series of numbers. The length of this series is
stored in memory location $CF and the series begins in
memory location $D0. The program stores the largest value in
the memory location $C1.

(4) Use a microcontroller program that calculates the smallest


value of a series of numbers. The length of this series is
stored in memory location $CF and the series begins in
memory location $D0. The program store the smallest value
in memory location $C1.

(5) Write an assembly program to determine the number of zero-


value, positive-value, and negative-vale among the elements
of a block of data. The length of this block is stored in the
memory location $CF and the block starts at the memory
location $D0. Place the number of zero-value at memory
location $C1, the number of positive-value at $C2 and those
of negative-value at $C3.

(6) Write an assembly program to determine for a Byte: how


many bits have a value One and have a value zero. The Byte
is stored at the memory location $C3. Place the number of
Ones at $D1 and the number of zeros at $D2.
Faculty of Engineering -- MUST
Mechatronics Department
Microcontroller Laboratory (MTE XX)
SHEET 4

(1) Write an MCU program to simulate the operation of a lamp


with a normally open switch. The switch is connected with
port B0 and the lamp is connected with port A3.

(2) Write an MCU program to simulate the operation of a lamp


with a normally closed switch. The switch is connected with
port B0 and the lamp is connected with port A3.

(3) Write an MCU program to simulate the operation of a lamp


with two switches. The first switch is connected to port B0
and the second is connected to port B1 and the lamp is
connected with port A2. Any one of the two switches can
illuminate the lamp.

(4) Write an MCU program to simulate the operation of a lamp


with two switches. The first switch is connected to port B0
and the second is connected to port B1 and the lamp is
connected to port A4. The lamp is illuminated when the two
switches are operated ON.

(5) Write an MCU program to simulate the operation of a lamp


with two switches. The first switch is connected to port B0
and the second is connected to port B1, and the lamp is
connected to port A2. The operation of the lamp is according
to the following truth table.

Switch one Switch two Lamp


Off Off Off
On Off On
Off On On
On On Off

(6) Write an MCU program to simulate the operation of a lamp


with two switches. The first switch is normally open and is
connected to port B0, the second is normally closed and is
connected to port B1 and the lamp is connected with port A2.
The two switches are used for the (start-stop operation) of a
process control program.

You might also like