Laspide 发表于 2022-3-6 15:39

【平头哥RVB2601创意应用开发】唐诗学习机之一:开发环境搭建 & 汉字显示例程

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:&quot;Times New Roman&quot;,&quot;serif&quot;"><span style="text-justify:inter-ideograph"><span lang="EN-US" style="font-family:&quot;微软雅黑&quot;,&quot;sans-serif&quot;">一、RVB2601</span><span style="font-family:&quot;微软雅黑&quot;,&quot;sans-serif&quot;">开发板开发环境学习</span></span></span></span></p>

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:&quot;Times New Roman&quot;,&quot;serif&quot;"><span style="text-justify:inter-ideograph"><span style="font-family:&quot;微软雅黑&quot;,&quot;sans-serif&quot;">按照《RVB2601开发板用户手册》,了解掌握开发板的硬件资源,确认芯片型号规格,收集相关芯片数据手册,</span></span></span></span></p>

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:&quot;Times New Roman&quot;,&quot;serif&quot;"><span style="text-justify:inter-ideograph"><span style="font-family:&quot;微软雅黑&quot;,&quot;sans-serif&quot;">按照《RVB2601开发板快速上手手册》,了解掌握CDK IDE,快速搭建开发环境,通过Hello World例程确认软硬件环境可用,很顺利。</span></span></span></span></p>

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:&quot;Times New Roman&quot;,&quot;serif&quot;"><span style="text-justify:inter-ideograph"><span style="font-family:&quot;微软雅黑&quot;,&quot;sans-serif&quot;">小结:开发板资料够用,结合例程,上手快速;国产芯片数据手册简洁,还需要结合实际例程体会学习。</span></span></span></span></p>

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:&quot;Times New Roman&quot;,&quot;serif&quot;"><span style="text-justify:inter-ideograph"><span style="font-family:&quot;微软雅黑&quot;,&quot;sans-serif&quot;">例程集成的文件较多,望文只能生义,还不十分清楚具体原理作用,需要时再做研究,这样从零生成一个项目工程还是有难度的,目前只能按照《RVB2601开发板快速上手手册》介绍的方法建立工程,在上面进行修改调整,这里先感谢分享例程的大佬们了。</span></span></span></span></p>

<p><span style="font-size:10.5pt"><span style="font-family:&quot;微软雅黑&quot;,&quot;sans-serif&quot;">对于AOS和YOC,以及CPU本身的数据手册,是否还有详细的介绍资料,还需进一步查找。</span></span></p>

<p><span style="font-size:10.5pt"><span style="font-family:&quot;微软雅黑&quot;,&quot;sans-serif&quot;">例程中引用上述图中文件貌似不多,基本只是开发板硬件的初始化,按需进行后续的学习了。</span></span></p>

<p><font face="&quot;微软雅黑&quot;,&quot;sans-serif&quot;">二、</font><span lang="EN-US" style="font-size:10.5pt"><span style="font-family:&quot;微软雅黑&quot;,&quot;sans-serif&quot;">RVB2601</span></span><span style="font-size:10.5pt"><span style="font-family:&quot;微软雅黑&quot;,&quot;sans-serif&quot;">板载资源例程学习</span></span></p>

<p><span style="font-size:10.5pt"><span style="font-family:&quot;微软雅黑&quot;,&quot;sans-serif&quot;">基于&ldquo;ch2601_player_demo&rdquo;例程,熟悉开发板的OLED显示资源。</span></span></p>

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:&quot;Times New Roman&quot;,&quot;serif&quot;"><span style="text-justify:inter-ideograph"><span style="font-family:&quot;微软雅黑&quot;,&quot;sans-serif&quot;">(1)新建工程</span></span></span></span></p>

<p><span style="font-size:10.5pt"><span style="font-family:&quot;微软雅黑&quot;,&quot;sans-serif&quot;">在CDK中,通过Welcome页面,搜索CH2601,选择&ldquo;ch2601_player_demo&rdquo;例程。</span></span></p>

<p></p>

<p><span style="font-size:10.5pt"><span style="font-family:&quot;Times New Roman&quot;,&quot;serif&quot;"><span style="text-justify:inter-ideograph"><span style="font-family:&quot;微软雅黑&quot;,&quot;sans-serif&quot;">(2)</span><span style="font-family:&quot;微软雅黑&quot;,&quot;sans-serif&quot;">熟悉例程</span></span></span></span></p>

