RCA接口在我们日常生活中也非常常见,音箱、电视、功放、DVD机等设备上基本都有。它得名于美国无线电公司的英文缩写(Radio
Corporation of
America),上世纪40年代的时候,该公司将这种接口引入市场,用它来连接留声机和扬声器,也因此,它在欧州又称为PHONO接口。我们对它更熟悉的接头称呼则是“莲花头”。
Digital Computers use Binary number system to represent all types of
information inside the computers. Alphanumeric characters are
represented using binary bits (i.e., 0 and 1). Digital representations
are easier to design, storage is easy, accuracy and precision are
greater.
There are various types of number representation techniques for
digital number representation, for example: Binary number system, octal
number system, decimal number system, and hexadecimal number system etc.
But Binary number system is most relevant and popular for representing
numbers in digital computer system.
Storing Real Number
These are structures as following below −
There are two major approaches to store real numbers (i.e., numbers
with fractional component) in modern computing. These are (i) Fixed
Point Notation and (ii) Floating Point Notation.
In fixed point notation, there are a fixed number of digits
after the decimal point, whereas floating point number allows for a
varying number of digits after the decimal point.
在定点表示法中,小数点后有固定位数,而浮点数允许小数点后有不同位数。
Fixed-Point Representation
This representation has fixed number of bits for integer part and for
fractional part. For example, if given fixed-point representation is
IIII.FFFF, then you can store minimum value is
0000.0001 and maximum value is 9999.9999.
There are three parts of a fixed-point number representation:
the sign field, integer
field, and fractional field.
We can represent these numbers using:
Signed representation: range from -(2(k-1)-1) to
(2(k-1)-1), for k bits.
1’s complement representation: range from -(2(k-1)-1) to
(2(k-1)-1), for k bits.
2’s complementation representation: range from -(2(k-1))
to (2(k-1)-1), for k bits.
2’s complementation representation is preferred in computer system
because of unambiguous property and easier for arithmetic
operations.
Example
Assume number is using 32-bit format which reserve 1 bit for the
sign, 15 bits for the integer part and 16 bits for the fractional
part.
Then, -43.625 is represented as following:
Where, 0 is used to represent plus(+) and 1 is used to
represent minus(-) . 000000000101011 is 15 bit binary value for
decimal 43 and 1010000000000000 is 16 bit binary value for fractional
0.625.
The advantage of using a fixed-point representation is performance
and disadvantage is relatively limited range of values that they can
represent. So, it is usually inadequate for numerical analysis as
it does not allow enough numbers and accuracy. A number whose
representation exceeds 32 bits would have to be stored inexactly.
These are above smallest positive number and largest positive number
which can be store in 32-bit representation as given above format.
Therefore, the smallest positive number is 2-16 ≈ 0.000015
approximate and the largest positive number is
(215-1)+(1-2-16)=215(1-2-16)
=32768, and gap between these numbers is 2-16.
We can move the radix point either left or right with the help of
only integer field is 1.
Floating-Point
Representation
This representation does not reserve a specific number of bits for
the integer part or the fractional part. Instead it reserves a certain
number of bits for the number (called the mantissa or significand) and a
certain number of bits to say where within that number the decimal place
sits (called the exponent).
The floating number representation of a number has two part: the
first part represents a signed fixed point number called mantissa. The
second part of designates the position of the decimal (or binary) point
and is called the exponent. The fixed point mantissa(定点尾数) may be
fraction or an integer. Floating -point is always interpreted to
represent a number in the following form: Mxre.
Only the mantissa m and the exponent e are physically represented in
the register (including their sign). A floating-point binary number is
represented in a similar manner except that is uses base 2 for the
exponent. A floating-point number is said to be normalized if the most
significant digit of the mantissa is 1.
So, actual number is (-1)s (1+m) x2(e-Bias),
where s is the sign bit, m is the mantissa, e
is the exponent value, and Bias is the bias number.
Note that signed integers and exponent are represented by either sign
representation, or one’s complement representation, or two’s complement
representation.
The floating point representation is more flexible. Any non-zero
number can be represented in the normalized form of
±(1.b1b2b3 ...)2
x2n This is normalized form of a number x.
Example
Suppose number is using 32-bit format: the 1 bit sign bit(符号位),
8 bits for signed exponent(符号数), and 23 bits for the fractional
part(小数). The leading bit 1 is not stored (as it is always 1 for a
normalized number) and is referred to as a “hidden bit”.
Then −53.5 is normalized as -53.5=(-110101.1)2=(-1.101011)
x25 , which is represented as following below,
Where 00000101 is the 8-bit binary value of exponent
value +5.
Note that 8-bit exponent field is used to store integer exponents
-126 ≤ n ≤ 127.
The smallest normalized positive number that fits into 32 bits is
(1.000,000,000,000,000,000,000,00)2x26-126=2-126≈1.18x10-38
, and largest normalized positive number that fits into 32 bits is
(1.111,111,111,111,111,111,111,11)2x2127=(224-1)x2104 ≈
3.40x1038. These numbers are represented as following
below,
The precision of a floating-point format is the number of positions
reserved for binary digits plus one (for the hidden bit). In the
examples considered here the precision is 23+1=24.
The gap between 1 and the next normalized floating-point number is
known as machine epsilon. the gap is
(1+2-23)-1=2-23 for above example, but this is
same as the smallest positive floating-point number because of
non-uniform spacing unlike in the fixed-point scenario.
Note that non-terminating binary numbers can be represented in
floating point representation, e.g., 1/3 = (0.010101 ...)2
cannot be a floating-point number as its binary representation is
non-terminating.
IEEE Floating point
Number Representation
IEEE (Institute of Electrical and Electronics Engineers) has
standardized Floating-Point Representation as following diagram.
So, actual number is (-1)s(1+m)x2(e-Bias),
where s is the sign bit, m is the mantissa, e
is the exponent value, and Bias is the bias number. The sign
bit is 0 for positive number and 1 for negative number. Exponents are
represented by or two’s complement representation.
According to IEEE 754 standard, the floating-point number is
represented in following ways:
Half Precision (16 bit): 1 sign bit, 5 bit exponent, and 10 bit
mantissa
Single Precision (32 bit): 1 sign bit, 8 bit exponent, and 23 bit
mantissa
Double Precision (64 bit): 1 sign bit, 11 bit exponent, and 52 bit
mantissa
Quadruple Precision (128 bit): 1 sign bit, 15 bit exponent, and 112
bit mantissa
Special Value
Representation
There are some special values depended upon different values of the
exponent and mantissa in the IEEE 754 standard.
All the exponent bits 0 with all mantissa bits 0 represents 0. If
sign bit is 0, then +0, else -0.
All the exponent bits 1 with all mantissa bits 0 represents
infinity. If sign bit is 0, then +∞, else -∞.
All the exponent bits 0 and mantissa bits non-zero represents
denormalized number.
All the exponent bits 1 and mantissa bits non-zero represents
error.
Super Harvard
Architecture(超级哈佛架构,SHARC),由ADI开发,具体解释见下方
BLACKFIN / SHARC。
Why Floating-Point DSP?
A digital signal processor’s data format determines its ability to
handle signals of differing precision, dynamic range,
and signal-to-noise ratios. Because floating-point DSP math
reduces the need for scaling and probability of overflow, using a
floating-point DSP can ease algorithm and software development.
The extent to which this is true depends on the floating-point
processor’s architecture.
Consistency with IEEE workstation simulations and the elimination
of scaling are two clear ease-of-use advantages. High-level language
programmability, large address spaces, and wide dynamic range allow
system development time to be spent on algorithms and signal processing
concerns, rather than assembly language coding, code paging, and error
handling.
--<ADSP-21160 SHARC® DSP Hardware Reference>
总结一下就是:
(The data format is) Suitable to handle various kind of
task (like differing precision, dynamic
range, and signal-to-noise ratios).
(F-P DSP math) Reduces the need of scaling and probability
of overflow.
High-level language programmability, large address spaces,
wide dynamic range.
/* * File: SigmaStudioFW.h * * Description: SigmaStudio System Framwork macro definitions. These * macros should be implemented for your system's software. * * This software is distributed in the hope that it will be useful, * but is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * This software may only be used to program products purchased from * Analog Devices for incorporation by you into audio products that * are intended for resale to audio product end users. This software * may not be distributed whole or in any part to third parties. * * Copyright � 2008 Analog Devices, Inc. All rights reserved. */ #ifndef __SIGMASTUDIOFW_H__ #define __SIGMASTUDIOFW_H__
/* * TODO: Update for your system's data type */ typedefunsignedshort ADI_DATA_U16; typedefunsignedchar ADI_REG_TYPE;
/* * Parameter data format */ #define SIGMASTUDIOTYPE_FIXPOINT 0 #define SIGMASTUDIOTYPE_INTEGER 1
/* * Write to a single Device register */ #define SIGMA_WRITE_REGISTER( devAddress, address, dataLength, data ) {/*TODO: implement macro or define as function*/}
/* * TODO: CUSTOM MACRO IMPLEMENTATION * Write to multiple Device registers */ #define SIGMA_WRITE_REGISTER_BLOCK( devAddress, address, length, pData ) {/*TODO: implement macro or define as function*/}
/* * TODO: CUSTOM MACRO IMPLEMENTATION * Writes delay (in ms) */ #define SIGMA_WRITE_DELAY( devAddress, length, pData ) {/*TODO: implement macro or define as function*/}
/* * Read device registers */ #define SIGMA_READ_REGISTER( devAddress, address, length, pData ) {/*TODO: implement macro or define as function*/}
/* * Set a register field's value */ #define SIGMA_SET_REGSITER_FIELD( regVal, fieldVal, fieldMask, fieldShift ) \ { (regVal) = (((regVal) & (~(fieldMask))) | (((fieldVal) << (fieldShift)) && (fieldMask))) } /* * Get the value of a register field */ #define SIGMA_GET_REGSITER_FIELD( regVal, fieldMask, fieldShift ) \ { ((regVal) & (fieldMask)) >> (fieldShift) } /* * Convert a floating-point value to SigmaDSP (5.23) fixed point format * This optional macro is intended for systems having special implementation * requirements (for example: limited memory size or endianness) */ #define SIGMASTUDIOTYPE_FIXPOINT_CONVERT( _value ) {/*TODO: IMPLEMENT MACRO*/}
/* * Convert integer data to system compatible format * This optional macro is intended for systems having special implementation * requirements (for example: limited memory size or endianness) */ #define SIGMASTUDIOTYPE_INTEGER_CONVERT( _value ) {/*TODO: IMPLEMENT MACRO*/}
HP即Headphone缩写,HP输出有两个输出端,分别是DAC0 和 DAC1,分别对应为
EVAL板 上的 OUT R(HP Right) 和 OUT L(HP Left)。
输出静音
输出断电
关于HP输出的寄存器 HP_EN_R 及 HP_EN_L
说明:
0x31 即 0011 0001 ,最后两位
01 即 HP_PDN_L 中的 01 。
输出音量控制
对输出音量进行控制需要先对S5、S6进行跳针。
TALKTHRU / DSP BYPASS
DSP BYPASS MODE When DSP bypass mode is enabled, a direct path from
the ADC outputs to the DACs is set up to enable bypassing the core
processing to listen to environmental sounds.
This is useful for listening to someone speaking without having to
remove the noise cancelling headphones. The DSP bypass path is
enabled by setting an MPx pin low.
Figure 92 shows the DSP bypass path disabled, and Figure 93 shows the
DSP bypass path enabled by pressing the push-button switch.
The DSP bypass feature works for both analog and digital microphone
inputs.
Enabled when a switch connected to an MPx
pin that is set to DSP bypass mode is closed and the MPx pin signal is
pulled low.
Pressing and holding the switch closed enables the DSP bypass signal
path as defined in the TALKTHRU register (Address 0x002A).
The DAC volume control setting is switched from the default gain
setting to the new TALKTHRU_GAINx register setting (Address 0x002B and
Address 0x002C).
DSP bypass is enabled only on ADC0 and ADC1.
The DSP bypass signal path is from the output of ADCx to the input of
the DAC(s). When DSP bypass is enabled, the current DAC volume setting
is ramped down to −95.625 dB and the DSP bypass volume setting is ramped
up to avoid pops when switching paths.
CHIP-ADSP21479
芯片及评估板资料
关于芯片特性:《ADSP-21477 / ADSP-21478 /
ADSP-21479》
关于评估板:《ADSP-21479 EZ-Board® Evaluation System
Manual》
仿真器配置
与《HPUSB, USB, and HPPCI Emulators User’s
Guide》所描述的并不完全一致。
void SIGMA_WRITE_REGISTER_BLOCK(byte IC_address, word subAddress, int dataLength, byte pdata[]) {
// start I2C transfer if (!i2c_start((IC_address)|I2C_WRITE)) { Serial.println("I2C device busy for WRITE REGISTER BLOCK"); return; }
// write subAddresses. (ADAU1761 needs the 16 bit subAddress written as two 8 bit bytes with an "ACK" inbetween uint8_t addressLowByte = subAddress & 0xff; uint8_t addressHighByte = (subAddress >> 8);
if (dataLength < 50 ) { for (int i=0; i<dataLength; i++) { i2c_write(pdata[i]); //write data bytes } } else { for (int i=0; i<dataLength; i++) { i2c_write(pgm_read_byte_near(pdata + i)); //write data bytes from PROGMEM (for param and program data) } } i2c_stop(); // stop the I2C communication
The GNU Compiler Collection (GCC) is a collection of compilers and
libraries for C, C++, Objective-C, Fortran, Ada, Go
, and D programming languages. A lot of open-source projects, including
the Linux kernel and GNU tools, are compiled using GCC.
This article explains how to install GCC on Ubuntu 20.04.
Installing GCC on Ubuntu
20.04
The default Ubuntu repositories contain a meta-package named
“build-essential” that includes the GNU compiler collection, GNU
debugger, and other development libraries and tools required for
compiling software.
To install the Development Tools packages, run the following command
as root or user
with sudo privileges :
1 2
sudo apt update sudo apt install build-essential
The command installs a lot of packages, including gcc,
g++ and make.
You may also want to install the manual pages about using GNU/Linux
for development:
1
sudo apt-get install manpages-dev
Verify that the GCC compiler is successfully installed by running the
following command that prints the GCC version:
1
gcc --version
Ubuntu 20.04 repositories provide GCC version 9.3.0:
1 2 3 4
gcc (Ubuntu 9.3.0-10ubuntu2) 9.3.0 Copyright (C) 2019 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
That’s it. GCC tools and libraries have been installed on your Ubuntu
system.
Compiling a Hello World
Example
Compiling a basic C or C++ program using GCC is pretty easy. Open
your text
editor and create the following file:
This creates a binary file named hello in the same
directory where you run the command.
Execute the hello program with:
1
./hello
The program should print:
1
Hello World!
Installing Multiple GCC
Versions
This section provides instructions about how to install and use
multiple versions of GCC on Ubuntu 20.04. The newer versions of the GCC
compiler include new functions and optimization improvements.
At the time of writing this article, the default Ubuntu repositories
include several GCC versions, from 7.x.x to
10.x.x.
In the following example, we will install the latest three versions
of GCC and G++.
Install the desired GCC and G++ versions by typing:
The commands below configures alternative for each version and
associate a priority with it. The default version is the one with the
highest priority, in our case that is gcc-10.
Press <enter> to keep the current choice[*], or type selection number:
You will be presented with a list of all installed GCC versions on
your Ubuntu system. Enter the number of the version you want to be used
as a default and press Enter.
The command will create symbolic
links to the specific versions of GCC and G++.
Conclusion
We’ve shown you how to installed GCC on Ubuntu 20.04. You can now
visit the official GCC
Documentation page and learn how to use GCC and G++ to compile your
C and C++ programs.
If you hit a problem or have feedback, leave a comment below.