1. Use the initialization file that Samsung has already written
1. Create a project folder first
2. Create a project and save it in the new folder
3. Drag the INC and SRC folders in the INIT folder written by ARM Samsung into the new folder.
4. Create a C file, such as LCD1602.c, and write a void xmain() function or a void xxxx() function
5. Add 2440init in SRC to the project.
6. Change the corresponding main function entry in 2440init to the function xmain in LCD1602.c. This is very important so that other functions can be written by adding header files, otherwise they cannot be executed. See the figure below
2. Write your own initialization
1. Create a project folder first
2. Create a project and save it in the new folder (the path is in English)
3. Create your own initialization function init.s. The initialization file must be written in assembly language. At least the following code is required (this is very important)
MPORT name AREA Init,CODE,READONLY
ENTRY
bl name
end
Note: name must be the main function name, other functions can be written according to the general writing method of C files, such as the following program code:
#include"2440addr.h" //Defines the address and name of each special function register. This header file must be called to use it./*===
If this header file is not called, the definition name and address statement to be used must be declared before the main program.
#define rGPBCON (*(volatile unsigned *)0x56000010)//Port B control
#define rGPBDAT (*(volatile unsigned *)0x56000014)//Port B data
#define rGPBUP (*(volatile unsigned *)0x56000018)//Pull-up control */
/* Custom simple delay program */
int name(int times)
{
int i;
for(i=0;i
}
/* Main program */
void xmain(void) //The main function name corresponds to the main function entry address and is defined in 2440init.s
{ //Do not write main or Main at will, check the 2440init.s file (see the figure below)
rGPBCON |=0x3fc00; //GPB5-8 able output, first let 11 1111 11xx xxxx xxxx
rGPBCON &=0x157ff; // 00-in 01-out 01 0101 01xx xxxx xxxx
// P8 P6P7 P5P4 P3P2 P1P0
// G GG G x xx xx
while(1)
{
rGPBDAT|=0x1e0;//GPB8 output 0 1 111x xxxx
rGPBDAT&=0xeff;// 0 111x xxxx
delay(5);//Call the delay program written in assembly language
rGPBDAT|=0x1e0;//GPB7 output 0 1 111x xxxx
rGPBDAT&=0xf7f;// 1 011x xxxx
delay(5);//Call the delay program written in assembly language
rGPBDAT|=0x1e0;//GPB6 output 0 1 111x xxxx
rGPBDAT&=0xfbf;// 1 101x xxxx
delay(5);//Call the delay program written in assembly language
rGPBDAT|=0x1e0;//GPB5 output 0 1 111x xxxx
rGPBDAT&=0xfdf;// 1 110x xxxx
delay(5);//Call the delay program written in assembly language
}
}
You can also continue to follow the steps below to add
4. Use the header file method to write the sub-functions you need in the form of header files.h. Write as many sub-functions as you need.
5. Write your own main function. The name of the main function should be the same as the name in the initialization function.
6. Add the above files to the project.
Previous article:ARM reads DS1302 assembly program
Next article:ARM 2440 naked implementation of electronic clock
Recommended ReadingLatest update time:2024-11-16 07:41
- 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
- Help with the new book "Real-Time Systems Development with RTEMS and Multicore Processors"
- FPGA Design Practice (Logic)
- SIMterix-Simplies~4~ Verilog
- 6. [Learning LPC1768 library functions] Watchdog experiment
- [AT32F421 Review] +PWM adjusts fan speed
- 【IOT harmful gas detection equipment based on STM32F7508-DK】Work submission
- Five Design Challenges Facing Remote Patient Monitoring Systems
- Share a table of the electrical and thermal characteristics of the selected packaging materials
- [RVB2601 Creative Application Development] Flower Watering Detector - Development Board Introduction
- Come if you dare | Infineon IGBT7 escape room, you are invited to play!