0% found this document useful (0 votes)
55 views1 page

Title: Math Operations: Lab Objectives

This document outlines two lab activities to familiarize students with math operations using a PIC18F microcontroller. The first activity involves writing a program to multiply two 16-bit signed numbers and store the result in memory. The second activity involves writing a program to calculate the nth Fibonacci number for a given input number n, and store the 16-bit result in memory. Example inputs and expected outputs are provided.

Uploaded by

Mert Ağalday
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
55 views1 page

Title: Math Operations: Lab Objectives

This document outlines two lab activities to familiarize students with math operations using a PIC18F microcontroller. The first activity involves writing a program to multiply two 16-bit signed numbers and store the result in memory. The second activity involves writing a program to calculate the nth Fibonacci number for a given input number n, and store the 16-bit result in memory. Example inputs and expected outputs are provided.

Uploaded by

Mert Ağalday
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Title: MATH OPERATIONS

Lab objectives:

Familiarize with PIC18F math operations


Extending the capabilities of PIC18F in math

Reference:

Mazidi, McKinlay, Causey PIC Microcontroller and Embedded Systems, Chapter 5.

Lab activity 1:
Write and assemble a program to multiply two 16-bit signed numbers. Two inputs are taken from
0x00 and 0x02 respectively, and the result is stored in address starts from 0x10.

Lab activity 2:
Write and assemble a program to calculate nth element of the Fibonacci series, where n is the
given 1 byte number in the address labelled as INPUT and stores the 16-bit (2 bytes) result into
the address labelled as OUTPUT.
For example the address 0x00 is labelled as INPUT, and 0x10 is labelled as OUTPUT. Our result
will be stored in 0x10- 0x11 as 16 bits (2 bytes).

000

010
011

00

00
01

000

010
011

07

00
0

if input is one or two. After execution, the output should be 1.


Result is 0001 (as 16-bits)

if input is 7. After execution, the output should be in hex format.


Result is 000Dh (as 16-bits) = Decimal 13.

You might also like