91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡介

七段數碼管時鐘顯示的verilog源代碼,已做過FPGA驗證。

資源截圖

代碼片段和文件信息

#include?
#include?“system.h“
#include?“io.h“
#include?“sys/alt_irq.h“
#include?“alt_types.h“
#include?“altera_avalon_timer_regs.h“
#include?“altera_avalon_pio_regs.h“

volatile????int???TIME_COUNTER?=?0;
volatile????int???TIME_FLAG?=?0;
volatile????int???SEC_L?=?0;
volatile????int???SEC_H?=?0;
volatile????int???MIN_L?=?0;
volatile????int???MIN_H?=?0;

//時間計數
void?timer_tick(void)
{
????if(!TIME_FLAG){
????????SEC_L++;
????????if(SEC_L?>?9){
????????????SEC_L?=?0;
????????????SEC_H++;
????????}
????????if(SEC_H?==?6){
????????????SEC_H?=?0;
????????????SEC_L?=?0;
????????????MIN_L++;
????????}
????????if(MIN_L?>?9){
????????????MIN_L?=?0;
????????????MIN_H++;
????????}
????????if(MIN_H?==?6){
????????????MIN_H?=?0;
????????????MIN_L?=?0;
????????}???
????}
????else{
????
????}
}

//將時間顯示在七段數碼管上????
void?timer_disp(void)
{
????int?time?=??MIN_H?*?16?*?16?*?16?+?MIN_L?*?16?*?16?+SEC_H?*?16?+?SEC_L;
????IOWR_32DIRECT(SEG7_0_base0time);
}

//timer中斷服務
static?void?timer_ISR(void*?base_Address?alt_u32?Interrupt_Level)
{??
????//清除中斷標志位
????IOWR_ALTERA_AVALON_TIMER_STATUS((alt_u32)base_Address?0);
????//累計定時器中斷發生次數
????TIME_COUNTER++;
????if(TIME_COUNTER?==?10){
????????TIME_FLAG?=?IORD_8DIRECT(SWITCH_PIO_0_base0);
????????TIME_COUNTER?=?0;
????????//顯示時間狀態
????????timer_tick();
????????timer_disp();
????}
}

//timer初始化
void?timer_init()
{
????//設置定時器為自由運行模式
????IOWR_ALTERA_AVALON_TIMER_CONTROL(TIMER_0_base?
????????????????ALTERA_AVALON_TIMER_CONTROL_ITO_MSK??|
????????????????ALTERA_AVALON_TIMER_CONTROL_CONT_MSK?|
????????????????ALTERA_AVALON_TIMER_CONTROL_START_MSK);
????//開始中斷注冊操作??????????
????alt_irq_register(TIMER_0_IRQ?(void?*)TIMER_0_base?timer_ISR);
}

void?alter_sec(void)
{
????SEC_L++;
????if(SEC_L?>?9){
????????SEC_L?=?0;
????????SEC_H++;
????????if(SEC_H?>?5){
????????????SEC_L?=?0;
????????????SEC_H?=?0;
????????}
????}
}
????????
void?alter_min(void)
{
????MIN_L++;
????if(MIN_L?>?9){
????????MIN_L?=?0;
????????MIN_H++;
????????if(MIN_H?>?5){
????????????MIN_L?=?0;
????????????MIN_H?=?0;
????????}
????}
}
????????
void?alter_min_h(void)
{
????MIN_H++;
????if(MIN_H?>?5){
????????MIN_H?=?0;
????}
}

//按鍵中斷服務
void?button_ISR(void*?context?alt_u32?id)
{
????IOWR_ALTERA_AVALON_PIO_EDGE_CAP(BUTTON_PIO_0_base?0);
????IOWR_ALTERA_AVALON_PIO_IRQ_MASK(BUTTON_PIO_0_base?0xff);
????if(TIME_FLAG){
????????int?button_value?=?IORD_ALTERA_AVALON_PIO_DATA(BUTTON_PIO_0_base);
????????if((button_value?&?0x01)?==?0){
????????????alter_sec();
????????}
????????if((button_value?&?0x02)?==?0){
????????????alter_min();
????????}??
????}
}

//按鍵初始化
void?button_init()
{
????IOWR_ALTERA_AVALON_PIO_IRQ_MASK(BUTTON_PIO_0_base?0xff);
????IOWR_ALTERA_AVALON_PIO_EDGE_CAP(BUTTON_PIO_0_base?0x0);
????alt_irq_register(BUTTON_PIO_0_IRQ?NULL?button_ISR);
}???

