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.
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
- Popular Resources
- Popular amplifiers
- Naxin Micro and Xinxian jointly launched the NS800RT series of real-time control MCUs
- How to learn embedded systems based on ARM platform
- Summary of jffs2_scan_eraseblock issues
- Application of SPCOMM Control in Serial Communication of Delphi7.0
- Using TComm component to realize serial communication in Delphi environment
- Bar chart code for embedded development practices
- Embedded Development Learning (10)
- Embedded Development Learning (8)
- Embedded Development Learning (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Intel promotes AI with multi-dimensional efforts in technology, application, and ecology
- ChinaJoy Qualcomm Snapdragon Theme Pavilion takes you to experience the new changes in digital entertainment in the 5G era
- Infineon's latest generation IGBT technology platform enables precise control of speed and position
- Two test methods for LED lighting life
- Don't Let Lightning Induced Surges Scare You
- Application of brushless motor controller ML4425/4426
- Easy identification of LED power supply quality
- World's first integrated photovoltaic solar system completed in Israel
- Sliding window mean filter for avr microcontroller AD conversion
- What does call mean in the detailed explanation of ABB robot programming instructions?
- STMicroelectronics discloses its 2027-2028 financial model and path to achieve its 2030 goals
- 2024 China Automotive Charging and Battery Swapping Ecosystem Conference held in Taiyuan
- State-owned enterprises team up to invest in solid-state battery giant
- The evolution of electronic and electrical architecture is accelerating
- The first! National Automotive Chip Quality Inspection Center established
- BYD releases self-developed automotive chip using 4nm process, with a running score of up to 1.15 million
- GEODNET launches GEO-PULSE, a car GPS navigation device
- Should Chinese car companies develop their own high-computing chips?
- Infineon and Siemens combine embedded automotive software platform with microcontrollers to provide the necessary functions for next-generation SDVs
- Continental launches invisible biometric sensor display to monitor passengers' vital signs
- 【TI recommended course】#Consumer electronics application and design seminar#
- Advantages and disadvantages of totem pole compared to single transistor driver
- Application of cognitive radio technology in the commercial field
- RT-thread studio hardware timer counting issue
- Highly recommend a good introductory book on digital signal processing
- Study on the Phase Shift Mechanism of Reggia-Spencer Phase Shifter
- python3,snake
- Fennel – Lisp syntax for Lua programming
- [LSM6DSOX finite state machine routine study 1]--Introduction to finite state machine and routine
- Reading the good book "Operational Amplifier Parameter Analysis and LTspice Application Simulation" Reading experience 01- Familiarity with the book