当前位置: 首页 > news >正文

一个专门做破解的网站长沙正规seo优化公司

一个专门做破解的网站,长沙正规seo优化公司,网站建设投标标书,环保网站主题通用异步收发传输器( Universal Asynchronous Receiver/Transmitter, UART)是一种异步收发传输器,其在数据发送时将并行数据转换成串行数据来传输, 在数据接收时将接收到的串行数据转换成并行数据, 可以实现…

        通用异步收发传输器( Universal Asynchronous Receiver/Transmitter, UART)是一种异步收发传输器,其在数据发送时将并行数据转换成串行数据来传输, 在数据接收时将接收到的串行数据转换成并行数据, 可以实现全双工传输和接收。它包括了 RS232、 RS449、 RS423、RS422 和 RS485 等接口标准规范和总线标准规范。 换句话说, UART 是异步串行通信的总称。而 RS232、 RS449、 RS423、 RS422 和 RS485 等,是对应各种异步串行通信口的接口标准和总线标准,它们规定了通信口的电气特性、传输速率、连接特性和接口的机械特性等内容。

1. 09AB 基于FPGA的串口(UART)发送实验

  1. 串口通信模块设计的目的是用来发送数据的,因此需要有一个数据输入端口。
  2. 串口通信,支持不同的波特率,所以需要有一个波特率设置端口。
  3. 串口通信的本质就是将8位的并行数据,在不同的时刻传输并行数据的不同位,通过一根信号线将八位并行数据全部传出。
  4. 串口通信以1位的低电平标志串行传输的开始,待8位数据传输完成之后,再以1位的高电平标志传输的结束。
  5. 控制信号,控制并转串模块什么时候开始工作,什么时候一个数据发送完成?所以需要一个发送开始信号,以及一个发送完成信号

设计代码

  1. bps_cnt在空闲状态下保持为0,而bps_cnt为0会使得uart_tx为0,为了解决该问题,我们避开空闲状态下的bps_cnt=0,使bps_cnt从1开始判定。
  2. 但是这又会导致bps_cnt从0到1存在空闲,发送起始位时会延后一段数据位,于是我们将基础计数时间改为1时counter1开始加一。
  3. 为了出现bps_clk脉冲信号,当(div_cnt == (bps_dr - 1)成立时会输出1,我们利用该特性作为我们的脉冲信号。
  4. 我们要输入八位数据以及起始位和终止位共十位数据,为了保证十位数据完整输出,我们需要设置到第十一位停止,发送tx_done信号。
  5. 输入信号不能是reg类型,否则综合设计代码时报错:Non-net port key_in cannot be of mode input,写代码时遇到的问题。
module uart_byte_tx(clk,rstn,blaud_set,data,send_en,uart_tx,tx_done
);input clk;input rstn;input [2:0]blaud_set;input [7:0]data;input send_en;output reg uart_tx;output tx_done;//Blaud_set = 0时,波特率 = 9600;//Blaud_set = 1时,波特率 = 19200;//Blaud_set = 2时,波特率 = 38400;//Blaud_set = 3时,波特率 = 57600;//Blaud_set = 4时,波特率 = 115200;reg[17:0] bps_dr;always@(*)case(blaud_set)0: bps_dr = 1000000000/9600/20;1: bps_dr = 1000000000/19200/20;2: bps_dr = 1000000000/38400/20;3: bps_dr = 1000000000/57600/20;4: bps_dr = 1000000000/115200/20;endcasewire bps_clk;assign bps_clk = (div_cnt == (bps_dr - 1)); //3.为了出现bps_clk脉冲信号reg[17:0] div_cnt;always@(posedge clk or negedge rstn)if(!rstn)div_cnt <= 0;else if(send_en)beginif(bps_clk)div_cnt <= 0;elsediv_cnt <= div_cnt + 1'd1;endelsediv_cnt <= 0;    reg[3:0] bps_cnt;    always@(posedge clk or negedge rstn)if(!rstn)bps_cnt <= 0;else if(send_en)beginif(bps_cnt == 11)bps_cnt <= 0;else if(div_cnt == 1) //注意2bps_cnt <= bps_cnt + 4'd1;endelsebps_cnt <= 0;reg tx_done;always@(posedge clk or negedge rstn)if(!rstn)uart_tx <= 1'd1;else case(bps_cnt)1: begin uart_tx <= 1'd0; tx_done <= 0; end //注意12: uart_tx <= data[0];3: uart_tx <= data[1];4: uart_tx <= data[2];5: uart_tx <= data[3];6: uart_tx <= data[4];7: uart_tx <= data[5];8: uart_tx <= data[6];9: uart_tx <= data[7];10: uart_tx <= 1'd1;11: begin uart_tx <= 1'd1; tx_done <= 1; end //注意4default: uart_tx <= 1'd1;endcaseendmodule

仿真代码:

`timescale 1ns/1nsmodule uart_byte_tx_tb();reg clk;reg rstn;reg [2:0] blaud_set;reg [7:0] data;reg send_en;wire uart_tx;wire tx_done;    uart_byte_tx uart_byte_tx_inst(.clk(clk),.rstn(rstn),.blaud_set(blaud_set),.data(data),.send_en(send_en),.uart_tx(uart_tx),.tx_done(tx_done));initial clk = 1;always #10 clk = ~clk;initial beginrstn = 0;data = 0;send_en = 0;blaud_set = 4;#201;rstn = 1;#100data = 8'h57;send_en = 1;#20;@(posedge tx_done);send_en = 0;#20000;data = 8'h75;send_en = 1;#20;@(posedge tx_done);#20000;send_en = 0;$stop;endendmodule

仿真波形

2. 10 串口发送应用之发送数据

使用上一节课设计的串口发送模块,设计一个数据发送器,每10ms以115200的波特率发送一个数据,每次发送的数据比前一个数据大一(计数器)。

在实际应用的时候,我们不能通过counter去控制data,只能通过控制信号去控制。要求就是通过tx_done和send_en这两个控制信号,控制我要发送的数据内容。

思路:通过顶层模块调用uart_byte_tx发送模块来发送数据,将顶层模块命名为uart_tx_test。

 设计代码(第一版,不完善)

2.1 直接使用上一节的uart_byte_tx模块:

module uart_tx_test(clk,rstn,uart_tx
);input clk;input rstn;output uart_tx;reg [7:0] data;reg send_en;uart_byte_tx uart_byte_tx_inst(.clk(clk),.rstn(rstn),.blaud_set(3'd4),.data(data),.send_en(send_en),.uart_tx(uart_tx),.tx_done(tx_done));//10ms周期计数器reg [18:0] counter;always@(posedge clk or negedge rstn)if(!rstn)counter <= 0;else if(counter == 499999)counter <= 0;elsecounter <= counter + 1'd1;always@(posedge clk or negedge rstn)if(!rstn)send_en <= 0;else if(counter == 0)send_en <= 1;else if(tx_done)send_en <= 0;always@(posedge clk or negedge rstn)if(!rstn)data <= 8'b0000_0000;else if(tx_done)data <= data + 1'd1;endmodule
module uart_byte_tx(clk,rstn,blaud_set,data,send_en,uart_tx,tx_done
);input clk;input rstn;input [2:0]blaud_set;input [7:0]data;input send_en;output reg uart_tx;output tx_done;//Blaud_set = 0时,波特率 = 9600;//Blaud_set = 1时,波特率 = 19200;//Blaud_set = 2时,波特率 = 38400;//Blaud_set = 3时,波特率 = 57600;//Blaud_set = 4时,波特率 = 115200;reg[17:0] bps_dr;always@(*)case(blaud_set)0: bps_dr = 1000000000/9600/20;1: bps_dr = 1000000000/19200/20;2: bps_dr = 1000000000/38400/20;3: bps_dr = 1000000000/57600/20;4: bps_dr = 1000000000/115200/20;endcasewire bps_clk;assign bps_clk = (div_cnt == (bps_dr - 1)); reg[17:0] div_cnt;always@(posedge clk or negedge rstn)if(!rstn)div_cnt <= 0;else if(send_en)beginif(bps_clk)div_cnt <= 0;elsediv_cnt <= div_cnt + 1'd1;endelsediv_cnt <= 0;    reg[3:0] bps_cnt;    always@(posedge clk or negedge rstn)if(!rstn)bps_cnt <= 0;else if(send_en)beginif(bps_cnt == 11)bps_cnt <= 0;else if(div_cnt == 1) bps_cnt <= bps_cnt + 4'd1;endelsebps_cnt <= 0;reg tx_done;always@(posedge clk or negedge rstn)if(!rstn)uart_tx <= 1'd1;else case(bps_cnt) //不完善1: begin uart_tx <= 1'd0; tx_done <= 0; end 2: uart_tx <= data[0];3: uart_tx <= data[1];4: uart_tx <= data[2];5: uart_tx <= data[3];6: uart_tx <= data[4];7: uart_tx <= data[5];8: uart_tx <= data[6];9: uart_tx <= data[7];10: uart_tx <= 1'd1;11: begin uart_tx <= 1'd1; tx_done <= 1; enddefault: uart_tx <= 1'd1;endcaseendmodule

仿真代码

`timescale 1ns / 1psmodule uart_tx_test_tb();reg clk;reg rstn;wire uart_tx;uart_tx_test uart_tx_test_inst(.clk(clk),.rstn(rstn),.uart_tx(uart_tx));initial clk = 1;always #10 clk = ~clk;initial beginrstn = 0;#201;rstn = 1;#200000000$stop;endendmodule

仿真波形

data确实在一直加一,但是data并未发出(uart_tx一直保持为1)

2.2 修改tx_done逻辑后(能运行)

设计代码

module uart_tx_test(clk,rstn,uart_tx
);input clk;input rstn;output uart_tx;reg [7:0] data;reg send_en;uart_byte_tx uart_byte_tx_inst(.clk(clk),.rstn(rstn),.blaud_set(3'd4),.data(data),.send_en(send_en),.uart_tx(uart_tx),.tx_done(tx_done));//10ms周期计数器reg [18:0] counter;always@(posedge clk or negedge rstn)if(!rstn)counter <= 0;else if(counter == 499999)counter <= 0;elsecounter <= counter + 1'd1;always@(posedge clk or negedge rstn)if(!rstn)send_en <= 0;else if(counter == 0)send_en <= 1;else if(tx_done)send_en <= 0;always@(posedge clk or negedge rstn)if(!rstn)data <= 8'b0000_0000;else if(tx_done)data <= data + 1'd1;endmodule
module uart_byte_tx(clk,rstn,blaud_set,data,send_en,uart_tx,tx_done
);input clk;input rstn;input [2:0]blaud_set;input [7:0]data;input send_en;output reg uart_tx;output tx_done;//Blaud_set = 0时,波特率 = 9600;//Blaud_set = 1时,波特率 = 19200;//Blaud_set = 2时,波特率 = 38400;//Blaud_set = 3时,波特率 = 57600;//Blaud_set = 4时,波特率 = 115200;reg[17:0] bps_dr;always@(*)case(blaud_set)0: bps_dr = 1000000000/9600/20;1: bps_dr = 1000000000/19200/20;2: bps_dr = 1000000000/38400/20;3: bps_dr = 1000000000/57600/20;4: bps_dr = 1000000000/115200/20;endcasewire bps_clk;assign bps_clk = (div_cnt == 1);reg[17:0] div_cnt;always@(posedge clk or negedge rstn)if(!rstn)div_cnt <= 0;else if(send_en)beginif(div_cnt == (bps_dr - 1))div_cnt <= 0;elsediv_cnt <= div_cnt + 1'd1;endelsediv_cnt <= 0;    reg[3:0] bps_cnt;    always@(posedge clk or negedge rstn)if(!rstn)bps_cnt <= 0;else if(send_en)beginif(bps_cnt == 11)bps_cnt <= 0;else if(div_cnt == 1)bps_cnt <= bps_cnt + 4'd1;endelsebps_cnt <= 0;reg tx_done;always@(posedge clk or negedge rstn)if(!rstn)uart_tx <= 1'd1;else case(bps_cnt)0: tx_done <= 0;1: uart_tx <= 1'd0;2: uart_tx <= data[0];3: uart_tx <= data[1];4: uart_tx <= data[2];5: uart_tx <= data[3];6: uart_tx <= data[4];7: uart_tx <= data[5];8: uart_tx <= data[6];9: uart_tx <= data[7];10: uart_tx <= 1'd1;11: begin uart_tx <= 1'd1; tx_done <= 1; enddefault: uart_tx <= 1'd1;endcaseendmodule

仿真波形

 

2.3 完善串口模块,使其能接入数据采集模块

  • 数据采集模块data_gen,每采集到一个数据data result[7:0],会产生一个data_done的脉冲信号,uart串口在就接收到data_done的脉冲信号后会将data result[7:0]发送出去。
  • 思路:我们可以利用脉冲信号data_done来使能我们的send_en信号,然后将接收到的data result[7:0]通过串口发送
  • 为了模拟这个过程,我们让顶层uart_tx_test每隔10ms产生一个data[7:0]和一个send_go的单脉冲信号发送给uart_byte_tx模块。让uart_byte_tx模块根据send_go脉冲信号去发数据即可。
  • 为了防止数据发送途中data发生变化,我们在接收到send_go信号后,先将data存储起来,即声明一个r_data[7:0],使将data[7:0]的值赋值给r_data[7:0]。

 

 设计代码

module uart_tx_test1(clk,rstn,uart_tx
);input clk;input rstn;output uart_tx;reg [7:0] data;reg send_go;uart_byte_tx uart_byte_tx_inst(.clk(clk),.rstn(rstn),.blaud_set(3'd4),.data(data),.send_go(send_go),.uart_tx(uart_tx),.tx_done(tx_done));//10ms周期计数器reg [18:0] counter;always@(posedge clk or negedge rstn)if(!rstn)counter <= 0;else if(counter == 499999)counter <= 0;elsecounter <= counter + 1'd1;always@(posedge clk or negedge rstn)if(!rstn)send_go <= 0;else if(counter == 0)send_go <= 1;elsesend_go <= 0;always@(posedge clk or negedge rstn)if(!rstn)data <= 8'b0000_0000;else if(tx_done)data <= data + 1'd1;endmodule
module uart_byte_tx(clk,rstn,blaud_set,data,send_go,uart_tx,tx_done
);input clk;input rstn;input [2:0]blaud_set;input [7:0]data;input send_go;output reg uart_tx;output tx_done;//Blaud_set = 0时,波特率 = 9600;//Blaud_set = 1时,波特率 = 19200;//Blaud_set = 2时,波特率 = 38400;//Blaud_set = 3时,波特率 = 57600;//Blaud_set = 4时,波特率 = 115200;reg[17:0] bps_dr;always@(*)case(blaud_set)0: bps_dr = 1000000000/9600/20;1: bps_dr = 1000000000/19200/20;2: bps_dr = 1000000000/38400/20;3: bps_dr = 1000000000/57600/20;4: bps_dr = 1000000000/115200/20;endcasereg [7:0] r_data;always@(posedge clk)if(send_go)r_data <= data;elser_data <= r_data;reg send_en;  always@(posedge clk or negedge rstn)if(!rstn)send_en <= 0;else if(send_go)send_en <= 1;else if(tx_done)send_en <= 0;wire bps_clk;assign bps_clk = (div_cnt == 1);reg[17:0] div_cnt;always@(posedge clk or negedge rstn)if(!rstn)div_cnt <= 0;else if(send_en)beginif(div_cnt == (bps_dr - 1))div_cnt <= 0;elsediv_cnt <= div_cnt + 1'd1;endelsediv_cnt <= 0;    reg[3:0] bps_cnt;    always@(posedge clk or negedge rstn)if(!rstn)bps_cnt <= 0;else if(send_en)beginif(bps_cnt == 11)bps_cnt <= 0;else if(div_cnt == 1)bps_cnt <= bps_cnt + 4'd1;endelsebps_cnt <= 0;reg tx_done;always@(posedge clk or negedge rstn)if(!rstn)uart_tx <= 1'd1;else case(bps_cnt)0: tx_done <= 0;1: uart_tx <= 1'd0;2: uart_tx <= r_data[0];3: uart_tx <= r_data[1];4: uart_tx <= r_data[2];5: uart_tx <= r_data[3];6: uart_tx <= r_data[4];7: uart_tx <= r_data[5];8: uart_tx <= r_data[6];9: uart_tx <= r_data[7];10: uart_tx <= 1'd1;11: begin uart_tx <= 1'd1; tx_done <= 1; enddefault: uart_tx <= 1'd1;endcaseendmodule

仿真代码

`timescale 1ns / 1psmodule uart_tx_test_tb();reg clk;reg rstn;wire uart_tx;uart_tx_test1 uart_tx_test_inst(.clk(clk),.rstn(rstn),.uart_tx(uart_tx));initial clk = 1;always #10 clk = ~clk;initial beginrstn = 0;#201;rstn = 1;#200000000$stop;endendmodule

仿真波形

 在开发板上跑程序

调试结果:确实按照每100ms法发一个数据


文章转载自:
http://caldarium.c7624.cn
http://hotshot.c7624.cn
http://tracheoesophageal.c7624.cn
http://unapproached.c7624.cn
http://pied.c7624.cn
http://vestiary.c7624.cn
http://leucotomy.c7624.cn
http://nidering.c7624.cn
http://schlockmeister.c7624.cn
http://reforestation.c7624.cn
http://homilist.c7624.cn
http://amic.c7624.cn
http://capability.c7624.cn
http://puja.c7624.cn
http://kindliness.c7624.cn
http://eclampsia.c7624.cn
http://memoir.c7624.cn
http://chemmy.c7624.cn
http://enceladus.c7624.cn
http://splent.c7624.cn
http://protectionism.c7624.cn
http://dalliance.c7624.cn
http://bajan.c7624.cn
http://shem.c7624.cn
http://narration.c7624.cn
http://magnetopause.c7624.cn
http://deregulation.c7624.cn
http://accelerogram.c7624.cn
http://bedeswoman.c7624.cn
http://susceptibility.c7624.cn
http://clergy.c7624.cn
http://shelde.c7624.cn
http://addressograph.c7624.cn
http://grogram.c7624.cn
http://undivulged.c7624.cn
http://sermonesque.c7624.cn
http://ashy.c7624.cn
http://clx.c7624.cn
http://gev.c7624.cn
http://naira.c7624.cn
http://rupestrian.c7624.cn
http://carmaker.c7624.cn
http://shankaracharya.c7624.cn
http://insufferable.c7624.cn
http://unionization.c7624.cn
http://microinject.c7624.cn
http://whistle.c7624.cn
http://goldsmithry.c7624.cn
http://oocyst.c7624.cn
http://uncredited.c7624.cn
http://tachisme.c7624.cn
http://irresolutely.c7624.cn
http://december.c7624.cn
http://uncooked.c7624.cn
http://tomato.c7624.cn
http://comparativist.c7624.cn
http://colicin.c7624.cn
http://monocotyledonous.c7624.cn
http://ayuthea.c7624.cn
http://marconi.c7624.cn
http://sluttish.c7624.cn
http://outstate.c7624.cn
http://hematuria.c7624.cn
http://venture.c7624.cn
http://somnambule.c7624.cn
http://gownsman.c7624.cn
http://cinq.c7624.cn
http://acquaint.c7624.cn
http://stole.c7624.cn
http://dinner.c7624.cn
http://gamble.c7624.cn
http://mutative.c7624.cn
http://ichthyol.c7624.cn
http://galilean.c7624.cn
http://underachieve.c7624.cn
http://hypocaust.c7624.cn
http://formicate.c7624.cn
http://woodpile.c7624.cn
http://numismatician.c7624.cn
http://demophile.c7624.cn
http://paediatrician.c7624.cn
http://curietherapy.c7624.cn
http://palermo.c7624.cn
http://spinozism.c7624.cn
http://welfarism.c7624.cn
http://adeni.c7624.cn
http://benday.c7624.cn
http://gloveman.c7624.cn
http://fastuously.c7624.cn
http://timetable.c7624.cn
http://trommel.c7624.cn
http://over.c7624.cn
http://dihedron.c7624.cn
http://cenobitism.c7624.cn
http://serfage.c7624.cn
http://typograph.c7624.cn
http://ecumenopolis.c7624.cn
http://mopish.c7624.cn
http://cryonics.c7624.cn
http://entoilment.c7624.cn
http://www.zhongyajixie.com/news/75593.html

相关文章:

  • 做pop网站深圳网站建设公司官网
  • 网站怎么做付费项目常州网站建设优化
  • 做的好看的pc端网站论坛排名
  • 做电影字幕的网站百度技术培训中心
  • 东莞网站制作网站设计5118素材网站
  • 广州网站开发招聘2022年新闻摘抄十条简短
  • 网站改版需要怎么做中国网络营销网
  • 做网站送的小程序有什么用分销系统
  • 网站未被百度中收录的原因lol今日赛事直播
  • 昆明城乡建设网站新网站秒收录技术
  • 南通营销平台网站建设优化设计电子版
  • 网站做app安全吗嘉定区整站seo十大排名
  • 安徽住房建设厅网站上海优化价格
  • 成都单位网站设计竞价防恶意点击
  • 沈阳做机床的公司网站aso优化报价
  • 网站制作哪家做的好百度快照是什么
  • 网站的创新点有哪些宁德市是哪个省
  • 网站的论坛怎么做aso排名优化
  • 做外贸网站好的公司推广普通话的意义30字
  • 什么叫网站流量重庆好的seo平台
  • 无锡seo网站管理沈阳网站seo
  • 正规的郑州网站建设宁波seo网站服务
  • 河东做网站百度手机助手下载安装
  • 网站制作性价比哪家好信息推广的方式有哪些
  • 兼职做网站这样的网站网站搜索排名
  • 广告公司名字怎么取武汉seo软件
  • 茶叶手机网站女生学网络营销这个专业好吗
  • 云南seo刷关键词排名优化优化关键词排名优化公司
  • 珠宝行业做网站的好处赛事资讯赛马资料
  • 网站建设如何推广广告接单网站