资源简介
C8051F005做的手机震动马达测试程序
代码片段和文件信息
//-----------------------------------------------------------------------------
// F0xx_DACs_SineCosine.c
//-----------------------------------------------------------------------------
// Copyright 2006 Silicon Laboratories Inc.
// http://www.silabs.com
//
// Program Description:
//
// This program outputs sine and cosine waveforms using the hardware DACs
// on the C8051F005 microcontroller. The waveforms are output on pins DAC0
// and DAC1.
//
// The output of the DAC is updated upon a Timer3 interrupt.
//
// The frequency of the output waveforms is set by the #define .
// To achieve the exact output frequency defined by an
// external crystal should be used.
//
// How To Test:
//
// 1) If desired populate an external crystal on the C8051F005-TB. Change
// the #define USB_EXT_OSC and #define SYSCLK to reflect using the crystal.
// Also verify that the crystal loading capacitors (C10 - 33pf C11 - 33pf)
// are appropriate for the crystal.
// 2) Download the code to the C8051F005 Development Board
// 3) Connect two oscillscope probes to pins DAC0 and DAC1. These pins are
// available on the J2 header on pins 48 and 50 respectively.
// 4) Run the code and confirm that there are two waveforms with the output of
// DAC1 leading the output DAC0 by 90 degrees. The frequency of both
// waveforms should be close to frequency defined by .
//
// FID: 00X000015
// Target: C8051F0xx
// Tool chain: Keil C51 7.50 / Keil EVAL C51
// Silicon Laboratories IDE version 2.71
// Command Line: Default
//
// Release 1.0
// -Initial Revision (GP)
// -11 JUL 2006
//
//-----------------------------------------------------------------------------
// Includes
//-----------------------------------------------------------------------------
#include // SFR declarations
//-----------------------------------------------------------------------------
// 16-bit SFR Definitions for ‘F02x
//-----------------------------------------------------------------------------
sfr16 TMR3RL = 0x92; // Timer3 reload
sfr16 TMR3 = 0x94; // Timer3
sfr16 DAC0 = 0xd2; // DAC0 data
sfr16 DAC1 = 0xd5; // DAC1 data
//-----------------------------------------------------------------------------
// Global Constants
//-----------------------------------------------------------------------------
#define USE_EXT_OSC 0 // 0 = use internal oscillator
// 1 = use external oscillator
#if(USE_EXT_OSC == 0)
#define SYSCLK 16000000 // Internal oscillator frequency in Hz
#endif
#if(USE_EXT_OSC == 1)
#define SYSCLK 22118400 // External oscillator frequency in Hz
#endif
#define SAMPLE_RATE_DAC 100000L // DAC sampling rate in Hz
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 12437 2009-07-12 21:08 F005\F0xx_DACs_SineCosine.#1
文件 12438 2009-07-12 21:06 F005\F0xx_DACs_SineCosine.#2
文件 12437 2009-07-12 21:09 F005\F0xx_DACs_SineCosine.c
文件 18373 2009-07-12 21:19 F005\F0xx_DACs_SineCosine.LST
文件 6043 2009-07-12 21:19 F005\F0xx_DACs_SineCosine.OBJ
文件 5900 2009-07-12 21:19 F005\sintest
文件 75 2009-07-12 21:19 F005\sintest.lnp
文件 8594 2009-07-12 21:19 F005\sintest.M51
....... 1618 2009-07-12 21:46 F005\sintest.opt.bak
文件 0 2014-08-28 14:10 F005\sintest.plg
....... 2288 2009-07-12 21:46 F005\sintest.Uv2.bak
....... 70619 2014-08-28 14:10 F005\sintest.uvgui.Administrator
....... 7214 2014-08-28 14:10 F005\sintest.uvopt
....... 13689 2014-08-28 14:10 F005\sintest.uvproj
文件 1065 2009-07-12 21:19 F005\sintest_Opt.Bak
文件 2273 2009-07-12 21:19 F005\sintest_Uv2.Bak
文件 6376 2007-09-12 14:52 F005\STARTUP.A51
文件 14049 2009-07-12 21:19 F005\STARTUP.LST
文件 749 2009-07-12 21:19 F005\STARTUP.OBJ
文件 33168 2009-12-08 22:39 F005\test.wsp
文件 141 2009-07-12 21:09 F005\tmp.out
目录 0 2014-08-28 14:10 F005
----------- --------- ---------- ----- ----
229546 22
- 上一篇:GPSINS组合导航系统GPSINS组合导航系统
- 下一篇:联机版井字棋游戏源代码
评论
共有 条评论