Question
How can I put these two assembly codes into one simplified code with subroutines? *******1st Code******* #include config OSC = INTIO67 config WDT = OFF
How can I put these two assembly codes into one simplified code with subroutines?
*******1st Code*******
#include
config OSC = INTIO67
config WDT = OFF
config LVP = OFF
config BOREN = OFF
InA equ 0x20
InC equ 0x21
Result equ 0x22
ORG 0x0000
START:
MOVLW 0x0F
MOVWF ADCON1
MOVLW 0xFF
MOVWF TRISA
MOVWF TRISB
MOVLW 0x00
MOVWF TRISC
MOVLW 0x00
MOVWF TRISE
MAIN_LOOP:
MOVF PORTA, W
ANDLW 0x0F
MOVWF InA
COMF InA, W
MOVWF Result
MOVFF Result, PORTC
GOTO MAIN_LOOP
END
**********Second Code**********
#include
config OSC = INTIO67
config WDT = OFF
config LVP = OFF
config BOREN = OFF
InA equ 0x20
InC equ 0x21
Result equ 0x22
ORG 0x0000
START:
MOVLW 0x0F
MOVWF ADCON1
MOVLW 0xFF
MOVWF TRISA
MOVWF TRISB
MOVLW 0x00
MOVWF TRISC
MOVLW 0X00
MOVWF TRISE
MAIN_LOOP:
MOVF PORTA, W
ANDLW 0x0F
MOVWF InA
COMF InA, W
MOVWF Result
MOVFF Result, PORTC
BCF PORTE, 2
BNZ JUMP
BSF PORTE, 2
JUMP:
GOTO MAIN_LOOP
END
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started