/Users/farid11/Downloads/test1/Simple_Register_Reading/test.asm |
1 ;--------------------- 2 ; Title: Program_name 3 ;--------------------- 4 5 ;Program Detail: 6 ;--------------------- 7 ; Purpose: What does it do? 8 ; Inputs: What are the inputs to the program? 9 ; Outputs: What are the output of the Program? 10 ; Date: date and time 11 ; Compiler: Simulator Version ???? 12 ; Author: name of the author 13 ; Versions: 14 ; V1 - What is the version numer and what is the change for each version? 15 ; V2 - What is the version numer and what is the change for each version? 16 17 ;--------------------- 18 ; File Dependencies: these are the listing and header files you need to run the 19 ; program 20 ;--------------------- 21 List P=18F452 f=inhx32 22 #include <p18F452.inc> 23 24 ;--------------------- 25 ; Initialization 26 ;--------------------- 27 28 ; Program Inputs 29 INPUT1_Value EQU 0x12 ;The value of INPUT1 30 INPUT2_Value EQU 0x02 ;The value of INPUT2 31 32 ; Program Constants 33 INPUT1 EQU 0X20 ;The register where INPUT1 is stored 34 INPUT2 EQU 0X20 ;The register where INPUT2 is stored 35 RESULT EQU 0x30 ;The register where RESULT is stored 36 BUFFER EQU 0x40 37 38 ;--------------------- 39 ; Main Program 40 ;--------------------- 41 42 ORG 0X20 ;Start program listing from Reg. 0x20 in the memory 43 44 START: CLRF RESULT ;Make sure the RESULT is cleared 45 46 MOVLW INPUT1_Value ;ADD INPUT1+INPUT2-> RESULT 47 MOVWF RESULT 48 MOVLW INPUT2_Value 49 ADDWF RESULT,F 50 51 BNZ DONE ;If the result is NOT zero goto done! 52 CLRF INPUT1 ;Else clear INPUT registers 53 CLRF INPUT2 54 MOVFF BUFFER,W 55 56 SEFINI: GOTO SEFINI ; Stop here! 57 58 END ; End of the program 59