ARM multitasking and system clock
1. Experimental purpose
Learn the system time related API functions and use semaphores to solve the synchronization problem between uCOS-II processes, display the system time
in a text box, and can be modified through keyboard settings.
2. Experimental content
This experiment creates a new task in the user's Main_Task task to realize the display and update of the system clock.
At the same time, by responding to keyboard messages in the Main_Task task, the system clock can be changed. Use
semaphores in the uCOS-II multitasking system to ensure that multiple tasks access a system resource at the same time without conflict.
3. Preliminary knowledge
1. Use ARM SDT 2.5 integrated development environment to write and debug the basic process of the program.
2. The framework structure of the application based on the operating system.
3. Use Source Insight 3 to edit C language source programs
4. Use message loops to respond to keyboard messages
5. Use text box controls
IV. Experimental equipment and tools (including software debugging tools)
Hardware: ARM embedded development board, JTAG emulator for ARM7TDMI, PC Pentumn100 or above
Software
: PC operating system win98, ARM SDT 2.51 integrated development environment, emulator driver, Source
Insight 3.0, HyperTerminal communication program, USB download program, UltraEdit
V. Experimental steps
1. In ARM SDT 2.51, use the template created in Experiment 1 to create a new project work1.
Add the header files (*.h) and library files (*.alf) required by the operating system to the project.
2. Use Source Insight 3 to create a project and add the C language source files in work1.
3. Open the Main.c file and add code to the Main_Task task to create a text
box when the system starts. Start the message loop so that the user can edit the system time through the keyboard.
4. Create a new task in the Main_Task task, which is responsible for updating the system time. Define
a semaphore to ensure that there is no conflict when multiple tasks in the system access the text box to update the system clock.
The specific program flow chart of the Main_Task task is shown in the figure.
5. Edit the code of the clock update task. The specific program flow of this task is shown in the figure.
Tips:
⑴ Use CreateTextCtrl function to create a text box, and SetTextCtrlText function to set the content in the text box.
⑵ Use OSTaskCreate to create a system task. In the uCOS-II system, the priority of tasks cannot
be the same. For example, the priority of Main_Task task is 12, and the priority of Key_Scan_Task task is 56.
The current version of uCOS-II only supports 64 tasks, including 8 system tasks, and
the number of tasks that users can use is 56. When creating a task, you need to select an appropriate task priority (for example: 14).
⑶ Use SetTextCtrlEdit function to set whether the text box is in the editing state, and use
TextCtrlDeleteChar and AppendChar2TextCtrl functions to delete and append characters in the text box.
⑷ Use OSSemCreate function to create a semaphore controlled by the text box. OSSemPend function waits for and obtains
the semaphore controlled by the text box; OSSemPost releases the semaphore controlled by the text box.
⑸ Use the Rtc_IsTimeChange function to determine whether a certain bit corresponding to the system clock has changed. Use
Rtc_Format to format the system clock format to obtain a Unicode string, which can be easily displayed in the text box control
.
7. Use ARM SDT 2.5 to compile, download and debug the above program, and check the running results
. 8. Generate a .bin file for the release version, download it to the embedded development board via USB, run it and check the output results.
Previous article:ARM comprehensive experiment
Next article:Use of ARM's list box control
- Popular Resources
- Popular amplifiers
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
- Check and compare the specified current limit with the actual current limit. Have you used counterfeit LM257x and LM259x?
- I'm soldering a board recently, but I saw that the circuit requires 500k ohm and 5meg resistors. Do you have something similar that I can use? ?
- MSP430 Learning Experience
- Understanding and Utilizing Solar Loads for Augmented Reality Head-Up Displays
- For example, for a 24-bit ADC, we only know the accuracy. How is the sampling speed/sampling rate of the microcontroller calculated?
- #Idle Market#Selling Texas Instruments Tiva C Series TM4C123G Development Board
- A Preliminary Study on the Working Principle of PCIe
- FAQ_ How to set up the allocation of memory to the dynamic memory area
- 【Running posture training shoes】No.003-Data collection and real-time display
- [Open Source] FPGA-based binocular camera adapter board