文档库 最新最全的文档下载
当前位置:文档库 › 2013电子毕业实习音乐播放器

2013电子毕业实习音乐播放器

2013电子毕业实习音乐播放器
2013电子毕业实习音乐播放器

毕业实习报告

题目:

基于verilog实现的简易音乐播放器

学院电子与信息工程学院

专业电子信息工程

班级学号093班0910910311

姓名宋俊阳

指导教师白华

完成时间2013.1.9

成绩

2013年 3 月6日

一、实习的目的、意义

1.设计一个简单的3按键的可编程音乐播放器,要求该播放器能够完成对编程运行实现播放,暂停,停止,选曲几项基本播放器常规功能。

2.利用verilog编程语言编写合适的能实现1中要求的基本具体功能的语言程序。

3.实验的目的在于让我们的认识verilog语言的特点并能够运用其完成简单的播放器功能,让编程语言跟计算机及相关下载硬件融合完成既定任务。

4.意义是让我们在音乐播放器的相关软件设计以及最后的调试过程中体验计算机控制的神奇魔力,还有实习成功的收获跟喜悦

二、实习的内容、安排

设计制作一个简易乐曲播放器

1.播放器内预存1首乐曲编写程序;

2.设置开始/暂停键,乐曲播放过程中按该键则暂停播放,再按则继续播放;

3.设置停止键,乐曲播放过程中按该键则停止播放,再按开始键则从头开始播放;

4.播放器内预存2首乐曲;

5.设置按键选择所要播放的曲目并用数码管显示当前播放乐曲的顺序号;

6.选做:自拟其它功能。

三、实习的具体实现

1.查阅资料熟悉verilog语言并了解实验目的编写如下程序:

module song(clk,beep,pause,stop,switch,seg); //定义时钟及几个功能变量

input clk,pause,switch,stop; //输入变量

output beep; //输出变量,即蜂鸣器发声

output[7:0]seg;

reg[7:0] seg_r;

reg beep_r; //定义几个中间变量

reg a;

reg b;

reg c;

reg[7:0]state;

reg[7:0]state1;

reg[7:0]state2;

reg[15:0]count,count_end;

reg[23:0]count1;

parameter L_5=16'd61224,

L_6=16'd54545,

M_1=16'd45863,

M_2=16'd40864,

M_3=16'd36402,

M_5=16'd30612,

M_6=16'd27273,

H_1=16'd22956;

parameter TIME = 12000000; //时钟频率assign beep=beep_r;

assign seg=seg_r;

always@(posedge pause)

begin

a=!a;

end

always@(posedge stop)

begin

b=!b;

end

always@(posedge switch)

begin

c=!c;

end

always@(posedge clk)

begin

if(a==1||b==1)

beep_r=1'b0;

else

count<=count+1'b1;

if(count==count_end)

begin

count<=16'h0;

beep_r<=!beep_r;

end

end

always@(posedge clk)

begin

if(count1 < TIME )

count1=count1+1'b1;

else

begin

count1=24'd0;

if(state1==8'd147||state2==8'd147)

state=8'd0;

if(a==1&b==0)

begin

state=state;

end

if(a==0&b==0)

state=state+1'b1;

if(a==0&b==1)

begin

state=8'd0;

end

if(a==1&b==1)

state=state+1'b1;

if(c==1) //曲目1

begin

seg_r=8'hf9;

state2=state;

case(state2)

8'd0,8'd1: count_end=L_5;

8'd2,8'd3,8'd4,8'd5,8'd6,8'd7,8'd8: count_end=M_1;

8'd9,8'd10: count_end=M_3;

8'd11,8'd12,8'd13,8'd14: count_end=M_2;

8'd15: count_end=M_1;

8'd16,8'd17: count_end=M_2;

8'd18,8'd19: count_end=M_3;

8'd20,8'd21,8'd22,8'd23,8'd24: count_end=M_1;

8'd25,8'd26: count_end=M_3;

8'd27,8'd28: count_end=M_5;

8'd29,8'd30,8'd31,8'd32,8'd33: count_end=M_6;

8'd34,8'd35,8'd36,8'd37,8'd38: count_end=M_6;

8'd39,8'd40,8'd41,8'd42: count_end=M_5;

8'd43,8'd44,8'd45: count_end=M_3;

8'd46,8'd47: count_end=M_1;

8'd48,8'd49,8'd50,8'd51: count_end=M_2;

8'd53,8'd54: count_end=M_2;

8'd55,8'd56: count_end=M_3;

8'd57,8'd58,8'd59,8'd60: count_end=M_1;

8'd61,8'd62,8'd63: count_end=L_6;

8'd64,8'd65: count_end=M_5;

8'd66,8'd67,8'd68,8'd69: count_end=M_1;

8'd70,8'd71,8'd72,8'd73: count_end=M_1;

8'd74,8'd75: count_end=M_6;

8'd76,8'd77,8'd78,8'd79: count_end=M_5;

8'd80,8'd81,8'd82: count_end=M_3;

8'd83,8'd84: count_end=M_1;

8'd85,8'd86,8'd87,8'd88: count_end=M_2;

8'd89: count_end=M_1;

8'd90,8'd91: count_end=M_2;

8'd92,8'd93: count_end=M_6;

8'd94,8'd95,8'd96,8'd97: count_end=M_5;

8'd98,8'd99,8'd100: count_end=M_3;

8'd101,8'd102: count_end=M_5;

8'd103,8'd104,8'd105,8'd106: count_end=M_6;

8'd107,8'd108,8'd109,8'd110: count_end=M_6;

8'd111,8'd112: count_end=H_1;

8'd113,8'd114,8'd115,8'd116: count_end=M_5;

8'd117,8'd118,8'd119: count_end=M_3;

