Question
this is a 3 bit calculator circuit done on mplabx ide. When building(running) the program it shows build error. Can someone run and fix the
this is a 3 bit calculator circuit done on mplabx ide. When building(running) the program it shows build error. Can someone run and fix the problem?
include " p18f452.inc "
org 0x00
add1 equ 0x20
sub1 equ 0x21
div1 equ 0x22
mul1 equ 0x23
num1 equ 0x24
num2 equ 0x25
num3 equ 0x26
remainder equ 0x27
divisor equ 0x28
quotient equ 0x29
dividend equ 0x30
goto main
main: clrf trisd
clrf trisc
setf trisb
movlw 0x00
movwf add1
movlw 0x40
movwf div1
movlw 0x80
movwf sub1
movlw 0xC0
movwf mul1
movlw 0x00
movwf portd
movwf portc
up: movf portb,w
andlw 0xC0
cpfseq add1
bra check1
bra add
check1: cpfseq sub1
bra check2
bra sub
check2: cpfseq div1
bra check3
bra div
check3: cpfseq mul1
bra up
bra mul
add:movf portb,w
movwf num3
andlw 0x38
movwf num1
rlncf num1
rlncf num1
rlncf num1
rlncf num1
rlncf num1
movf num3,w
andlw 0x07
addwf num1,0,0
movwf portd
bra up
sub:movf portb,w
movwf num3
andlw 0x38
movwf num1
rlncf num1
rlncf num1
rlncf num1
rlncf num1
rlncf num1
movf num3,w
andlw 0x07
subwf num1,0,0
movwf portd
bra up
mul: movf portb,w
movwf num3
andlw 0x38
movwf num1
rlncf num1
rlncf num1
rlncf num1
rlncf num1
rlncf num1
movf num3,w
andlw 0x07
mulwf num1
movf prodl,w
movwf portd
bra up
div:movf portb,w
movwf divisor
andlw 0x38
movwf dividend
rlncf dividend
rlncf dividend
rlncf dividend
rlncf dividend
rlncf dividend
movf divisor,w
andlw 0x07
movwf divisor
clrf quotient
clrf remainder
incf quotient
up1: subwf dividend
cpfslt dividend
incf quotient
movff dividend,remainder
cpfslt dividend
bra up1
movff quotient, portd
movff remainder , portc
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