A simple example of porting ucos-ii to ARM mini2440

Publisher:火箭少年Latest update time:2022-10-18 Source: csdnKeywords:ucos-ii Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

A simple transplantation program led.c based on mini2440

#include "config.h"

#define LED1 (0<<5) //Define LED, GPB5

#define TaskStkLength 64 //Define stack length

OS_STK TaskLEDStk[TaskStkLength]; //Define the task LED stack

void TaskLED(void *pdata); //Declare task LED

int Main(void) //main(void) cannot be written in ADS, it must be capitalized

{

    TargetInit(); //Target board initialization

    OSInit(); //uC/OS-II initialization

    OSTimeSet(0); //Set the system time base, it is recommended to keep it

    OSTaskCreate(TaskLED,(void *)0,&TaskLEDStk[TaskStkLength-1],3); //Create LED task

    OSStart();

    return 0;

}

void TaskLED(void *pdata)

{

    #if OS_CRITICAL_METHOD == 3  

    OS_CPU_SR cpu_sr;

    #endif  

    pdata=pdata; //Prevent alarms

    OS_ENTER_CRITICAL(); //close interrupt

    Timer0Init(); //initial timer0 for ucos time tick //timer.c 

    ISRInit(); //initial interrupt prio or enable or disable //timer.c

    OS_EXIT_CRITICAL(); //open interrupt

      while(1)          

    {

        rGPBCON&=(1<<10);

        rGPBDAT=LED1; //LED is on

        OSTimeDly(25); //Delay 20 beats

        rGPBDAT=~LED1; //LED off

        OSTimeDly(25); //Delay 20 beats

    }

}      


Add the above code source file to your newly created project, debug and compile to make LED1 flash! Pay attention to the configuration of ADS.


Keywords:ucos-ii Reference address:A simple example of porting ucos-ii to ARM mini2440

Previous article:Mini2440 linux LCD driver transplantation and some problems encountered
Next article:Friendly Arm Mini2440 Nand Flash driver analysis under embedded Linux

Recommended ReadingLatest update time:2024-11-23 18:22

Design and implementation of embedded game system based on ARM7
1. Introduction Due to the special working environment of coal mine production, the production process is more dangerous and unsafe than the general industry. With the continuous increase in coal mining, safety issues have become increasingly serious, and various major accidents are often reported in the media.
[Microcontroller]
Design and implementation of embedded game system based on ARM7
Design of computer embroidery machine control system based on ARM and FPGA
Computer embroidery machine is an integrated optical, mechanical and electrical equipment that has been continuously developed with the application and development of computer technology, electronic technology and mechanical processing technology. The development and research of embedded systems are in full swing, a
[Microcontroller]
Design of computer embroidery machine control system based on ARM and FPGA
Design of RFID middleware system based on ARM
Introduction RFID middleware acts as a bridge between RFID readers and applications. The application side uses a set of common application program interfaces (APIs) provided by the middleware to connect to the RFID reader and collect RFID tag data. Even if the database software or back-end application that store
[Microcontroller]
Design of RFID middleware system based on ARM
Analysis of ARM's STRB and LDRB instructions
1. SDRAM 1. Storage structure The inside of SDRAM is a storage array. The array is like a table, and data is "filled" into it. When reading and writing data, it is the same as the retrieval principle of a table. First specify a row (Row), then specify a column (Column), and we can accurately find the required cell. Th
[Microcontroller]
Analysis of ARM's STRB and LDRB instructions
The development platform based on ARM+FPGA implements the MAC protocol based on CSMA/CA
0 Preface The advantages of the MAC protocol based on CSMA/CA are its simplicity and robustness. It is suitable for distributed networks. Each node does not need to maintain and dynamically update the status information of the surrounding adjacent nodes. It can independently decide when to access the channel. As long
[Microcontroller]
The development platform based on ARM+FPGA implements the MAC protocol based on CSMA/CA
Design of embedded four-axis motion controller based on ARM+DSP
Motion control systems have been widely used in the field of industrial control. In recent years, industrial control has placed higher and higher demands on motion control systems. Traditional PC-based and low-end microcontrollers have increasingly exposed problems such as high cost, high consumption, and low reliabil
[Power Management]
Design of embedded four-axis motion controller based on ARM+DSP
ARM WFI and WFE instructions
1 Introduction I have known about the existence of WFI and WFE for a long time, but I have never understood them very well. Recently, I am going to study CPU idle framework. Since WFI is a way to put the CPU into idle state, I am determined to understand them. WFI (Wait for interrupt) and WFE (Wait for event) are tw
[Microcontroller]
Mini2440 simple bare metal LED water lamp code
MINI2440 simple bare metal LED water lamp code   ADS configures the post-liner of the target setting to ARM formELF In the ARM Assembler of language setting and the Architecture or processor of Target of ARM C Compile, set it to arm920T In the ARM linker, output--simple image--RO base is set to 0x30000000; option
[Microcontroller]
Latest Microcontroller Articles
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号