📄 dac_drv.lst
字号:
C51 COMPILER V7.20 DAC_DRV 03/24/2007 10:02:36 PAGE 1
C51 COMPILER V7.20, COMPILATION OF MODULE DAC_DRV
OBJECT MODULE PLACED IN .\Output\dac_drv.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE lib_refd\dac\dac_drv.c OPTIMIZE(7,SPEED) BROWSE INCDIR(.\modules\system;.\;
-.\;.\lib_refd) DEFINE(KEIL) DEBUG OBJECTEXTEND PRINT(.\Output\dac_drv.lst) OBJECT(.\Output\dac_drv.obj)
line level source
1 /*C**************************************************************************
2 * NAME: dac_drv.c
3 *----------------------------------------------------------------------------
4 * Copyright (c) 2003 Atmel.
5 *----------------------------------------------------------------------------
6 * RELEASE: snd1c-refd-nf-4_0_3
7 * REVISION: 1.5
8 *----------------------------------------------------------------------------
9 * PURPOSE:
10 * This file contains routines to address UDA1330ATS in L3 mode
11 *
12 *****************************************************************************/
13
14 /*_____ I N C L U D E S ____________________________________________________*/
15
16 #include "config.h" /* lib configuration header */
17 #include "board.h" /* board definition */
18 #include "dac_drv.h" /* dac driver definition */
19
20 /*_____ M A C R O S ________________________________________________________*/
21
22
23 /*_____ D E F I N I T I O N ________________________________________________*/
24
25 /*_____ D E C L A R A T I O N ______________________________________________*/
26
27 #ifdef DAC_L3MODE
/*F**************************************************************************
* NAME: dac_byte_send
*----------------------------------------------------------------------------
* PARAMS:
* b: byte to send
* return:
*----------------------------------------------------------------------------
* PURPOSE:
* Serialize a data/cmd/addr byte on DAC_L3DATA & DAC_L3CLOCK pins.
*----------------------------------------------------------------------------
* NOTE:
* This function should only be used by dac_l3mode_send
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
void dac_byte_send (Byte b)
{
Byte c;
for (c=8;c;c--)
{
DAC_L3DATA=(b&1); // practically 50% duty cycle
DAC_L3CLOCK=0;
b>>=1;
DAC_L3CLOCK=1; // data bit is sampled here (rising edge)
}
}
C51 COMPILER V7.20 DAC_DRV 03/24/2007 10:02:36 PAGE 2
/*F**************************************************************************
* NAME: dac_l3mode_send
*----------------------------------------------------------------------------
* PARAMS:
* addr: logical address of the chip (000101xxb for UDA1330)
* b: data/cmd byte to send
* return:
*----------------------------------------------------------------------------
* PURPOSE:
* Send a L3-mode command to the DAC UDA1330
*----------------------------------------------------------------------------
* NOTE:
* This function improve the song quality (low level, decrease signal/noise).
*----------------------------------------------------------------------------
* REQUIREMENTS:
* Only tested with UDA1330ATS
*****************************************************************************/
void dac_l3mode_send (Byte addr,Byte b)
{
/*
DAC_TEST=0; // be carefull ! if DAC_TEST is set with DAC_APPSEL not set, I/O of UDA1330 change a lot
DAC_APPSEL=0; // Turn DAC in L3 mode
DAC_L3MODE=1;
DAC_L3CLOCK=1;
DAC_L3DATA=1; // Normal state, basically, those three pins are already set
// Begin Addr transfer
DAC_L3MODE=0;
*/
dac_byte_send(addr);
// Begin Data/Cmd transfer
//DAC_L3MODE=1;
dac_byte_send(b);
// Ack end of data/cmd transfer
//DAC_L3MODE=0;
//DAC_L3MODE=1;
}
/*F**************************************************************************
* NAME: dac_set_vol
*----------------------------------------------------------------------------
* PARAMS:
*
* return:
*----------------------------------------------------------------------------
* PURPOSE:
* Use the DAC to modify song level.
*----------------------------------------------------------------------------
* NOTE:
* This function must be call each time mp3_volume is changed
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
void dac_set_vol (Byte volume)
{
if (volume>=32) volume=16; // security !
if (volume<24)
{
MP3VOL = MP3VOR = 15;
dac_l3mode_send(DAC_L3I_ADDR,64-(volume<<1)-volume+(volume>>2));
}
C51 COMPILER V7.20 DAC_DRV 03/24/2007 10:02:36 PAGE 3
else
{
MP3VOL = MP3VOR = 15 + ((volume-23)<<1);
dac_l3mode_send(DAC_L3I_ADDR,0);
}
}
#endif
125
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = ---- ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = ---- ----
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -