► Clock source of S3C2440
► Timer characteristics of S3C2440
Timer registers of S3C2440
TCON Register | describe |
0~3 | Control timer 0: Enable [0], Manual update [1], Match output [2], Auto reload [3] |
4 | Dead zone enable |
8~11 | Control timer 1: Enable [8], Manual update [9], Match output [10], Auto reload [11] |
12~15 | Control timer 2: enable [12], manual update [13], match output [14], auto reload [15] |
1516~19 | Control timer 3: enable [16], manual update [17], match output [18], auto reload [19] |
20~22 | Control timer 4: enable [20], manual update [21], automatic reload [23] |
► S3C2440 timer operation
► S3C2440 timer initialization Taking
- void Timer0_init()
- {
-
TCFG0 = 119; //Configure the prescaler value of timer 0, 1 -
TCFG1 = 0x03; //Configure timer 0 division value -
TCNTB0 = 3125; //Count buffer register -
TCMPB0 = 0; //Compare cache register -
TCON |= (1<<1); //Manual update bit and configure inverter bit (on/off) (manual update bit sets the value of TCNTBn and TCMPBn to TCNTn and TCMPn registers respectively) -
TCON = 0x09; //Timer enable and auto-reload - }
- void
DelayMS(U32 dly) - {
-
U32 time_val; -
rTCFG0 = 3; //Configure the prescaler value of timer 0, 1 -
rTCFG1 = 0<<4; //Configure timer 1 frequency division value -
time_val = PCLK/ (3+1) / 2 / 1000 - 1; // 1ms = PCLK / prescaler / divider / 1000 -
-
rTCNTB1 = time_val; //Count cache register -
rTCMPB1 = time_val>>1; // 50% -
-
rTCON &= ~(0xf<<8); //Manually update the bit and configure the inverter bit (on/off) -
rTCON |= 0xb<<8; //Timer enabled and automatically reloaded -
rTCON &= ~(2<<8); //clear manual update bit -
-
while(dly--) -
{ -
while(rTCNTO1>=time_val>>1); -
while(rTCNTO1 >1); -
} - }
- void Main(void)
- {
-
//----------------Add your own code------------------- -
rGPACON &= ~(1<<16); -
-
while (1) -
{ -
rGPADAT |= (1<<16); -
DelayMS(1000); -
rGPADAT &= ~(1<<16); -
DelayMS(500); -
} - }
Previous article:System clock and timer; MPLL and timer
Next article:Software delay ideas related to FCLK
- Popular Resources
- Popular amplifiers
Recommended Content
Latest Microcontroller Articles
- 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)
He Limin Column
Microcontroller and Embedded Systems Bible
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
MoreSelected Circuit Diagrams
MorePopular Articles
- 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
MoreDaily News
- Detailed explanation of intelligent car body perception system
- How to solve the problem that the servo drive is not enabled
- Why does the servo drive not power on?
- What point should I connect to when the servo is turned on?
- How to turn on the internal enable of Panasonic servo drive?
- What is the rigidity setting of Panasonic servo drive?
- How to change the inertia ratio of Panasonic servo drive
- What is the inertia ratio of the servo motor?
- Is it better for the motor to have a large or small moment of inertia?
- What is the difference between low inertia and high inertia of servo motors?
Guess you like
- LM358 op amp problem, please give me some advice
- TI's ultra-low power solution gives birth to TWS true wireless
- 【TI millimeter wave radar evaluation】+SDK development environment
- PCB News: Zhongjing Electronics plans to acquire 45% of Yuansheng Electronics for RMB 270 million to achieve horizontal integration of PCB
- How to use EPI general mode to communicate with FPGA in TM4c129 series microcontroller
- Before buying a cable fault tester, you must know about its manufacturer. How to find a good time...
- High-speed PCB design technology (Chinese)
- Design of ESD protection structure for CMOS circuits
- 8 Common Uses of Diodes
- TMS320C6655 Fixed and Floating Point Digital Signal Processor