2023-09-02 12:14 PM
2023-09-02 12:51 PM - edited 2023-09-02 12:53 PM
Hello @CCV
I think that you are programming Using assembly. I suggest you to watch this video that shows you how to program an STM32 using assembly language.
Also, you can open an exemple of code in C that do the same thing and then open the Disassembly View which is well described in this post. This view will give a transaction of the C code to assembly language. Then you can copie the assembly code to your project .
Hope this is helpful. If your question is answered please check this answer as best answer to be diffused.
Best regards.
II
2023-09-02 02:18 PM
I watched this video but I didn't , if you know can you do this for me
2023-09-02 03:28 PM
Try this
LDR R1,=myDmode
LDR R5,[R1]
MOV R2,#0x00
LSL R2,#8
ORR R5,R2
STR R5,[R1]
LDR R1,=myDmode
LDR R5,[R1]
MOV R2,#0x01
LSL R2,#28
ORR R5,R2
STR R5,[R1]
I think you should do a test I'm not 100% sure.
Best regards
II
2023-09-06 07:08 AM
Likewise, I need to change the inputs and outputs in this code. Can anyone help?
2023-09-06 07:40 AM
Hello @jokersD1
I suggest you to answer your questions in a new post to give it more visibility. Also, you have to give more details about what you exactly want to do.
Best regards.
II
2023-09-06 09:11 AM
Hello, I have NUCLEON STM32 F401RE Model, I want to replace the input pin with pb4 instead of pc13 and the output pin with pc7 instead of pa5 in the program I threw. I looked at the datasheet, but I couldn't understand it, can you help ?
///CODE///
2023-09-06 09:22 AM
Hope this answers your question.
AREA mycode, CODE
EXPORT __main
myclock EQU 0x40023830
myDmode EQU 0x40020000
myDout EQU 0x40020014
myPU_PD EQU 0x4002080C
myPB4I EQU 0x40020810
myPC7O EQU 0x4002001C
ENTRY
__main PROC
NOP
;------------------------------Port B Clock Enable for PB4
LDR R1,=myclock
LDR R5,[R1]
MOV R2,#1
LSL R2,#1
ORR R5,R2
STR R5,[R1]
;------------------------------Port C Clock Enable for PC7
LDR R1,=myclock
LDR R5,[R1]
MOV R2,#1
LSL R2,#2
ORR R5,R2
STR R5,[R1]
;------------------------------PC13 Pull-Up Pull-Down
LDR R1,=myPU_PD
LDR R5,[R1]
MOV R2,#1
LSL R2,#26
ORR R5,R2
STR R5,[R1]
;---------------------------Clock setup for PB4 (GPIOB)
LDR R1,=myclock
LDR R5,[R1]
MOV R2,#1
LSL R2,#1
ORR R5,R2
STR R5,[R1]
;----------------------------Çikis uclari seçimi
PC7 (GPIOC)
LDR R1,=myDmode
LDR R5,[R1]
MOV R2,#0x1
LSL R2,#14
ORR R5,R2
STR R5,[R1]
;------------------------------Read PB4 pin
Re_PB4 LDR R1,=myPB4I
LDR R5,[R1]
MOV R2,#0x10
AND R5,R2
CMP R5,#0
BEQ myRun
B Re_PB4
;----------------------------Led On
myRun LDR R1,=myPC7O
LDR R5,[R1]
MOV R2,#0x80
ORR R5,R2
STR R5,[R1]
;---------------------------- Gecikme
LDR R6,=0XFFFFF
Two1 SUB R6,#1
CMP R6,#0
BEQ One1
B Two1
;---------------------------- LED off
One1 LDR R1,=myPC7O
LDR R5,[R1]
BIC R5,R2
STR R5,[R1]
;------------------------
---- Gecikme
LDR R6,=0XFFFFF
Two2 SUB R6,#1
CMP R6,#0
BEQ Re_PB4
B Two2
ENDP
END
Best regards.
II