/*led_asm_c.c*/
#define rGPFCON (*(volatile unsigned *)0x56000050) //Port F control
#define rGPFDAT (*(volatile unsigned *)0x56000054) //Port F data
#define rGPFUP (*(volatile unsigned *)0x56000058) //Pull-up control F
//GPFCON 8 port
extern int delay(int time); /*Declare assembly function*/
int main()
{
/*Set GPFCON*/
rGPFCON &= 0x00ff; //GPF4 - 7 is set to 0
rGPFCON |= 0x55ff; //GPF4 - 7 is set to output
/*Set GPFUP*/
rGPFUP |= 0xff00;
while(1)
{
/*Turn on GPF4*/
rGPFDAT |= 0xf0; //GPF4 - 7 is set to 1
rGPFDAT &= 0xe0; //GPF4 is set to 0
delay(0x1ffffff); //Call the delay program written by the assembly program
/*Turn on GPF5*/
rGPFDAT |= 0xf0; //GPF4 - 7 is set to 1
rGPFDAT &= 0xd0; //GPF5 is set to 0
delay(0x1ffffff); //Call the delay program written by the assembler
/*Turn on GPF6*/
rGPFDAT |= 0xf0; //GPF4 - 7 is set to 1
rGPFDAT &= 0xb0; //GPF6 is set to 0
delay(0x1ffffff); //Call the delay program written by the assembler
/*Turn on GPF7*/
rGPFDAT |= 0xf0; //Set GPF4 - 7 to 1
rGPFDAT &= 0x70; //Set GPF7 to 0
delay(0x1ffffff); //Call the delay program written by the assembly program
}
}
;delay.s
EXPORT delay
AREA delay1,CODE,READONLY; This pseudo instruction defines a code segment delay1. Note the name
; the following delay subroutine
ENTRY
delay
; pass a parameter, put the parameter into r0
sub r0 ,r0 ,#1
cmp r0 ,#0x0
bne delay ; result is not 0 and continue delay
mov pc ,lr ; return
END; //end
Previous article:STM32 input and output summary
Next article:What is the maximum input current and output drive current of the STM32 IO port?
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- CGD and Qorvo to jointly revolutionize motor control solutions
- CGD and Qorvo to jointly revolutionize motor control solutions
- Keysight Technologies FieldFox handheld analyzer with VDI spread spectrum module to achieve millimeter wave analysis function
- Infineon's PASCO2V15 XENSIV PAS CO2 5V Sensor Now Available at Mouser for Accurate CO2 Level Measurement
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- A new chapter in Great Wall Motors R&D: solid-state battery technology leads the future
- Naxin Micro provides full-scenario GaN driver IC solutions
- Interpreting Huawei’s new solid-state battery patent, will it challenge CATL in 2030?
- Are pure electric/plug-in hybrid vehicles going crazy? A Chinese company has launched the world's first -40℃ dischargeable hybrid battery that is not afraid of cold
- New Qorvo IDP President Discusses the Future of RF, MEMS and Power Technologies
- How to choose the right RF module
- [Ultra-low power STM32U5 IoT Discovery Kit] - 4: wifi-1
- 【Review of SGP40】+ Comprehensive demo
- When designing a power supply, what cooling method do you choose?
- DSP28035_Baud rate setting
- Fuse selection
- Complaint: Xiaomi 8 got stuck and bricked after automatic upgrade
- Improved logging
- EEWORLD University Hall----Live Replay: ADI - Inertial MEMS Applications