Code Monkey home page Code Monkey logo

ikun's Introduction

iKun

根据Tang Nano 9k开发板官方example改编而来的spi 1.14inch lcd视频显示

显示效果

image image

如何使用?

git pull或者git clone本项目至本地

git clone https://github.com/Moeary/iKun.git

然后将想要转换的视频放入python处理文件的目录下,并修改视频路径为你视频的真实路径
然后运行

python video2img.py
在运行前确保你有一个相对完整的Python环境 需要安装FFmpeg(并添加到系统路径里)

执行完这这段代码之后该文件夹下回新增一个out子文件夹,并生成以frame****(*代表数字).bmp的视频帧文件
之后修改bmp_image2hex_out.py文件中的第26行

26 for i in range(1,9):  # 假设你要处理1到9张图片 

将其改为你需要的数字,默认为1到9,如果你想处理第1001张图片到1100张图片可以修改为 ''' for i in range(1001,1100): ''' 之后运行该程序

python bmp_image2hex_out.py

得到cxk.txt文件,内部大致如

assign cxk[1][32399:0] = 32400'h +"一大串16进制数字"+;
assign cxk[2][32399:0] = 32400'h +"一大串16进制数字"+;
.......
assign cxk[9][32399:0] = 32400'h +"一大串16进制数字"+;
PS:这里最好不要把wire [32399:0]cxk 后面的[9:0]修改的很大,因为这个代表了帧数
帧数越大会导致IDE在布线的时候直接爆内存布不了线,大概有140行的时候就会提示布线超过规定的1MB内存,然后实际在Clean&Run的时候也因为软件机能限制导致IDE直接崩溃掉,最好在50行以内

至此 准备工作全部完成,接下来需要进入Gowin IDE中进行修改 打开GowinIDE 点击左上角的文件->打开 选择我们clone下来的14_test.gprj 进行打开 image
打开后双击src/top.v文件 准备开始修改
image
选中蓝色框住的10行assign代码 ,进行删除
image
然后把之前cxk.txt文件中的10行assign代码Ctrl^C Ctrl^V复制进来
至此 替换工作就完成了
然后点击Process,右击Place&Route 选择Clean & Rerun All进行电路分析布线并生成BitStream文件进行烧录
image image
再点击中上角的Programmer进行烧录
image
会弹出一个新窗口用来烧录
image
点击save,然后再点击中上角的下载器下载到SRAM里面

默认下载到SRAM,重启就没了,为了防止这个可以直接下载到flash里面不会丢失数据

image

image


等待一会就可以看到你的视频已经成功转进去并在lcd显示屏上面显示了 至此 就弄好了。
这个先把IDE基本功能都弄明白一点再做会好很多
Verilog代码我我限制最多只有10帧,可以自行修改,需要修改的变量为
142 reg [3:0] time_cnt;   //[3:0]一共4bit最多只能循环16帧,可以自行拓展
143 wire [32399:0]cxk[9:0];  //后面9:0最多只能循环10帧 可以自行拓展
如果修改了 time_cnt的bit数 则下面也需要修改
255                  if(time_cnt == 10) begin //达到10帧后
256                      time_cnt<=4'b0000;   //这里重置为0 重新开始循环
257                  end
比如我想改成100帧可以这样改
142 reg [6:0] time_cnt;   //[6:0]一共7bit最多只能循环128帧
143 wire [32399:0]cxk[99:0];  //后面99:0最多只能循环100帧 


255                  if(time_cnt == 100) begin //达到100帧后
256                      time_cnt<=7'b000_0000;   //这里重置为0 重新开始循环
257                  end
这个Verilog代码我我根据官方的代码来改的,我Verilog学的还不是很好,希望有大佬指点一下

ikun's People

Contributors

moeary avatar

Stargazers

 avatar  avatar An Shunzhen avatar  avatar 橘ユカリ Yukari avatar Han-Chen Factory avatar musong avatar  avatar

Watchers

 avatar

ikun's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.