ZHCAEJ8 October 2024 TAC5412-Q1
处于手动模式下的 SG2 会生成连续脉冲,用户可以使用 ADSR 注释启用和禁用该脉冲。这意味着在手动模式脚本的开头和结尾处写入 ADSR 注释。请参阅节 3.1。此处不提供重启和延音计时器。
在手动模式下,对生成的脉冲每秒采样的样本数根据工作采样频率确定。例如...
...表示在一秒钟之内有 96K 个样本。
在手动模式下,每个脉冲跨越一秒,然后重复。手动模式在进行频率扫描时会出现混叠。请参阅下面的公式以生成干净的信号。这些公式可推导出发生混叠的样本、每个脉冲所需的样本数以及每个频率上升的时间。
这组公式适用于所有 SG2 模式。
对手动模式编程时,首先执行 ADSR 确认脚本,然后,执行其他 ADSR 参数,并在手动模式脚本的最后执行 ADSR 启用命令。
# Key: w a0 XX YY ==> write to I2C address 0xa0, to register 0xXX, data 0xYY
# # ==> comment delimiter
#
#The following list gives an example sequence of items that must be #executed in the time between powering the device up and reading data #from the device. Note that there are other valid sequences depending #on which features are used.
#See the corresponding EVM user guide for jumper settings and audio #connections.
#
# Line-Out Fully-Differential 2-channel : OUT1P_M- Ch1, OUT2P_M- Ch2.
# FSYNC = 48 kHz (Output Data Sample Rate), BCLK = 12.288 MHz (BCLK/FSYNC = 256) ###################################################################
#manual mode example script
#acknowledge ADSR engine then enable it with x01 at the end of the script
w a0 00 00 # locate page x00
w a0 01 01 # device reset
w a0 02 09 # come out of sleep mode with VREF and DREG up
w a0 00 01 # locate page 0x01
w a0 2d 04 # enable SG2 only
#Using chirp start frequency formula
w a0 00 17 # locate page 0x17
w a0 7c 02 18 2a 47 # SG2 start frequency at 1 KHz
#Using chirp delta frequency formula
w a0 00 18 # locate page 0x18
w a0 08 00 00 00 44 a1 #delta frequency of 0.5 Hz not causing aliasing
#Acknowledge ADSR envelope
w a0 00 1c # locate page 0x1c
w a0 40 00 00 00 00 # ADSR note, set 0 when powering
# up dac and set it to 1 to enable chirp
#Set sustain and restart timer the same
w a0 50 00 00 00 00 # restart_timer
w a0 54 00 00 00 00 # sustain_timer
w a0 00 17 # locate page 0x17
w a0 74 00 00 00 00 # power up delay
#SG2 channel selection and amplitude level configuration
w a0 00 11 # locate page 0x11
w a0 70 40 00 40 00 # OUT1
#w a0 74 40 00 40 00 # OUT2
#Output configuration
w a0 00 00 # locate page 0
w a0 76 0c # enable OUT1
w a0 78 40 # enable all DACs
#Turn on ADSR envelope
w a0 00 1c #locate page 1c
w a0 40 00 00 00 01 # ADSR note, set 0 when powering
# up DAC and set it to 1 to enable chirp
# for manual mode