#define GPFCON (*(volatile unsigned*)(0x7F0080A0))
#define GPFDAT (*(volatile unsigned*)(0x7F0080A4))
#define GPFPUD (*(volatile unsigned*)(0x7F0080A8))
#define PCLK 66000000
#define HCLK 133000000
#define TCFG0 (*(volatile unsigned*)(0x7F006000))
#define TCFG1 (*(volatile unsigned*)(0x7F006004))
#define TCON (*(volatile unsigned*)(0x7F006008))
#define TCNTB0 (*(volatile unsigned*)(0x7F00600C))
#define TCMPB0 (*(volatile unsigned*)(0x7F006010))
#define TCNTO0 (*(volatile unsigned*)(0x7F006014))
#define TCNTB1 (*(volatile unsigned*)(0x7F006018))
#define TCMTB1 (*(volatile unsigned*)(0x7F00601C))
#define TCNTO1 (*(volatile unsigned*)(0x7F006020))
#define TCNTB2 (*(volatile unsigned*)(0x7F006024))
#define TCNTO2 (*(volatile unsigned*)(0x7F00602C))
#define TCNTB3 (*(volatile unsigned*)(0x7F006030))
#define TCNTO3 (*(volatile unsigned*)(0x7F006038))
#define TCNTB4 (*(volatile unsigned*)(0x7F00603C))
#define TCNTO4 (*(volatile unsigned*)(0x7F006040))
#define TINT_CSTAT (*(volatile unsigned*)(0x7F006044))
void udelay(unsigned int num)
{
unsigned int val;
val=PCLK/1000000-1;
TCFG0&=~(0xff<<8);
TCFG0|=(0x00<<8);
TCFG1&=~(0xf<<8);
TCFG1|=(0x0<<8);
TCNTB2=val;
TCON&=~(0xf<<12);
TCON|=(0xb<<12);
TCON&=~(2<<12);
while(num--)
{
while(TCNTO2>=val>>1);
while(TCNTO2
}
}
void init(void)
{
GPFCON&=~(2<<30);
GPFCON|=(1<<30);
GPFPUD&=~(0x3<<(2*15));
GPFDAT|=(0x8000);
}
void beep_off(void)
{
GPFDAT|=0x8000;
}
void beep_on(void)
{
GPFDAT&=0x7fff;
}
void beep(void)
{
while(1)
{
int i,j;
beep_on();
for(i=0;i<1000;i++)
udelay(1000);
beep_off();
for(j=0;j<5000;j++)
udelay(1000);
}
}
int main()
{
init();
beep();
}
int.s
IMPORT main
AREA |C$$code|, CODE, READONLY
global start
start
bl main
END
Previous article:315/433Mhz wireless learning materials
Next article:A programmer's experience and reality: I just want a warehouse!
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Download from the Internet--ARM Getting Started Notes
- Learn ARM development(22)
- Learn ARM development(21)
- Learn ARM development(20)
- Learn ARM development(19)
- Learn ARM development(14)
- Learn ARM development(15)
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- Find an amplifier circuit
- Interrupt-Based Ambient Light and Environment Sensor Node Reference Design for Sub-1 GHz Networks
- STM32CUbe usage issues
- [Rawpixel RVB2601 development board trial experience] 1. Multi-task lighting RGB
- 2833xAdcSoc Programming Example
- Differences between MPU and MCU and selection tips
- AT32F425-Evaluation Report-FreeRTOS_08
- Low-power MCUs and smart buildings
- Value Series MSP430 LaunchPad Development Kit
- EEWORLD University Hall----Live Replay: Rochester Rochester Electronic Semiconductor Full-cycle Solutions Help You Meet the Challenges of Supply Chain Disruptions and Component Discontinuation