8'd120,8'd121: count_end=M_1;

8'd122,8'd123,8'd124,8'd125: count_end=M_2;

8'd126: count_end=M_1;

8'd127,8'd128: count_end=M_2;

8'd129,8'd130: count_end=M_3;

8'd131,8'd132,8'd133,8'd134: count_end=M_1;

8'd135,8'd136,8'd137: count_end=L_6;

8'd138,8'd139: count_end=M_5;

8'd140,8'd141,8'd142,8'd143: count_end=M_1;

8'd144,8'd145,8'd146,8'd147: count_end=M_1; default:count_end=16'hffff;

endcase

end

if(c==0) //曲目2

begin

seg_r=8'hc0;

state=state;

case(state1)

8'd0,8'd1: count_end=L_5;

8'd2,8'd3,8'd4,8'd5,8'd6,8'd7,8'd8: count_end=M_2;

8'd11,8'd12,8'd13,8'd14: count_end=M_3;

8'd15: count_end=M_2; 8'd16,8'd17: count_end=M_2; 8'd18,8'd19: count_end=M_2; 8'd20,8'd21,8'd22,8'd23,8'd24: count_end=M_1;

8'd25,8'd26: count_end=M_5; 8'd27,8'd28: count_end=M_5; 8'd29,8'd30,8'd31,8'd32,8'd33: count_end=M_6;

8'd34,8'd35,8'd36,8'd37,8'd38: count_end=M_6;

8'd39,8'd40,8'd41,8'd42: count_end=M_5;

8'd43,8'd44,8'd45: count_end=M_2;

8'd46,8'd47: count_end=M_1; 8'd48,8'd49,8'd50,8'd51: count_end=M_3;

8'd52: count_end=M_2; 8'd53,8'd54: count_end=M_1; 8'd55,8'd56: count_end=M_2; 8'd57,8'd58,8'd59,8'd60: count_end=M_2;

8'd61,8'd62,8'd63: count_end=L_5;

8'd64,8'd65: count_end=M_6; 8'd66,8'd67,8'd68,8'd69: count_end=M_5;

8'd70,8'd71,8'd72,8'd73: count_end=M_5;

8'd74,8'd75: count_end=M_6; 8'd76,8'd77,8'd78,8'd79: count_end=M_3;

8'd80,8'd81,8'd82: count_end=M_2;

8'd83,8'd84: count_end=M_3; 8'd85,8'd86,8'd87,8'd88: count_end=M_1;

8'd89: count_end=M_2; 8'd90,8'd91: count_end=M_3; 8'd92,8'd93: count_end=M_2; 8'd94,8'd95,8'd96,8'd97: count_end=M_3;

8'd98,8'd99,8'd100: count_end=M_3;

8'd101,8'd102: count_end=M_5; 8'd103,8'd104,8'd105,8'd106: count_end=M_6;

8'd107,8'd108,8'd109,8'd110: count_end=M_6;

8'd111,8'd112: count_end=H_1; 8'd113,8'd114,8'd115,8'd116: count_end=M_5;

8'd117,8'd118,8'd119: count_end=M_3;

8'd120,8'd121: count_end=M_1; 8'd122,8'd123,8'd124,8'd125: count_end=M_2;

8'd126: count_end=M_1; 8'd127,8'd128: count_end=M_3; 8'd129,8'd130: count_end=M_1; 8'd131,8'd132,8'd133,8'd134: count_end=M_2;

8'd135,8'd136,8'd137: count_end=L_6;

8'd138,8'd139: count_end=M_3;

8'd140,8'd141,8'd142,8'd143: count_end=M_2;

8'd144,8'd145,8'd146,8'd147: count_end=M_2;

default:count_end=16'hffff;

endcase

end

end

end

Endmodule

2将程序下载到既定的实验板上运行

3进行实验的调试让实验板上按键与所要实现的功能匹配

4撰写实习报告

四、心得体会、存在的问题和进一步改进意见等

本次实验实习总共经历一个星期左右,虽然时间不长但是对于我而言收获还是蛮多的,每天都在自己的实习进度上向前思考,思考下一步该怎么实现,思考刚刚遇到的问题该怎么解决,每晚睡觉前都期待着明天能有所进展,感觉这1周很压抑但很充实,即使完成的实习难度不大但是紧迫的时间加上所要运用的编程语言对于刚刚考完研的我来说一切都是陌生的;但是现在回想,自己每次克服一个技术性难关时,又是多么心潮澎湃,尤其第一次听到自己的实验台上板子里蜂鸣器出声时的感受,我想我跟我的搭档现在仍然记忆难忘。虽然知道最后实验仅仅完成了最最基本的播放器功能,而且暂停的功能还不是很完善,还有其他的一些很期待的功能未能来得及完成,但是结束了自己此次实习,心里依旧充满了成就感,毕竟这是自己亲手完成的啊。通过这次实验,一方面让我初步认识了verilog语言的编写特点并对其完成简易程序有所掌握,另一方面握巩固了我的编程下载方面的知识同时大大增强了我的信心,让我对自己的实验能力充满自信。同时我也总结了许多我还应该改进的地方,多跟同学讨论,多向指导老师请教可以大大扩宽自己的思路,能对解决问题起到重要作用。面对困难,要知难而进,逃避是不能够解决问题的,另外还要拿得起放得下,纵使时间再紧迫也要调整好学习和生活的关系,学会淡定从容面对挑战,在动手实践的过程中一定要专心致志心无旁骛,毕业实习过去了,考研的没有理想的那么顺利但是这次实习学得的这些东西对于我未来的生活工作道路来说依旧会是笔宝贵的财富。

五、附录

参考文献

<> 华中科技出版社

FPGA课本

<> 夏宇闻译电子工业出版社

相关文档