– Port A (GPA): 25-bit output port
– Port B (GPB): 11-bit input/output port
– Port C (GPC): 16-bit input/output port
– Port D (GPD): 16-bit input/output port
– Port E (GPE): 16-bit input/output port
– Port F (GPF): 8-bit input/output port
– Port G (GPG): 16-bit input/output port
– Port H (GPH): 9-bit input/output port
– Port J (GPJ): 13-bit input/output port
IO port control register
Port Configuration Registers (GPACON to GPJCON)
which function is used for each pin.
Port Data Registers (GPADAT to GPJDAT) If the port is configured as an output port, data can be written to the corresponding bit of PnDAT. If the port is configured as an input port,
data
step:
1. Initialize the IO port and set the GPBCON and GPBUP registers.
Here, GPB5-PGB8 of the PB port is used as a general IO port to realize the output function, so the GPB5-PGB8 bits of GPBCON should be 01 respectively, that is, GPBCON[17:10] is 01010101; the initial state of GPBUP is all 0, even if the pull-up resistor function is enabled, it does not need to be set, and it is set here.
The I/O port is generally connected to the peripheral device through optoelectronic isolation or other isolation devices. If it is directly connected, it must be confirmed that the load cannot exceed 4 NAND gates. Optoelectronic isolation can protect the microprocessor, perform level conversion, and distribute certain signals, so it is usually added.
2. The control idea is relatively simple. Let the 5-8 bits of the PB port cyclically become a low level (high level at other times), and the running light can be realized, and a delay is added between the two level conversions.
3. Procedure
#define rGPBCON
#define rGPBDAT
#define rGPBUP
#define
#define
#define
#define
#define
#define
#define
#define
void Delay(void)
{
}
int Main()
{
}
4. Program description: The program uses #define LED1_ON (rGPBDAT &=~(1<<5)) to set the register. Compared with the direct assignment method, this representation method is easier to observe which bit of the register has changed, and ensures that except for the bit that needs to be changed, other bits remain unchanged!
Previous article:How to turn on and off total interrupt in stm32
Next article:TQ2440 FCLK, HCLK, PCLK, UCLK clock frequency settings
Recommended ReadingLatest update time:2024-11-16 15:21
- Popular Resources
- Popular amplifiers
- Practical Deep Neural Networks on Mobile Platforms: Principles, Architecture, and Optimization
- ARM Embedded System Principles and Applications (Wang Xiaofeng)
- ARM Cortex-M4+Wi-Fi MCU Application Guide (Embedded Technology and Application Series) (Guo Shujun)
- osk5912 evaluation board example source code
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- EEWORLD University Hall----MIT Open Course: Circuits and Electronics
- Brief Introduction of Push-Pull Circuit
- Clock system of MSP430 microcontroller
- Signal generator and DA conversion
- Eleven Things to Avoid with Analog Noise
- 【ufun learning】Part 3: Light up the OLED screen
- MSP430G2452 implements heart rate monitoring based on ECG
- Complete Flash Recording in CCS v5
- FAQ_ BlueNRG Series DTM Introduction
- Dear hardware engineers, can you solve differential equations?