QUARTUSII软件开放性实验报告

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

开放性实验报告专业:电子信息工程班级:*电信*班姓名:学号:指导老师:实验一:流水灯一.实验内容利用QUARTUSII软件,构建NIOSII软核系统,编写程序,实现实验箱上LED灯的流水功能。二.实验原理通过提前设定NIOSII软核处理器的相关寄存器,控制led的IO口的高低电平输出及响应间隔时间,从而改变LED的亮灭并达到流水灯效果。三.实验步骤1.硬件设计(1).构建NIOSII软核NIOSII软核处理器包括cpu,sdram控制器,串行flash控制器,jtag_uart,sysid,pio端口。(2).PLL模块的构建实验箱的板载有源晶振频率为50MHZ,NIOSII及SDRAM需要100MHZ的时钟源,因此需要用PLL模块进行倍频。PLL模块的配置如图所示:输入时钟频率为50MHZ输出时钟c0为输入时钟的2倍频输出时钟c1为输入时钟的2倍频,相位偏移-75度,为SDRAM提供工作时钟PLL模块:(3).系统连线及引脚分配qsf文件中的引脚分配:set_location_assignmentPIN_AF21-tosdram_addr[0]set_location_assignmentPIN_AE20-tosdram_addr[1]set_location_assignmentPIN_AF20-tosdram_addr[2]set_location_assignmentPIN_AE19-tosdram_addr[3]set_location_assignmentPIN_B20-tosdram_addr[4]set_location_assignmentPIN_A21-tosdram_addr[5]set_location_assignmentPIN_B21-tosdram_addr[6]set_location_assignmentPIN_A22-tosdram_addr[7]set_location_assignmentPIN_B22-tosdram_addr[8]set_location_assignmentPIN_A23-tosdram_addr[9]set_location_assignmentPIN_AE21-tosdram_addr[10]set_location_assignmentPIN_B23-tosdram_addr[11]set_location_assignmentPIN_B24-tosdram_addr[12]set_location_assignmentPIN_AE22-tosdram_ba[0]set_location_assignmentPIN_AF22-tosdram_ba[1]set_location_assignmentPIN_AE24-tosdram_cas_nset_location_assignmentPIN_B25-tosdram_ckeset_location_assignmentPIN_AF23-tosdram_cs_nset_location_assignmentPIN_AD25-tosdram_dq[0]set_location_assignmentPIN_AC25-tosdram_dq[1]set_location_assignmentPIN_AC26-tosdram_dq[2]set_location_assignmentPIN_AB25-tosdram_dq[3]set_location_assignmentPIN_AB26-tosdram_dq[4]set_location_assignmentPIN_AA25-tosdram_dq[5]set_location_assignmentPIN_AA26-tosdram_dq[6]set_location_assignmentPIN_Y25-tosdram_dq[7]set_location_assignmentPIN_W26-tosdram_dq[8]set_location_assignmentPIN_V25-tosdram_dq[9]set_location_assignmentPIN_V26-tosdram_dq[10]set_location_assignmentPIN_U25-tosdram_dq[11]set_location_assignmentPIN_U26-tosdram_dq[12]set_location_assignmentPIN_T25-tosdram_dq[13]set_location_assignmentPIN_R25-tosdram_dq[14]set_location_assignmentPIN_P24-tosdram_dq[15]set_location_assignmentPIN_N24-tosdram_dq[16]set_location_assignmentPIN_M25-tosdram_dq[17]set_location_assignmentPIN_L25-tosdram_dq[18]set_location_assignmentPIN_K26-tosdram_dq[19]set_location_assignmentPIN_K25-tosdram_dq[20]set_location_assignmentPIN_J26-tosdram_dq[21]set_location_assignmentPIN_J25-tosdram_dq[22]set_location_assignmentPIN_H26-tosdram_dq[23]set_location_assignmentPIN_G25-tosdram_dq[24]set_location_assignmentPIN_F26-tosdram_dq[25]set_location_assignmentPIN_F25-tosdram_dq[26]set_location_assignmentPIN_E26-tosdram_dq[27]set_location_assignmentPIN_E25-tosdram_dq[28]set_location_assignmentPIN_D26-tosdram_dq[29]set_location_assignmentPIN_D25-tosdram_dq[30]set_location_assignmentPIN_C25-tosdram_dq[31]set_location_assignmentPIN_Y26-tosdram_dqm[0]set_location_assignmentPIN_W25-tosdram_dqm[1]set_location_assignmentPIN_H25-tosdram_dqm[2]set_location_assignmentPIN_G26-tosdram_dqm[3]set_location_assignmentPIN_AE23-tosdram_ras_nset_location_assignmentPIN_AE25-tosdram_we_nset_location_assignmentPIN_F21-toclk_sdram2.软件设计system.h文件中关于PIO_LED的宏定义#definePIO_LED_NAME/dev/pio_LED#definePIO_LED_TYPEaltera_avalon_pio#definePIO_LED_BASE0x00001800#definePIO_LED_SPAN16#definePIO_LED_DO_TEST_BENCH_WIRING0#definePIO_LED_DRIVEN_SIM_VALUE0#definePIO_LED_HAS_TRI0#definePIO_LED_HAS_OUT1#definePIO_LED_HAS_IN0#definePIO_LED_CAPTURE0#definePIO_LED_DATA_WIDTH8#definePIO_LED_RESET_VALUE0#definePIO_LED_EDGE_TYPENONE#definePIO_LED_IRQ_TYPENONE#definePIO_LED_BIT_CLEARING_EDGE_REGISTER0#definePIO_LED_BIT_MODIFYING_OUTPUT_REGISTER0#definePIO_LED_FREQ100000000#defineALT_MODULE_CLASS_pio_LEDaltera_avalon_pio利用system.h文件编写sopc.h,通过操作结构体PIO_STR完成对PIO_寄存器的操作。sopc.h文件:#ifndefSOPC_H_#defineSOPC_H_#includesystem.h#define_LEDtypedefstruct{unsignedlongintDATA;unsignedlongintDIRECTION;unsignedlongintINTERRUPT_MASK;unsignedlongintEDGE_CAPTURE;}PIO_STR;#ifdef_LED#defineLED((PIO_STR*)PIO_LED_BASE)#endif#endifMain.c文件全部源码:#includestdio.h#includeunistd.h#include../inc/sopc.hintmain(){inti;while(1){for(i=0;i8;i++){LED-DATA=~(1i);usleep(500000);}}return0;}实验二:数码管显示一.实验内容利用QUARTUSII软件,构建NIOSII软核处理器系统,在NIOSIDE软件中编写程序,实现实验箱上数码管的动态显示。二.实验原理在NIOSII软核处理器中添加段选,位选IO,通过控制PIO寄存器,逐次点亮数码管,利用人眼的视觉暂留效应,实现数码管的动态显示。三.实验步骤1.硬件设计(1).构建NIOSII软核NIOSII软核包括cpu,sdram控制器,串行flash,jtag_uart,sysid,段选IO,位选IO。(2).构建PLL模块PLL输入时钟频率为20MHZPLL输出时钟c0为输入的5倍频PLL输出时钟c1为输入时钟的5倍频,相位偏移为-75度PLL模块:(3).系统连线及引脚分配利用qsf文件进行引脚分配:set_location_assignmentPIN_27-toRESETset_location_assignmentPIN_24-toCLOCKset_location_assignmentPIN_88-toS_DB[0]set_location_assignmentPIN_87-toS_DB[1]set_location_assignmentPIN_86-toS_DB[2]set_location_assignmentPIN_84-toS_DB[3]set_location_assignmentPIN_82-toS_DB[4]set_location_assignmentPIN_81-toS_DB[5]set_location_assignmentPIN_80-toS_DB[6]set_location_assignmentPIN_77-toS_DB[7]set_location_assignmentPIN_45-toS_DB[8]set_location_assignmentPIN_46-toS_DB[9]set_location_assignmentPIN_47-toS_DB[10]set_location_assignmentPIN_48-toS_DB[11]set_location_assignmentPIN_56-toS_DB[12]set_location_assignmentPIN_57-toS_DB[13]set_locat

1 / 20
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功