采用VHDL語言設(shè)計(jì)一個(gè)4通道的數(shù)據(jù)采集控制模塊。系統(tǒng)的功能描述如下: 1.系統(tǒng)主時(shí)鐘為100 MHz。 2.數(shù)據(jù)為16位-數(shù)據(jù)線上連續(xù)2次00FF后數(shù)據(jù)傳輸開始。 3.系統(tǒng)內(nèi)部總線寬度為8位。 4.共有4個(gè)通道(ch1、CH2、ch3、ch4),每個(gè)通道配備100 Bytes的RAM,當(dāng)存滿數(shù)據(jù)后停止數(shù)據(jù)采集并且相應(yīng)通道的狀態(tài)位產(chǎn)生報(bào)警信號。 5.數(shù)據(jù)分為8位串行輸出,輸出時(shí)鐘由外部數(shù)據(jù)讀取電路給出。 6.具備顯示模塊驅(qū)動(dòng)功能。由SEL信號設(shè)置顯示的通道,DISPLAY信號啟動(dòng)所選通道RAM中數(shù)值的顯示過程。數(shù)值順次顯示一遍后顯示結(jié)束,可以重新設(shè)定SEL的值選擇下一個(gè)通道。模塊數(shù)據(jù)線為8位,顯示器件為4個(gè)8段LED。 7.數(shù)據(jù)采集模式如下:單通道采集(由SEL信號選擇通道),多通道順次采集(當(dāng)前通道采滿后轉(zhuǎn)入下一通道),多通道并行采集(每通道依次采集一個(gè)數(shù)據(jù))。模式由控制信號MODE選擇,采集數(shù)據(jù)的總個(gè)數(shù)由NUM_COLLECT給出。 8.數(shù)據(jù)采集過程中不能讀取,數(shù)據(jù)讀取過程中不能采集
上傳時(shí)間: 2013-12-25
上傳用戶:zycidjl
《計(jì)算機(jī)網(wǎng)絡(luò)》謝希仁版 物理層 課件
標(biāo)簽: 計(jì)算機(jī)網(wǎng)絡(luò) 課件
上傳時(shí)間: 2015-04-03
上傳用戶:tt1995
#include<stdio.h> #define TREEMAX 100 typedef struct BT { char data; BT *lchild; BT *rchild; }BT; BT *CreateTree(); void Preorder(BT *T); void Postorder(BT *T); void Inorder(BT *T); void Leafnum(BT *T); void Nodenum(BT *T); int TreeDepth(BT *T); int count=0; void main() { BT *T=NULL; char ch1,CH2,a; ch1='y'; while(ch1=='y'||ch1=='y') { printf("\n"); printf("\n\t\t 二叉樹子系統(tǒng)"); printf("\n\t\t*****************************************"); printf("\n\t\t 1---------建二叉樹 "); printf("\n\t\t 2---------先序遍歷 "); printf("\n\t\t 3---------中序遍歷 "); printf("\n\t\t 4---------后序遍歷 "); printf("\n\t\t 5---------求葉子數(shù) "); printf("\n\t\t 6---------求結(jié)點(diǎn)數(shù) "); printf("\n\t\t 7---------求樹深度 "); printf("\n\t\t 0---------返 回 "); printf("\n\t\t*****************************************"); printf("\n\t\t 請選擇菜單號 (0--7)"); scanf("%c",&CH2); getchar(); printf("\n"); switch(CH2) { case'1': printf("\n\t\t請按先序序列輸入二叉樹的結(jié)點(diǎn):\n"); printf("\n\t\t說明:輸入結(jié)點(diǎn)(‘0’代表后繼結(jié)點(diǎn)為空)后按回車。\n"); printf("\n\t\t請輸入根結(jié)點(diǎn):"); T=CreateTree(); printf("\n\t\t二叉樹成功建立!\n");break; case'2': printf("\n\t\t該二叉樹的先序遍歷序列為:"); Preorder(T);break; case'3': printf("\n\t\t該二叉樹的中序遍歷序列為:"); Inorder(T);break; case'4': printf("\n\t\t該二叉樹的后序遍歷序列為:"); Postorder(T);break; case'5': count=0;Leafnum(T); printf("\n\t\t該二叉樹有%d個(gè)葉子。\n",count);break; case'6': count=0;Nodenum(T); printf("\n\t\t該二叉樹總共有%d個(gè)結(jié)點(diǎn)。\n",count);break; case'7': printf("\n\t\t該樹的深度為:%d",TreeDepth(T)); break; case'0': ch1='n';break; default: printf("\n\t\t***請注意:輸入有誤!***"); } if(CH2!='0') { printf("\n\n\t\t按【Enter】鍵繼續(xù),按任意鍵返回主菜單!\n"); a=getchar(); if(a!='\xA') { getchar(); ch1='n'; } } } } BT *CreateTree() { BT *t; char x; scanf("%c",&x); getchar(); if(x=='0') t=NULL; else { t=new BT; t->data=x; printf("\n\t\t請輸入%c結(jié)點(diǎn)的左子結(jié)點(diǎn):",t->data); t->lchild=CreateTree(); printf("\n\t\t請輸入%c結(jié)點(diǎn)的右子結(jié)點(diǎn):",t->data); t->rchild=CreateTree(); } return t; } void Preorder(BT *T) { if(T) { printf("%3c",T->data); Preorder(T->lchild); Preorder(T->rchild); } } void Inorder(BT *T) { if(T) { Inorder(T->lchild); printf("%3c",T->data); Inorder(T->rchild); } } void Postorder(BT *T) { if(T) { Postorder(T->lchild); Postorder(T->rchild); printf("%3c",T->data); } } void Leafnum(BT *T) { if(T) { if(T->lchild==NULL&&T->rchild==NULL) count++; Leafnum(T->lchild); Leafnum(T->rchild); } } void Nodenum(BT *T) { if(T) { count++; Nodenum(T->lchild); Nodenum(T->rchild); } } int TreeDepth(BT *T) { int ldep,rdep; if(T==NULL) return 0; else { ldep=TreeDepth(T->lchild); rdep=TreeDepth(T->rchild); if(ldep>rdep) return ldep+1; else return rdep+1; } }
上傳時(shí)間: 2020-06-11
上傳用戶:ccccy
本程序是使用STM32F103C8T6作為mcu。采用PB7(TIM4 CH2)輸出PWM 頻率約為110HZ占空比由預(yù)定義變量進(jìn)行修改。可以使用4個(gè)模式。該程序是用于汽車電子風(fēng)扇實(shí)驗(yàn),使用其控制調(diào)速模塊,可以4個(gè)檔位控制。稍加改動(dòng)程序可以實(shí)現(xiàn)更多的控制方式。 該程序要求硬件:使用外部8M晶振。高電平有效。芯片使用STM32F103C8T6。開發(fā)平臺KEIL(MDK)5.21及以上。當(dāng)然也可以將源代碼復(fù)制后自建工程。
上傳時(shí)間: 2022-07-18
上傳用戶:
蟲蟲下載站版權(quán)所有 京ICP備2021023401號-1