Question: Please check code and the following errors: ; Program DC_Motor.s ; Turn On and OFF a DC motor for a few seconds ; Used PORT
Please check code and the following errors:
; Program DC_Motor.s
; Turn On and OFF a DC motor for a few seconds
; Used PORT B
; Roman Lopez B.
; January 30,2021
; !WORKs
IMPORT Init_GPIOF
IMPORT Init_GPIOD
IMPORT GPIO_PORTF_DATA_R
IMPORT GPIO_PORTD_DATA_R
AREA MyConstant,CODE,READONLY
ALIGN 4
M EQU 0x0000003F ;Delay constant
AREA |.text|, CODE, READONLY, ALIGN=2
THUMB
EXPORT Start
Start
BL Init_GPIOD ; initialize PB0 to PB7 as output
LDR R0,=GPIO_PORTD_DATA_R ;R0 Point PORTB Data
Loop MOV R4,#0x30
;Incre R7=2
MOV R7,#0
Loop0 MOV R8,#0X150 ;R8 is the counter
SUB R5,R4,R7 ;R5 = Time Hight
SUB R6,R4,R5 ;R6 = Time Low
Loop1 MOV R2,#0x01
STRB R2,[R0] ;Turn Off Dc motor
;MOV R3,R5 ;Dela number of secod
MOV R3,R6 ;Dela number of secod
BL Delay ;Delay somes second
MOV R2,#0x00
STRB R2,[R0] ;Turn On Dc motor
; MOV R3,R6 ;Delay number of secod
MOV R3,R5 ;Delay number of secod
BL Delay ;Delay one second X R3
SUBS R8,R8,#1
BNE Loop1
ADD R7,#1
CMP R7,#0x50
BLT Loop0
B Loop
Loop2Start MOV R7, #0
Loop3 MOV R8, #0X150
SUB R5,R4,R7
SUB R6,R4,R5
Loop4 MOV R2, #0x02
STRB R2, [R0]
MOV R3,R5
BL Delay
SUBS R8,R8, #1
BNE Loop4
ADD R7, #1
CMP R7, #0x50
BLT Loop3
B Loop
BLT Loop0
B Loop2Start
;>>>>>> Subroutine Delay ; Reg R3 Number of seconds to be delayed
; Reg R1 Constan M (one second delay)
Delay
PUSH {R0-R3,LR}
CMP R3,#00
BEQ Exit
Delay_Loop0
LDR R2, =M ;Set R2 =0x00FFFFFF
Delay_Loop1
SUB R2,#1
CMP R2,#0x0
BNE Delay_Loop1
SUB R3,#1
CMP R3,#0
BNE Delay_Loop0
Exit POP {R0-R3,LR}
BX LR
ALIGN
END ; end of file
55 55 567 56 57 SUBS R8, R8, #1 BNE Loop4 ADD R7, #1 CMP R7, #0x50 58 59 BLT Loop3 60 B Loop 61 BLT Loop0 62 B Loop2 63 64 ;>>>>>> Subroutine Delay < < < < < < < < < < E Pr... B... {} F... 0 Te... Build Output DC motor.s (51): error: A1163E: Unknown opcode Loop 4, expecting opcode or Macro ".\Objects\Lab3b_Asm.axf" - 3 Error(s), 0 Warning (s). Target not created. Build Time Elapsed: 00:00:00 88F Partly sunny esc f1 ? f2 2 *** f4 f5 # # 3 $ 4 Search hp 40 f7 A- % LO 5 6 4+ & f8 144 7 *
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
