ARM multitasking and system clock

Publisher:ph49635359Latest update time:2011-11-08 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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.

Reference address:ARM multitasking and system clock

Previous article:ARM comprehensive experiment
Next article:Use of ARM's list box control

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号