Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Fundmentals of microcontrollers, Lecture notes of Engineering

Fundmentals of microcontrollers

Typology: Lecture notes

2024/2025

Uploaded on 02/03/2025

single-abdou-2
single-abdou-2 🇨🇦

19 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
pf2

Partial preview of the text

Download Fundmentals of microcontrollers and more Lecture notes Engineering in PDF only on Docsity!

EMCH 367 Fundamentals of Microcontrollers: Example 5 EXAMPLE 5 OBJECTIVE This simple example has the following objectives: 0 Review 2-digit decimal arithmetic with carry to prepare the ground for 2-digit hex arithmetic with carry. PROGRAM Ex5.asm program is similar to ex3.asm, but uses numbers outside the 0 — 9 range. It performs the arithmetic operation 9 + 8 = 17. To achieve this, the program does the following: 0 Load 9 into accA using LDAA, i.e., QOA (| Load 8 into accB using LDAB, i-e., 8OB O Add accA (1.e., 9) with accB (i.e., 8) A+BOA Al7 EXECUTION Open THRSim11. Maximize THRSim11 window. Close the Commands window. Open file Ex5.asm. Assemble file. Tile windows. Set break point at the line containing SWI. Set the display of A, B registers to ‘Decimal’. Reset registers D, X, Y. Your screen should look like this: File Edit Search Wiew Execute Label Breakpoint Connect Window Help pai ea ct pele) Sl si-ilcel Y || Bley 7/0) =olx BME [cru reostere i} |atnccupe “A: \UAR_DEF.ASM" Ele : * Start of main program * Define program variables Vn orG PROGRAM ORG DATA eo ¥ 6 SP $9008 * Begin typing your code i Start of main program $cO01 86 09 Loaa ORG PROGRAPI CC %111180008 $c003 c6 68 LoAB 8 START NOP $c0@5 1b ABA * Begin typing your code Lpaa a9 LDAB 48 ABA * End of main program ORG SFFFE rt Sfffe ch 66 FDB START 3 St End of main progran SWI ORG SFFFE 6; reset vector FDB START 3; set to start Dr. Victor Giurgiutiu Page 1 15/2019