|
楼主 |
发表于 2005-1-18 10:26:15
|
显示全部楼层
crazyeda :看了你的贴子,我久久不能平静。-_-
AM: -_-
请问:“AVR图形声音发生器范例”里有关声音吗??
标题为:
Cornell University
Electrical Engineering 476
Video Generation with AVR microcontrollers//为何翻译为AVR图形声音发生器范例??
改动:找到原文“声音”
Adding Sound
Since most TVs have a sound input, it would be nice to be able to generate some sound from the program. Two modifications of the video program are necessary to generate sound on the Mega163. (Note that sound on the Mega32 is much easier, see the next section.) First, a bit needs to be toggled in the the interrupt which handles the sync generation. Care must be taken to make all conditionals use the same number of cycles, to avoid video jitter. Second, to save a few microseconds, loading resisters for video playback on each line has to be converted to assembler. This example produces a two-octave scale, playing 4 notes/second. The accuracy of the tones is about 1%, which is good enough for sound effects, but will drive some people out of the room. This version of the video program is portable across compiler versions and is compatable with CodeVision version 1.23.7.
The following Matlab code generates the required counts, assuming that the sync interrupt will toggle a bit. The first column of the output is the frequency of the note. The second column is the note duration in units of 63.625 microseconds. The third is the relative error. Between C3 and C6, all note frequencies are within 1% error except for F5 which is flat by 2%.
The output port pin should be connected to ground by a 5 Kohm resistor. The TV should be connected across the resistor. The resistor is necessary because the TV is AC coupled and will slowly charge up and cut off the audio.
-----此内容被SUN0_LIANG于2005-01-18,10:40:03编辑过 |
|