This issue introduces the control device code application of the new generation ARM9 development board TQ2416, using TIMER code to control the time period of the device. Timer syntax, timer code, the function is to repeatedly trigger the timer event of the specified window within the specified time interval.
Below is what senior blogger dengchonglin shared about how to apply TIMER code on the TQ2416 development board.
If you need to use the TQ2416 development board as a control device, you need to implement US level interrupts~!
And it cannot be realized by FOR loop, because FOR loop is a timer that temporarily uses resources. This will make the CPU of the development board too expensive and unable to bear it. Using TIMER code can better run the control program.
I looked at the DATASHEET and found that there are 5 TIMERs: TIMER0~3 PWM output, TIMER4 system TICK
TIMER4 TICK
TIMER3 TOUCH
TIMER2
TIMER1
TIMER0 BL
Finally decided to use TIMER2 interrupt to achieve.
1. Apply for an event
2. Start a thread to wait for an interrupt event
3. Set TIMER2 PWM
g_pPWMRegs->TCFG1 &= (~(0xf<<20)); //For interrupt
g_pPWMRegs->TCFG1 &= (~(0xf<<8));
g_pPWMRegs->TCFG1 |= (0<<8); //mux = 1/2
g_pPWMRegs->TCON &= (~(0xf<<12));
Set the timer time
void Set_Timer(UINT32 nUS)
{
DWORD tmp;
g_pPWMRegs->TCNTB2 = nUS*g_PRINTER_1us_Counter - 1;
g_pPWMRegs->TCMPB2 = 0 ;
//Be sure to use the following assignment method, otherwise no interrupt will occur
tmp = g_pPWMRegs->TCON & (~(0xf << 12));
g_pPWMRegs->TCON = tmp | (2 << 12);
g_pPWMRegs->TCON = tmp | (1 << 12);
}
At this point, TIMER2 is already running!
Previous article:ARM9: How to port linux2.6.38 kernel to TQ2440
Next article:2416RBG interface LCD is replaced with I80 interface LCD driver to modify NK part
- Popular Resources
- Popular amplifiers
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
- Keysight Technologies Helps Samsung Electronics Successfully Validate FiRa® 2.0 Safe Distance Measurement Test Case
- Innovation is not limited to Meizhi, Welling will appear at the 2024 China Home Appliance Technology Conference
- Innovation is not limited to Meizhi, Welling will appear at the 2024 China Home Appliance Technology Conference
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Download from the Internet--ARM Getting Started Notes
- Learn ARM development(22)
- Learn ARM development(21)
- Learn ARM development(20)
- Learn ARM development(19)
- Learn ARM development(14)
- [RT-Thread reading notes]——The definition of threads and the implementation of thread switching
- How to read and write attributes through the characteristic uuid in sdk!
- MSP430FR5994 Hardware SPI Exception
- In what fields can power amplifiers be used?
- [Runhe Neptune Review] Five PWM
- How to use the wireless transceiver module
- Understanding of MSP430G2553
- A lightweight and precise positioning algorithm based on multiple inertial measurement units (LSM6DSOX)
- PT1000 circuit help
- Brief analysis of the working principle of DSP