Ex 2 Report Embedded (2140245)
Ex 2 Report Embedded (2140245)
Ministry of Education
KINGABDULAZIZUNIVERSITY
Faculty of Engineering at Rabigh
Electrical Engineering Department
قسم الهندسة
الكهربائية
Number : 2
Course Code EEN 415
ID No: 2140245
Objective:
1- To study the meaning and function of the assembler codes ADDLW , DECF, LOOPING ,
in addition to previous codes
2- To create a down counter
Procedure:
- Create a down counter starting from 10 and counting down to 0.
- In each counter cycle, increment the value of the work register by 3H.
- Use assembler instructions ADDLW, DECF, and LOOP in the program.
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
Source Code:
include <p18F458.inc>
org 0x000
count equ 0x25
movlw D'010'
movwf 25h
movlw 0h
main addlw 3h
decf 25h,f
bnz main
movwf 26h
end
3
Screen shots:
4
5
6
Conclusion:
The experiment proved the efficacy of the assembler codes ADDLW, DECF, and LOOP. The
down counter properly counted from 10 to 0, and the work register was increased by 3H each
cycle. The experiment clearly demonstrated the effective usage of assembler codes in
reaching the desired result.