Question: write the code in assembly programming with PIC 1 6 F 8 7 7 microprocessor i work in MPLAB IDE v 8 . 9 2

write the code in assembly programming with PIC16F877 microprocessor
i work in MPLAB IDE v8.92
i want to build "model" of a 4-bit microprocessor which includes the following units:
ALU, I/O - LCD display, button matrix and memory
Operation description of the units: Data reception: - the 2 operands, 4 bits and the operation CODE OP,4 bits are obtained through a matrix of buttons (in binary).Only buttons 0,1 and A,B,C can be used.
example :
C ---011,B ---111, A ---001
The first number will be recorded in the address 0x30 the second in 0x40 and the type of operation in 0x50.
In case of entering an incorrect operation code, "ERROR" will be shown on the display
The received numbers should be displayed on the LCD in the top row
According to the CODE OP, the ALU unit recognizes the operation and executes the command:
001 : A-B the result in 0x60(value and sign)
010: A*B multiplication the result in 0x60
011: A/B just a whole part the result in 0x60
100: A^B the result in 0x60
101: the number "1" in B the result in 0x60
110 : the number "0" in A the result in 0x60
The result of the operation must be displayed on the LCD in the second line. this is my lcd code :LIST P=PIC16F877
include P16f877.inc
__CONFIG _CP_OFF & _WDT_OFF & _BODEN_OFF & _PWRTE_OFF & _HS_OSC & _WRT_ENABLE_ON & _LVP_OFF & _DEBUG_OFF & _CPD_OFF
; LCD
;
org 0x00
reset goto start
org 0x10
start bcf STATUS, RP0
bcf STATUS, RP1 ;Bank 0
clrf PORTD
clrf PORTE
bsf STATUS, RP0 ;Bank 1
movlw 0x06
movwf ADCON1
clrf TRISE ;porte output
clrf TRISD ;portd output
bcf STATUS, RP0 ;Bank 0
call init
;----------------------------*------------------------------
movlw 0xC4 ;PLACE for the data on the LCD
movwf 0x20
call lcdc
call mdel
movlw 0x2A ; CHAR (the data )
movwf 0x20
call lcdd
call mdel
;----------------------------------------------------------
wait goto wait
;
;subroutine to initialize LCD
;
init movlw 0x30
movwf 0x20
call lcdc
call del_41
movlw 0x30
movwf 0x20
call lcdc
call del_01
movlw 0x30
movwf 0x20
call lcdc
call mdel
movlw 0x01 ; display clear
movwf 0x20
call lcdc
call mdel
movlw 0x06 ; ID=1,S=0 increment,no shift 000001 ID S
movwf 0x20
call lcdc
call mdel
movlw 0x0c ; D=1,C=B=0 set display ,no cursor, no blinking
movwf 0x20
call lcdc
call mdel
movlw 0x38 ; dl=1(8 bits interface,n=12 lines,f=05x8 dots)
movwf 0x20
call lcdc
call mdel
return
;
;subroutine to write command to LCD
;
lcdc movlw 0x00 ; E=0,RS=0
movwf PORTE
movf 0x20,w
movwf PORTD
movlw 0x01 ; E=1,RS=0
movwf PORTE
call sdel
movlw 0x00 ; E=0,RS=0
movwf PORTE
return
;
;subroutine to write data to LCD
;
lcdd movlw 0x02 ; E=0, RS=1
movwf PORTE
movf 0x20,w
movwf PORTD
movlw 0x03 ; E=1, rs=1
movwf PORTE
call sdel
movlw 0x02 ; E=0, rs=1
movwf PORTE
return
;----------------------------------------------------------
del_41 movlw 0xcd
movwf 0x23
lulaa6 movlw 0x20
movwf 0x22
lulaa7 decfsz 0x22,1
goto lulaa7
decfsz 0x23,1
goto lulaa6
return
del_01 movlw 0x20
movwf 0x22
lulaa8 decfsz 0x22,1
goto lulaa8
return
sdel movlw 0x19 ; movlw =1 cycle
movwf 0x23 ; movwf =1 cycle
lulaa2 movlw 0xfa
movwf 0x22
lulaa1 decfsz 0x22,1 ; decfsz=12 cycle
goto lulaa1 ; goto =2 cycles
decfsz 0x23,1
goto lulaa2
return
mdel movlw 0x0a
movwf 0x24
lulaa5 movlw 0x19
movwf 0x23
lulaa4 movlw 0xfa
movwf 0x22
lulaa3 decfsz 0x22,1
goto lulaa3
decfsz 0x23,1
goto lulaa4
decfsz 0x24,1
goto lulaa5
return
endand this is my keyboard code :LIST P=PIC16F877
include
__CONFIG _CP_OFF & _WDT_OFF & _BODEN_OFF & _PWRTE_OFF & _HS_OSC & _WRT_ENABLE_ON & _LVP_OFF & _DEBUG_OFF & _CPD_OFF
org 0x00
reset: goto start
org 0x10
start: bcf STATUS,RP0
bcf STATUS,RP1 ;Bank0
clrf PORTD
bsf STATUS,RP0 ;Bank1
bcf INTCON,GIE ;No interrupt
movlw 0x0F
movwf TRISB
bcf OPTION_REG,0x7 ;Enable PortB Pull-Up
clrf TRISD
bcf STATUS,RP0 ;Bank0
;--------------------------------------------------------------------------------------------------
main: call wkb
movwf PORTD
goto main
;--------------------------------------------------------------------------------------------------
wkb: bcf PORTB,0x4 ;scan Row 1
bsf PORTB,0x5
bsf PORTB,0x6
bsf PORTB,0x7
btfss PORTB,0x0
goto kb01
btfss PORTB,0x1
goto kb02
btfss PORTB,0x2
goto kb03
btfss PORTB,0x3
goto kb0a
bsf PORTB,0x4
bcf PORTB,0x5 ;scan Row 2
btfss PORTB,0x0
goto kb04
btfss PORTB,0x1
goto kb05
btfss PORTB,0x2
goto kb06
btfss PORTB,0x3
goto kb0b
bsf PORTB,0x5
bcf PORTB,0x6 ;scan Row 3
btfss PORTB,0x0
goto kb07
btfss PORTB,0x1
goto kb08
btfss PORTB,0x2provide me the full code! not a template

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!