Altera_Forum
Honored Contributor
12 years agoProducing tone with Audio Codec on NIOS II?
Hey everyone,
I'm just learning how to use the Audio CODEC on NIOS II with the DE2 board. I wrote the following assembly code to generate a square wave and use it to produce an output tone: .equ ADDR_AUDIODACFIFO, 0x10003040 .global main main: movia r2, ADDR_AUDIODACFIFO # Set up the square wave's positive pulse preloop1: movi r3, 10000 movi r4, 22 # Send 22 outputs to the FIFO loop1: stwio r3, 8(r2) stwio r3, 12(r2) subi r4, r4, 1 beq r4, r0, preloop2 br loop1 # Set up the square wave's negative pulse preloop2: movi r3, -10000 movi r4, 22 # Send 22 outputs to the FIFO loop2: stwio r3, 8(r2) stwio r3, 12(r2) subi r4, r4, 1 beq r4, r0, preloop1 br loop2 It doesn't seem to be working - nothing is being written to the audio codec's FIFOs. Does anyone know what I need to do to produce a tone? Thanks.