<p><span style="font-size:10.5pt"><span style="font-family:&quot;Times New Roman&quot;,&quot;serif&quot;"><span style="text-justify:inter-ideograph"><span lang="EN-US" style="font-family:&quot;微软雅黑&quot;,&quot;sans-serif&quot;">bitmap_risc_v.c</span><span style="font-family:&quot;微软雅黑&quot;,&quot;sans-serif&quot;">是开机显示的字符文件;audio文件夹下是音频的字节数组;app_main.c是主文件。貌似有些文件没有使用。</span></span></span></span></p>

<p></p>

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:&quot;Times New Roman&quot;,&quot;serif&quot;"><span style="text-justify:inter-ideograph"><span style="font-family:&quot;微软雅黑&quot;,&quot;sans-serif&quot;">(3)新增汉字字库文件</span></span></span></span></p>

<p><span style="font-size:10.5pt"><span style="font-family:&quot;微软雅黑&quot;,&quot;sans-serif&quot;">在oled文件夹下,新建唐诗中用到的汉字字库C文件。</span></span></p>

<p></p>

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:&quot;Times New Roman&quot;,&quot;serif&quot;"><span style="text-justify:inter-ideograph"><span style="font-family:&quot;微软雅黑&quot;,&quot;sans-serif&quot;">目前按照GB2312添加了《登鹳雀楼》、《静夜思》、《望庐山瀑布》三首的字节数组。</span></span></span></span></p>

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:&quot;Times New Roman&quot;,&quot;serif&quot;"><span style="text-justify:inter-ideograph"><span lang="EN-US" style="font-family:&quot;微软雅黑&quot;,&quot;sans-serif&quot;">GB2312</span><span style="font-family:&quot;微软雅黑&quot;,&quot;sans-serif&quot;">的汉字编码有PDF和WORD文件,查找汉字不太方便,容易看错编码。</span></span></span></span></p>

<p><span style="font-size:10.5pt"><span style="font-family:&quot;微软雅黑&quot;,&quot;sans-serif&quot;">脚本之家网站上有个在线的GB2312汉字编码表,自制个EXCEL文件使用就方便多了。</span></span></p>

<p><br />
<span style="font-size:10.5pt"><span style="font-family:&quot;Times New Roman&quot;,&quot;serif&quot;"><span style="text-justify:inter-ideograph"><span style="font-family:&quot;微软雅黑&quot;,&quot;sans-serif&quot;">确定了汉字编码后,在通过网上的字库文件,得到汉字编码对应的字节数组定义。</span></span></span></span></p>

<p><span style="font-size:10.5pt"><span style="font-family:&quot;微软雅黑&quot;,&quot;sans-serif&quot;">例如:&ldquo;白&rdquo;的编码是B0D7,</span></span></p>

<p><span style="font-size:10.5pt"><span style="font-family:&quot;微软雅黑&quot;,&quot;sans-serif&quot;">在16x16汉字字库文件中查找对应的数组定义。</span></span></p>

<p>16X16点阵汉字字库的C文件</p>

<p>16X16点阵汉字数组定义。</p>

<p><span style="font-size:10.5pt"><span style="font-family:&quot;微软雅黑&quot;,&quot;sans-serif&quot;">完成三首唐诗用到的汉字定义,并在相应的头文件中定义汉字数组。</span></span></p>

<p><span style="font-size:10.5pt"><span style="font-family:&quot;Times New Roman&quot;,&quot;serif&quot;"><span style="text-justify:inter-ideograph"><span style="font-family:&quot;微软雅黑&quot;,&quot;sans-serif&quot;">(4)汉字数组的处理函数</span></span></span></span></p>

<p><span style="font-size:10.5pt"><span style="font-family:&quot;微软雅黑&quot;,&quot;sans-serif&quot;">在oled.c文件中,增加汉字显示相关的函数。</span></span></p>

<p><span style="font-size:10.5pt"><span style="font-family:&quot;微软雅黑&quot;,&quot;sans-serif&quot;">整个OLED清屏函数,清零屏OLED数组缓存。</span></span></p>

