Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
2410BEEP.c
Package: arm_exam.rar [view]
Upload User: mhstny
Upload Date: 2022-08-05
Package Size: 793k
Code Size: 1k
Category:
ARM-PowerPC-ColdFire-MIPS
Development Platform:
Unix_Linux
- #include "2410addr.h"
- #include "2410lib.h"
- #include "def.h"
- /****************************************************************************
- 【功能说明】蜂鸣器PWM测试
- ****************************************************************************/
- void Buzzer_Freq_Set( U32 freq )
- {
- rGPBCON = rGPBCON & ~(3<<0)|(1<<1);//set GPB0 as tout0, pwm output
- rTCFG0 = rTCFG0 & ~0xff|15; //prescaler = 15
- rTCFG1 = rTCFG1 & ~0xf|2;//divider = 1/8
- rTCNTB0 = (PCLK>>7)/freq;//rTCNTB0=PCLK/{(prescaler+1) * divider *freq}
- rTCMPB0 = rTCNTB0>>1; //占空比50%
- //disable deadzone, auto-reload, inv-off, update TCNTB0&TCMPB0, start timer 0
- rTCON = rTCON & ~0x1f|(0<<4)|(1<<3)|(0<<2)|(1<<1)|(1);
- rTCON &= ~(1<<1); //clear manual update bit
- }
- void Buzzer_Stop( void )
- {
- rGPBCON &= ~12; //set GPB1 as output
- rGPBCON |= 4;
- rGPBDAT &= ~1;
- }
- void Buzzer_PWM_Run( void )
- {
- U16 freq = 2000 ;
- Buzzer_Freq_Set( freq ) ;
- }