int?main(void)
{
????button_init();
????timer_init();

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件??????????0??2008-09-15?14:19??SEG7_Timer\.metadata\.lock

?????文件????????747??2008-09-15?14:22??SEG7_Timer\.metadata\.log

?????文件????????671??2008-09-15?15:23??SEG7_Timer\.metadata\.plugins\com.altera.nj.ui\dialog_settings.xml

?????文件????????172??2008-09-15?19:14??SEG7_Timer\.metadata\.plugins\org.eclipse.cdt.core\.log

?????文件??????16384??2008-09-15?15:23??SEG7_Timer\.metadata\.plugins\org.eclipse.cdt.core\SEG7_timer.1221459639031.pdom

?????文件??????16384??2008-09-15?15:23??SEG7_Timer\.metadata\.plugins\org.eclipse.cdt.core\SEG7_timer_syslib.1221459616156.pdom

?????文件????????137??2008-09-15?19:14??SEG7_Timer\.metadata\.plugins\org.eclipse.cdt.ui\dialog_settings.xml

?????文件????????239??2008-09-15?14:20??SEG7_Timer\.metadata\.plugins\org.eclipse.core.resources\.history\21\8064656aee82001d1905fcd13a9ae5e7

?????文件???????3080??2008-09-10?10:16??SEG7_Timer\.metadata\.plugins\org.eclipse.core.resources\.history\35\90285b5eef82001d1905fcd13a9ae5e7

?????文件??????????0??2008-09-15?14:24??SEG7_Timer\.metadata\.plugins\org.eclipse.core.resources\.history\36\a0efb1eaee82001d1905fcd13a9ae5e7

?????文件????????119??2008-09-15?14:20??SEG7_Timer\.metadata\.plugins\org.eclipse.core.resources\.history\91\0050b25cee82001d1905fcd13a9ae5e7

?????文件????????236??2008-09-15?14:20??SEG7_Timer\.metadata\.plugins\org.eclipse.core.resources\.history\ac\d0f1c25cee82001d1905fcd13a9ae5e7

?????文件??????????0??2008-09-15?14:22??SEG7_Timer\.metadata\.plugins\org.eclipse.core.resources\.history\b2\2062369cee82001d1905fcd13a9ae5e7

?????文件????????179??2008-09-15?14:20??SEG7_Timer\.metadata\.plugins\org.eclipse.core.resources\.history\c1\90385e6aee82001d1905fcd13a9ae5e7

?????文件??????????0??2008-09-15?14:24??SEG7_Timer\.metadata\.plugins\org.eclipse.core.resources\.history\e\8065bbeaee82001d1905fcd13a9ae5e7

?????文件????????120??2008-09-15?14:20??SEG7_Timer\.metadata\.plugins\org.eclipse.core.resources\.history\ea\b0e04f6aee82001d1905fcd13a9ae5e7

?????文件????????177??2008-09-15?14:20??SEG7_Timer\.metadata\.plugins\org.eclipse.core.resources\.history\fd\e054b95cee82001d1905fcd13a9ae5e7

?????文件?????????92??2008-09-15?14:27??SEG7_Timer\.metadata\.plugins\org.eclipse.core.resources\.projects\SEG7_timer\.indexes\33\history.index

?????文件????????133??2008-09-15?14:22??SEG7_Timer\.metadata\.plugins\org.eclipse.core.resources\.projects\SEG7_timer\.indexes\af\history.index

?????文件?????????47??2008-09-15?15:23??SEG7_Timer\.metadata\.plugins\org.eclipse.core.resources\.projects\SEG7_timer\.indexes\history.index

?????文件????????154??2008-09-15?14:20??SEG7_Timer\.metadata\.plugins\org.eclipse.core.resources\.projects\SEG7_timer\.indexes\properties.index

?????文件????????207??2008-09-15?19:14??SEG7_Timer\.metadata\.plugins\org.eclipse.core.resources\.projects\SEG7_timer\.markers

?????文件?????????48??2008-09-15?14:24??SEG7_Timer\.metadata\.plugins\org.eclipse.core.resources\.projects\SEG7_timer_syslib\.indexes\33\history.index

?????文件????????133??2008-09-15?14:20??SEG7_Timer\.metadata\.plugins\org.eclipse.core.resources\.projects\SEG7_timer_syslib\.indexes\af\history.index

?????文件????????160??2008-09-15?14:20??SEG7_Timer\.metadata\.plugins\org.eclipse.core.resources\.projects\SEG7_timer_syslib\.indexes\properties.index

?????文件??????????1??2008-09-15?19:14??SEG7_Timer\.metadata\.plugins\org.eclipse.core.resources\.root\.indexes\history.version

?????文件????????104??2008-09-15?19:14??SEG7_Timer\.metadata\.plugins\org.eclipse.core.resources\.root\.indexes\properties.index

?????文件??????????1??2008-09-15?19:14??SEG7_Timer\.metadata\.plugins\org.eclipse.core.resources\.root\.indexes\properties.version

?????文件?????264385??2008-09-15?19:14??SEG7_Timer\.metadata\.plugins\org.eclipse.core.resources\.root\2.tree

?????文件????????506??2008-09-15?19:14??SEG7_Timer\.metadata\.plugins\org.eclipse.core.resources\.safetable\org.eclipse.core.resources

............此處省略593個文件信息

評論

共有 條評論