📄 f411_vr.lst
字号:
C51 COMPILER V7.06 F411_VR 02/18/2009 16:30:48 PAGE 1
C51 COMPILER V7.06, COMPILATION OF MODULE F411_VR
OBJECT MODULE PLACED IN F411_VR.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE F411_VR.c BROWSE DEBUG OBJECTEXTEND
stmt level source
1 //-----------------------------------------------------------------------------
2 // F411_VR.c
3 //-----------------------------------------------------------------------------
4 // Copyright 2006 Silicon Laboratories, Inc.
5 // http://www.silabs.com
6 //
7 // Program Description:
8 //
9 // This program uses the DPCM functions to encode voice samples and saves them
10 // to flash memory. This program also interfaces with a speaker or headphones
11 // to play back the recorded voice.
12 //
13 // How To Use: See Readme.txt
14 //
15 // FID: 41X000005
16 // Target: C8051F411
17 // Tool chain: Keil C51 7.50 / Keil EVAL C51
18 // Silicon Laboratories IDE version 2.6
19 // Project Name: F411_VR
20 //
21 // Release 1.3
22 // -All changes by TP
23 // -02 Feb 2006
24 // -minor changes in comments
25 //
26 // Release 1.2
27 // -All changes by TP
28 // -21 Nov 2005
29 // -Revised for a 2-button version of the board with
30 // volume wheel.
31 //
32 // Release 1.1
33 // -All changes by TP
34 // -16 Aug 2004
35 // -project version updated, no changes to this file
36 //
37 // Release 1.0
38 // -Initial Revision (TP)
39 // -15 AUG 2004
40 //
41
42
43 //-----------------------------------------------------------------------------
44 // Includes
45 //-----------------------------------------------------------------------------
46 #include <c8051f410.h> // SFR declarations
47 #include "F411_VR_DPCM.h" // contains DPCM functions
48 #include "F411_VR_SSTFlash.h" // contains functions to write to the
49 // serial SST external 512 kb Flash
50 #include "F411_VR_LED.h" // contains functions to control the
51 // intensity of the LEDs
52
53 //-----------------------------------------------------------------------------
54 // 16-bit SFR Definitions for 'F411
55 //-----------------------------------------------------------------------------
C51 COMPILER V7.06 F411_VR 02/18/2009 16:30:48 PAGE 2
56
57 // SFR16 Defintions (Timers, ADC, and DAC)
58 sfr16 TMR2RL = 0xCA; // Timer 2 Reload address
59 sfr16 TMR2 = 0xCC; // Timer 2 Counter address
60 sfr16 TMR3RL = 0x92; // Timer 3 Reload address
61 sfr16 TMR3 = 0x94; // Timer 3 Counter address
62 sfr16 ADC0DAT = 0xBD; // ADC 16-bit address
63 sfr16 IDA0DAT = 0x96; // IDAC 16-bit address
64
65 //-----------------------------------------------------------------------------
66 // Global CONSTANTS
67 //-----------------------------------------------------------------------------
68
69 // General Constants
70 #define SYSCLK 6125000 // system clock in Hz (24.5 MHz / 4)
71
72 // T1 runs at SYSCLK / 48
73 #define POLLING 1992 // poll the switches at 64 Hz
74 #define PRCHANGE 20000 // wait approx. 150ms after a button is
75 // pressed to "debounce" the switches
76
77 #define SAMP_FREQ 764 // use 8kHz sampling for both the ADC
78 // and DAC
79
80 #define MAX_MEM_ADDR 0x0007FFFF // 512K = 2^19 address bits
81 #define NEAR_END_ADDR 0x00065F55 // for every 4 samples, 3 bytes are
82 // written to memory, so 10.67 kHz
83 // ((8 kHz * 4)/3) writing time = 106666
84 // addresses every 10 seconds, so give
85 // about 10 seconds of warning
86
87 #define mid_range 2048 // middle value of 12-bit ADC and DAC
88
89 // System States
90 #define IDLE 0x00 // indicates no current action
91 #define RECORDING 0x01 // indicates the device is recording
92 #define PLAYING 0x02 // indicates the device is playing
93 #define END_MEM 0x04 // flag used if the end of memory is
94 // reached
95 #define ERASED 0x08 // flag used if memory is erased
96
97 // Port Pin Definitions
98 sbit REC_PLAY = P1^7;
99 sbit ERASE = P1^6;
100 sbit TRANS = P1^3;
101 sbit LED0 = P2^1;
102 sbit LED1 = P2^0;
103
104 sbit SCK = P0^4;
105 sbit MISO = P0^5;
106 sbit MOSI = P0^6;
107 sbit NSS = P0^7;
108
109 //-----------------------------------------------------------------------------
110 // Global VARIABLES
111 //-----------------------------------------------------------------------------
112
113 unsigned char system_state = IDLE; // start in idle mode
114 // bit 3 of the system_state indicates
115 // if the end of memory has been
116 // reached
117 // bit 4 of the system_state indicates
C51 COMPILER V7.06 F411_VR 02/18/2009 16:30:48 PAGE 3
118 // if the memory has been erased since
119 // the last action (1 = erased)
120
121
122 // Ending address of the recording in memory
123 unsigned long rec_end_addr = 0x00000000;
124
125 // flags to communicate between the T1 ISR and the ADC/DAC ISRs for various
126 // termination events
127 bit ADC_STOP_FLAG = 0;
128 bit MEM_END_NEAR_FLAG = 0;
129 bit MEM_END_FLAG = 0;
130 bit REC_END_FLAG = 0;
131 bit DAC_STOP_FLAG = 0;
132 bit ENTER_SUSPEND = 0;
133
134 //-----------------------------------------------------------------------------
135 // Function PROTOTYPES
136 //-----------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -