Try to use the 6410 assembly, and find that it is similar to the 51 of that year. Learn step by step
;****************************************************** *************************************************** **********
;* File name: ok6410.s
;* Function: S3C6410 assembly
;* Author: cp1300@139.com
;* Created: January 4, 2013 21:27
;* Last modified: January 4, 2013
;* Details:
;****************************************************** *************************************************** **********/
TINT_CSTAT EQU 0x7F006044 ;Timer interrupt control and status register
VIC0ADDRESS EQU 0x71200F00 ; Current vector address register 0, write any data to clear interrupt
VIC1ADDRESS EQU 0x71300F00 ; Current vector address register 1, write any data to clear interrupt
;Call external function
IMPORT LED1_flash ;LED1 flashing program
; External call function
EXPORT Time_Isr ; Clock interrupt service routine
PRESERVE8;
AREA S3C6410_CPU, CODE, READONLY
;Timer 1 interrupt service routine, note: after entering the interrupt, 6410 automatically switches to IRQ mode and turns off the IRQ interrupt. When exiting, you need to turn it on yourself or restore the CPSR
Time_Isr
STMFD SP!, {R0,R1,LR} ;R0,R1,LR pushed onto the stack
LDR R0, =TINT_CSTAT
LDR R1, [R0] ; Read register TINT_CSTAT
ORR R1, R1, #0x01<<6 ; Write BIT6 to clear timer 1 interrupt
STR R1, [R0] ; write back register
BL LED1_flash ;Call LED flashing program
LDR R0, =VIC0ADDRESS ; Write VIC's current interrupt address register to clear the interrupt
LDR R1, =0xffffffff
STR R1, [R0]
LDR R0, =VIC1ADDRESS
STR R1, [R0]
LDMFD SP!, {R0,R1,LR} ;R0,R1,LR pop
;When using SUB before, it was found that the program did not recover from SPSR after exiting from the interrupt, that is, the interrupt mask was not removed. After adding -S, this instruction will affect the flag bit in CPSR, which means that SPSR_IRQ is restored to CRSP
SUBS PC, LR, #4; To exit from the interrupt program, LR needs to be decremented by 4 and put into PC, but the subroutine call does not need -4, which should be caused by the pipeline instruction prefetch
END
/****************************************************** *************************************************** **********
;* File name: ok6410.h
;* Function: S3C6410 assembly function definition
;* Author: cp1300@139.com
;* Created: January 4, 2013 21:27
;* Last modified: January 4, 2013
;* Details:
;****************************************************** *************************************************** **********/
#ifndef S3C6410_H_
#define S3C6410_H_
void Time_Isr(void); //Timer 1 interrupt service routine
#endif /*S3C6410_H_*/
#include "system.h"
#include "uart.h"
#include "tft_lcd.h"
#include "other.h"
#include "delay.h"
#include "timer.h"
#include "s3c6410.h"
void LED1_flash(void);
/****************************************************** *************************************************** ************************
*Function: void Timer_Init(u32 RTime,FunctionalState EnInt,void (*TimerIsr)(void))
*Function: Timer 1 initialization function
*Parameters: None
*Return: None
*Depends on: underlying macro definitions
*Author : cp1300@139.com
*Time : 20120520
*Last modified: 20120520
* Note: Timer 0 and Timer 1 share the same prescaler
*************************************************** *************************************************** *********************/
void Timer_Init(u32 RTime,FunctionalState EnInt,void (*TimerIsr)(void))
{
rTCFG0 |= 65; //Timer 0 pre-divided by 65+1, PCLK=66 provides the clock, 66 division generates 1MHz timer clock,
rTCON &= (~0xff00); //Clear settings
rTCON |= BIT11; //Timer 1 automatic update enable
rTCNTB1 = RTime; //Reload value
rTINT_CSTAT |= BIT6; //Clear interrupt flag
rTINT_CSTAT |= (EnInt == ENABLE) ? BIT1 : 0; // Enable timer 0 interrupt
Set_IsrAddr(INT_TIMER1,(u32)TimerIsr); //Set interrupt vector entry
Set_IntEnable(INT_TIMER1,EnInt); //Enable timer 1 global interrupt
//The following operation starts timer 0
rTCON |= BIT9; //manual update
rTCON &= ~BIT9; //End manual update
rTCON |= BIT8; //Start timer 0
}
//Main function
int main(void)
{
//u16 data;
UART0_Init(DISABLE,115200); //Initialize the serial port, disable interrupt reception, baud rate 115200
LCD_Init(); //Initialize LCD
LED_Init(); //Initialize LED
Timer_Init(400000-1,ENABLE,Time_Isr); //Initialize timer 1, period 400ms
while(1);
}
//LED1 flashing program, flashing in timer 1 interrupt service program, period 400MS
void LED1_flash(void)
{
LED1_FLASH();
}
Previous article:S3C6410 Bare Metal DMA
Next article:The problem of irrelevant code affecting decoding of S3C6410 hardware JPEG decoding has finally been solved
Recommended ReadingLatest update time:2024-11-23 18:50
- Popular Resources
- Popular amplifiers
- STC8 series MCU development guide: analysis and application of processors, programming and operating systems
- Compilation system perspective: Graphical explanation of the working mechanism and implementation principle of the GCC compiler
- Principles of Compilation 3rd Edition (Zhang Suqin, Wang Shengyuan, Dong Yuan, Lü Yingzhi, Jiang Weidu)
- Decompilation technology and software reverse analysis
- 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
- Beautiful Smart NeoPixel LED Cube
- Miniature RFCO2 Laser Power Supply
- Several issues about dual-port RAM memory
- How to choose an adjustable DC power supply?
- New version of electrical professional specification design
- VCD player with built-in amplifier
- Analysis and Suppression of Electromagnetic Interference of Switching Power Supply
- What electrical and electronic engineers must know
- Have you ever used a BP machine? It's 8012, but Japan has just said goodbye to BP machines
- Questions about ccsv8