0% found this document useful (0 votes)
10 views

Ex 4 Report Embedded (2140245)

Uploaded by

mmohammedgharawi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

Ex 4 Report Embedded (2140245)

Uploaded by

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

KINGDOM OF SAUDI ARABIA

Ministry of Education
KINGABDULAZIZUNIVERSITY
Faculty of Engineering at Rabigh
Electrical Engineering Department
‫قسم الهندسة‬
‫الكهربائية‬

Course Name Embedded Systems Lab Report

Number : 4
Course Code EEN 415

Name : Mohammed Abdu Gharawi

ID No: 2140245
Objective:
1- To study the meaning and function of the assembler codes BNZ , DECF, INCF , EQU
,LOOPING , in addition to previous codes
2- To deals with microcontroller flags

Procedure:
1. Initialize registers and constants.
2. Set microcontroller flags for loop conditions.
3. Use assembler instructions for control flow.
4. Implement and execute loops with flag manipulation.
5. Run and verify correct loop execution and flag behavior.

Test Plan:
1- Verify WREG is cleared at the start:
Ensure the code begins by clearing WREG with MOVLW 0x00, and confirm this through
simulation.

2- Monitor the Watch window:


Add WREG, PORTA, and PORTB to the WATCH window, and verify their values during
execution.

3- Check the Output window for success:


Ensure the OUTPUT window shows "BUILD SUCCESSFUL" to confirm the program
compiled without errors.

2
Source Code:
processor 18F458
include <p18F458.inc>
org 0x000
COUNT EQU 0x25
MOVLW D'10'
MOVWF COUNT
MOVLW d'0'
MOVWF TRISB
AGAIN ADDLW 3
DECF COUNT, F ; Decrement COUNT
BNZ AGAIN ; Loop until COUNT is zero
MOVWF PORTB; Store result in PORTB
END

3
Screen shots:

4
5
Conclusion:
The experiment demonstrated the use of assembler codes such as BNZ, DECF, INCF, EQU,
and LOOP, along with microcontroller flags, successfully controlling loops. The counter
operated from 0 to 70 in the inner loop and 0 to 10 in the outer loop, achieving the intended
functionality.

You might also like