描述
<div class="document">
<h3 class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt">1、项目功能介绍</h3>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"> 热敏微型打印机是一种嵌入式系统常用的硬拷贝输出装置,与大家的生活密切相关,例如刷信用卡有信用卡回执单,点外卖有点单小票,用纸制的打印票据作为双方交易的凭据,是互联网无纸化应用的重要补充。热敏微型打印机具有输出分辨率高,打印速度快,数据处理和实时控制都有较高的要求,如果采用传统的8位单片机来完成设计,会带来系统的复杂性和硬件成本高的弊端,而采用新一代国产ARM核M0芯片进行相应的设计,就能达到性能与价格的完美平衡,保证性能的前提下,达到了成本最低。</p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"> 采用国民技术<span style="color: #e03e2d;">N32G031C8L7</span>芯片为主控的热敏微型打印机控制板作品成品图如下,该控制板配套的热敏打印头为常见的FTP628MCL-101或其它兼容国产热敏打印机头如精芯科技公司的<span style="color: #e03e2d;">JX-2R-01</span>机头,打印机使用的字库为由深圳高通半导体有限公司推出的<span style="color: #e03e2d;">GT30L32S4W</span>打印机专用字库芯片。</p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"> 本次设计的打印机控制板为了方便调试和使用,增加了USB转串口功能,使用了沁恒公司的<span style="color: #e03e2d;">CH340C</span>完成通讯,供电部分使用了TI公司的DCDC芯片<span style="color: #e03e2d;">TPS54331</span>完成12V变换成5V供打印系统使用的设计。</p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"> <img src="//image.lceda.cn/pullimage/o3eHzz2yk80xGCPZXOQIu63rNv0IVzMFXcXwXECp.jpeg" alt="国民技术N32G031C8L7热敏微型打印机方案板" width="1276" height="1702"></p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"> </p>
<h3 class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;">2、项目属性</h3>
<hr class="horizontal-splitline normal-bold-2">
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"> 本项目采用国民技术32位单片机N32G031C8L7为主控,利用其丰富的资源实现热敏打印机控制的全部功能。全套软硬件系作者原创,N32G031C8L7芯片拥有64K Flash程序和8K SRAM空间,自带高精度RC振荡器,12位ADC,3个UART和2路SPI硬件,使得本机硬件电路简洁,性价比极高,系同类产品中降本增效的典范。</p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"> 下图为采用传统8位单片机实现的5V串口热敏微打控制板和采用32位ARM芯片N32G031C8L7为主控的热敏微打控制板对照图。<img src="//image.lceda.cn/pullimage/F1T0BwyTi1s8c1UAp6DgTTSFTj4AthTbAgPPa938.jpeg" alt="" width="1702" height="1276"></p>
<h3 class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;">3、开源协议</h3>
<hr class="horizontal-splitline normal-bold-2">
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;">本项目采用GPL3.0开源协议</p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"> </p>
<h3 class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;">4、硬件部分</h3>
<hr class="horizontal-splitline normal-bold-2">
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"> <strong> 4.1、硬件部分功能组成如下:</strong></p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"><img src="//image.lceda.cn/pullimage/bhFvEC6Y5bHhHhSwkKi5rFHT5mtRMFZhTfJjvVNZ.png" alt="" width="724" height="483"></p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"><strong> 4.2、硬件电路构成框图如下图所示:</strong></p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"><img src="//image.lceda.cn/pullimage/gZokd3BvzfJfL1E3kFRoyGmNRtfy0cdIHgRw28RW.png" alt="" width="602" height="544"></p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"><strong>4.3、控制板电路原理总图</strong>如下所示,完整清晰的原理图请下载附件中的PDF格式文件查看。</p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"><img src="//image.lceda.cn/pullimage/KGP2HSclZTsHKwcddCgIebffg7tZEwqRnvBvAxg5.png" alt="" width="820" height="535"></p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"><strong>4.4.1、电路功能解说-单片机最小系统单元:</strong></p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"><img src="//image.lceda.cn/pullimage/NEjYUqWI9GBgNYNww6Ft3aigvEw24dYSGkBYeIxd.png" alt="" width="617" height="424"></p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"> 电路参考官方评估板进行设计,注意芯片的VDD引脚上都要就近放置104电容,保证芯片的工作稳定性,并在48脚附近额外增加了1只10uF的陶瓷电容滤波。44脚Boot0采用上拉到VDD及跳线到地的设计,如果要使用芯片的ISP功能更新固件,跳线断开,Boot0上拉,运行国民技术官方设计的上位机专用下载软件即可。如果要用Jlink仿真调试固件,需要Boot0短路到地。</p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"> 芯片的SPI1模块与字库相连,使用芯片的高速硬件SPI单元读取字库中的字符点阵。</p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"> 连接到PB2上的TM信号为打印机温度热敏电阻输出电压检测引脚,使用芯片的ADC单元读取打印头实时温度值,超出限定值时,暂停加热操作,待温度恢复正常后继续进行后续打印内容。</p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"> 连接到PB0引脚上的PRN_PHE信号为缺纸检测信号,打印头有纸时,光电开关光敏管有输出,此引脚为高电平,缺纸时,光敏管无法接收到反射光,无输出电流,此引脚为低电平。</p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"><strong>4.4.2、电路功能解说-电源部分:</strong></p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"><strong><img src="//image.lceda.cn/pullimage/XsMzGa7kkSt4awkXDS3jNiXjoIXuOd97MBLhPiBV.png" alt="" width="772" height="264"></strong></p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"><span style="font-size: 12px;"> </span></p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"><strong> </strong>电路按最大输出5V-3A设计,输出续流二极管用的是3A的肖特基快恢复型二极管B340K,由于此芯片采用高达570KHz的固定开关频率,因而可以使用较小的变换电感6.8uH和较小的输出电容即可。</p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"> 芯片各引脚功能描述如下图:</p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"><img src="//image.lceda.cn/pullimage/TyMNFj1aIBqolkVYCc7GbnZhGr58Ncit9cZrP7Ni.png" alt="" width="1079" height="441"> 设计时需注意3号引脚功能:此引脚为允许工作引脚,当低于1.25V时,芯片停止工作,如果悬空,为一至保持工作状态,推荐设计时用2个电阻分压实现低电压锁定工作的。按图中设计值代入计算得出输入低于10.06V时会停止输出。计算公式为(1143/143)*1.25V = 10.0616197V</p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"><strong> </strong></p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"><strong>4.4.3、电路功能解说-电机驱动部分:</strong></p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"><strong><img src="//image.lceda.cn/pullimage/2e6gYMdK9CVkpvOuDfuYk7S4pGs5UFQoPja59i7e.png" alt="" width="382" height="206"></strong></p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;">电机驱动采用杭州中科微电子生产的AT8548电机芯片,具有Pin To Pin替代进口,价格低廉的优势。该芯片性能如下图所示。<img src="//image.lceda.cn/pullimage/N6EpcG4eOgcHu3DySSIb6hnScUxpHVXebGNESxm1.png" alt="" width="761" height="405"></p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"><strong>4.4.4、电路功能解说-字库接口部分:</strong></p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"><strong><img src="//image.lceda.cn/pullimage/mKLLbBWVe0TKNVZ0XFJ8bIMaVh5BcTUFBJ03ObPv.png" alt="" width="427" height="193"></strong></p>
字库采用深圳高通半导体有限公司的打印机专用横置横排点阵字体,具体规格如下图:</div>
<div class="document"><img src="//image.lceda.cn/pullimage/n9jLsMgfcVVydTmcVyQw533w91fWZbe2wbSIoQiI.png" alt="" width="668" height="250"></div>
<div class="document">
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"><strong>4.4.5、电路功能解说-USB转串口部分:</strong></p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"><strong><img src="//image.lceda.cn/pullimage/g2Py7JtIFh5EHB8oc8crPgdLoU1RRf1HS5OfhTGz.png" alt="" width="701" height="325"></strong></p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"> USB转串口部分采用南京沁恒公司的CH340C,该芯片内置振荡器满足USB通讯要求,简化了电路和生产。</p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"><strong>4.4.6、电路功能解说-打印头接口部分:</strong></p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"><strong><img src="//image.lceda.cn/pullimage/fvJl6oBUubFdtQDXyz4QuTKfUakqfYbsp107xrQg.png" alt="" width="432" height="509"></strong></p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"><strong> </strong> 热敏打印头内部结构其实很简单,相当于内置384个串行灯炮加热用,数据串行传输与常用的HC595扩充输出架构是一样一样的。上图中R5为检测纸的光电开关发光二极管限流电阻,R6是光电开关输出光电三极管负载电阻,R9为打印头测温热敏电阻分压上置电阻,与热敏电阻分压后送单片机AD口测量。</p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;">内部结构如下图所示:</p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"><img src="//image.lceda.cn/pullimage/AmuwRddbNyNEh2idryz6GaE18eVM3d17KQGyfXXN.png" alt="" width="746" height="559">注意事项,STB信号为高时,输出寄存器的内容 触发加热单元加热,单片机上电初始化后应将此引脚拉低,以免长期加热损伤打印头。</p>
<h3 class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;">5、软件部分</h3>
<p> 软件采用MDK5.27版本编译,实现了中文32X32字符串打印,英文32X16字符串打印,固定图形打印等功能,软件工程内容如下图:</p>
<p><img src="//image.lceda.cn/pullimage/H6s9GGS2Y85ryYsLXNm5AO2m0mzC2HZdLNFiZ9Z1.png" alt="" width="1280" height="761"></p>
<p> 全部工程源代码打包后在附件中可以下载,软件采用分层驱动,底层调用官方的库文件实现单片机硬件的初始化和驱动接口。</p>
<p><strong>5.2.1、软件功能解说-步进电机驱动</strong></p>
<p> 电机采用2相4步驱动,电机转动2步,走纸机构带动纸卷前进1点行,相关代码如下图,注意电机每走一步需换相,走步时要记忆当前位置信息。</p>
<p><img src="//image.lceda.cn/pullimage/QMqP76gD9zrSVW8WqNFkXXeMQOHzchYBfVOWbeFd.png" alt="" width="619" height="331"></p>
<strong>5.2.2、软件功能解说-1点行数据输出到打印头锁存器函数</strong></div>
<div class="document"> 打印一点行数据是实现图形和字符打印的核心功能函数,一点行384个Bit点,内容预先存放到38字节的行点阵缓冲区中,相关实现代码如下图所示。</div>
<div class="document">
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"><img src="//image.lceda.cn/pullimage/zMoitua02txPn0HnLDhSFL6We4j8mWgmVP2hyhIN.png" alt="" width="737" height="143"></p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"><strong>5.2.3、软件功能解说-一行汉字字符打印功能函数</strong></p>
<strong> </strong>打印一行汉字是调用前面介绍的输出一点行打印数据,然后加热,走纸一点行,如此循环32次即完成一行32点阵字符的打印功能,相关代码截图如下所示:</div>
<div class="document"><img src="//image.lceda.cn/pullimage/KaNeTw2KpR2lyeyte0XJvDh3UUJUAWMONxwlaILv.png" alt="" width="986" height="579"></div>
<div class="document"><strong>5.3、程序烧写说明</strong></div>
<div class="document"> 将板上的Boot0引脚断开跳线,使芯片上电运行ISP加载程序,此时即可以使用官方ISP工具软件通过串口直接加载固件到单片机,然后将Boot0引脚置低,重新上电运行固件测试功能,相关软件截图如下所示:</div>
<div class="document"><img src="//image.lceda.cn/pullimage/iLs7VmZd6fj4ER6n642UgnD7Xrrr9hUeBSHnAyFQ.png" alt="" width="983" height="707"></div>
<div class="document">
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt pap-left-indent-1.6em" style="line-height: 1.8;"> </p>
<h3 class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;">6、BOM清单</h3>
<hr class="horizontal-splitline normal-bold-2">
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"> BOM表由电路原理图直接导出的Excel表,相关截图如下:完整的材料表详见附件文件内容</p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"><img src="//image.lceda.cn/pullimage/ZngeYBW1JijoP6J0vDPYDBeEQAJF0oaDVMp2Pdr6.png" alt="" width="1091" height="609"></p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"> </p>
<h3 class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;">7、大赛LOGO验证</h3>
<hr class="horizontal-splitline normal-bold-2">
<p style="line-height: 1.8;"><img src="//image.lceda.cn/pullimage/HYWbxKWfH0Fcr3HMAgkssXg5O6x9gOXuPzLneJO1.jpeg" alt="" width="741" height="764"></p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"> </p>
<h3 class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"> 8、演示您的项目并录制成视频上传</h3>
<hr class="horizontal-splitline normal-bold-2">
<p style="line-height: 1.8;"> </p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"> </p>
</div>
评论(9)