<p><span style="font-size:10.5pt"><span style="font-family:&quot;微软雅黑&quot;,&quot;sans-serif&quot;">在指定位置存储单个汉字的函数,将汉字数组填充到整屏OLED数组缓存的指定位置。</span></span></p>

<p><span style="font-size:10.5pt"><span style="font-family:&quot;微软雅黑&quot;,&quot;sans-serif&quot;">处理一首唐诗的函数,一首唐诗分两页显示,第一页为题目和作者,第二页为内容。</span></span></p>

<p><span style="font-size:10.5pt"><span style="font-family:&quot;Times New Roman&quot;,&quot;serif&quot;"><span style="text-justify:inter-ideograph"><span style="font-family:&quot;微软雅黑&quot;,&quot;sans-serif&quot;">(5)汉字的显示函数</span></span></span></span></p>

<p><span style="font-size:10.5pt"><span style="font-family:&quot;微软雅黑&quot;,&quot;sans-serif&quot;">显示单个汉字和整首唐诗的函数。</span></span></p>

<p></p>

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:&quot;Times New Roman&quot;,&quot;serif&quot;"><span style="text-justify:inter-ideograph"><span style="font-family:&quot;微软雅黑&quot;,&quot;sans-serif&quot;">显示整首唐诗的函数调用原来例程的显示函数,整个屏幕是SSD1309驱动的,显示函数是按八个PAGE显示的,有时间还是可以优化下,显示得更灵活些。</span></span></span></span></p>

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:&quot;Times New Roman&quot;,&quot;serif&quot;"><span style="text-justify:inter-ideograph"><span style="font-family:&quot;微软雅黑&quot;,&quot;sans-serif&quot;">(6)汉字显示函数的调用</span></span></span></span></p>

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:&quot;Times New Roman&quot;,&quot;serif&quot;"><span style="text-justify:inter-ideograph"><span style="font-family:&quot;微软雅黑&quot;,&quot;sans-serif&quot;">在app_main.c中,添加显示唐诗的函数调用。</span></span></span></span></p>

<p><span style="font-size:10.5pt"><span style="font-family:&quot;Times New Roman&quot;,&quot;serif&quot;"><span style="text-justify:inter-ideograph"><span style="font-family:&quot;微软雅黑&quot;,&quot;sans-serif&quot;">(7)编译下载</span></span></span></span></p>

<p><span style="font-size:10.5pt"><span style="font-family:&quot;微软雅黑&quot;,&quot;sans-serif&quot;">编译速度有点慢了。</span></span></p>

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:&quot;Times New Roman&quot;,&quot;serif&quot;"><span style="text-justify:inter-ideograph"><span style="font-family:&quot;微软雅黑&quot;,&quot;sans-serif&quot;">(9)调试</span></span></span></span></p>

<p><span style="font-size:10.5pt"><span style="font-family:&quot;微软雅黑&quot;,&quot;sans-serif&quot;">调试涉及的内容、文件有点多,时间有限还搞不太清楚。</span></span></p>

<p><span style="font-size:10.5pt"><span style="font-family:&quot;微软雅黑&quot;,&quot;sans-serif&quot;">在Dev-C中写个显示点阵汉字的代码,简单看下汉字显示的是否正确。</span></span></p>

<p> &nbsp;<span style="font-size:10.5pt"><span style="font-family:&quot;微软雅黑&quot;,&quot;sans-serif&quot;">(8)显示效果</span></span></p>

<p>改写的例程和OLED显示效果视频体积都大于15M了,帖子里就不传了。</p>

<p>下面是显示效果的照明,马马虎虎。</p>

<p></p>

lugl4313820 发表于 2022-3-6 21:36

是滚动显示的吗?

freebsder 发表于 2022-3-7 22:36

<p>这个要支持,有小朋友的要支持!</p>

通宵敲代码 发表于 2022-3-18 21:41

<p>你这是提前生成了字体编码固定显示,可惜不是调用的字库</p>

nmg 发表于 2022-3-24 10:15

<p>视频你上传到大学堂:<a href="https://training.eeworld.com.cn/course/upcourse" target="_blank">https://training.eeworld.com.cn/course/upcourse</a>,就可以了</p>
页: [1]
查看完整版本: 【平头哥RVB2601创意应用开发】唐诗学习机之一:开发环境搭建 & 汉字显示例程