Download A Field-Programmable Prototyping Board - Courses
Transcript
92
9. Guide to Some Laboratory Experiments
10#6#,
10#3#,
10#2#,
10#1#,
10#2#,
10#3#,
10#6#,
10#11#,
10#16#,
10#22#,
10#30#,
10#38#,
10#47#,
10#57#,
10#68#,
10#79#,
10#91#,
10#103#,
10#116#
A 16-bit binary counter cnt16 is used to scan the rom64w module at dierent
rates to produce sine waves of dierent frequencies. The scan rate is loadable from
the PC's keyboard via two I/O ports located at the R1 FPGA.
To load this lab synth, you do:
c:>
c:>
c:>
c:>
c:>
c:>
c:>
wir2xnf synth
xnfmerge synth music
ppr music
makebits music
makeprom -o music.mcs -u 0 music.bit em4003a em4002a em4003a
bd music.mcs
music
Use the PC's keyboard to change the frequency of the sound! A very primitive
driver is included for the purpose of illustration.
#include <stdio.h>
#include <math.h>
#define PORT1 0x304
#define PORT2 0x305
#define CLK
8000000
#define BUF_SIZE 64
#define CTRL_C
0x3
main( int argc, char **argv )
{
unsigned int n;
int i;
char buf[128];
while ( 1 ) {
switch ( getch() )
{