It's a bit more complicated that that. You need to have something that generates the analog values at the analog sample rate you want to use. I have another project called waveplayer for the LX25 version of Pepino that will play wave files (like song.wav) stored on an sd-card. The wave file header contains information about the wave file, like stereo or mono, sample size in bits and sample rate (like 44.1 kHz). In hardware I have a 32-bit FIFO that holds up to 1024 analog samples (2 * 16-bit). The FIFO is written by the CPU as long as the FIFO has room for more data, until the song is done. The FIFO is read by hardware at a programmable rate, i.e. there is a timer in hardware that controls the rate that the values in the FIFO are read and fed to the dacs. The timer is programmed according to the sample rate (i.e. at 44.1 kHz the time between each read is 1/44100 sec). The waveplayer project is available here: http://www.saanlima.com/download/pepino-v1.1/waveplayer.zip Magnus On 10/29/2018 2:16 PM, Tomas Kral wrote:
On Mon, 29 Oct 2018 14:07:25 -0700 Magnus Karlsson <magnus@saanlima.com> wrote:
where analog_left and analog_right are the 12-bit analog values to convert. Thank you, perhaps `analog_left/right' can be mapped at I/O port to a H/W address register.
(iowadr == 23) ? {24'b0, dataKbd} : // -36 ... (iowadr == 26) ? {8'b0, analog_left, analog_right} : 0); // -24 ????