Intel® FPGA University Program
University Program Material, Education Boards, and Laboratory Exercises
1147 Discussions

Assembly or C program that produce an output tone on speaker NIOS II.

Honored Contributor II

All i want to do is produce and output tone to the speaker.  


My university has a sample code 



However for some reason the code is broken and outputs a scrambled noise from the speaker. I attempted to modify this code to output a single however it obviously doesn't work, same scrambled noise.Can someone explain why this code is broken so I can fix tone output code, or explain how to output a tone to the speaker?
0 Kudos
1 Reply
Honored Contributor II

I want to produce a tone output on the speakers 


Assembly Example: Echo program - connects mic to speakers, polling .equ ADDR_AUDIODACFIFO, 0x10003040 main: movia r2,ADDR_AUDIODACFIFO ldwio r3,4(r2) /* Read fifospace register */ andi r3,r3,0xff /* Extract# of samples in Input Right Channel FIFO */ beq r3,r0,main /* If no samples in FIFO, go back to start */ ldwio r3,8(r2) stwio r3,8(r2) /* Echo to left channel */ ldwio r3,12(r2) stwio r3,12(r2) /* Echo to right channel */ br main  


This code was provided by my university website(, however its broken and the output is scrambled noise nothing is right. How can I output to the speaker a single tone?
0 Kudos