Part4_显示中文字符串
<p>[TOC]</p>
<h1>功能描述</h1>
<p>使用ATF进行中文显示。</p>
<h4>接线方法</h4>
<p>将彩屏和Arduino控制器进行连接,RX-TX,GND-GND(用到了RX和TX串口)</p>
<h4>实现功能</h4>
<p>当用户需要显示中文字符时,可打开资源列表,加载所需中文字库资源项到资源文件中,记住资源索引号,再下载到模块里,使用指令进行调用。
出场资源文件当中已加载有两个中文字库,索引号分别为0和1,双击资源列表中的资源项,可以在右侧的显示区域中查看资源项。
本例将使用32*32点阵的中文字库进行中文字符串显示。</p>
<h4>操作示例</h4>
<p>为方便演示,将在ATF 043模块的出场资源文件上进行加载字库,然后再下载到模块当中去。
打开所需资源文件,将左侧标签页切换到资源列表,点击工具栏上的中文字库加载按钮,选择所需字库加载。
<img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=f1e736ac1ea3fbb39d666339fac2e05d&amp;file=file.png" alt="" />
或在工具栏上方资源中选择加载汉字库。
温馨提示:记住所加载的资源索引号。</p>
<h1>使用代码</h1>
<h4>CnStringDefine.c</h4>
<pre><code class="language-c">const char m_CnString1[] = &quot;当前状态:&quot;;
const char m_CnString2[] = &quot;运行&quot;;
const char m_CnString3[] = &quot;停止&quot;;</code></pre>
<h4>CnStringDisplay</h4>
<pre><code class="language-c">#include &quot;CnStringDefine.c&quot;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
delay(3000);
}
unsigned char m_RunFlag=0;
unsigned char m_DisplayFlag=0;
void loop() {
// put your main code here, to run repeatedly:
if(m_RunFlag==0)
{
m_RunFlag = 1;
Serial.println(&quot;@PRINTM 0&quot;);
Serial.println(&quot;@FONT 0,Red&quot;);
Serial.println(&quot;@FMODE 1,Blue&quot;);
Serial.print(&quot;@STR 50,100,&quot;);
Serial.println(m_CnString1);
Serial.println(&quot;@FONT 50,Yellow&quot;);
}
Serial.print(&quot;@STR 140,95,&quot;);
if(m_DisplayFlag==0)
{
Serial.println(m_CnString2);
m_DisplayFlag = 1;
}
else
{
Serial.println(m_CnString3);
m_DisplayFlag = 0;
}
delay(2000);
}</code></pre>
<h1>资源文件</h1>
<p>[常规篇part4资源文件](<a href="https://pan.baidu.com/e/1lG3MveVqHqiz7gkTR2121g?pwd=ATFC">https://pan.baidu.com/e/1lG3MveVqHqiz7gkTR2121g?pwd=ATFC</a> "常规篇part4资源文件")</p>
<h1>视频教程</h1>
<p><a href="https://www.bilibili.com/video/BV14Y4y1q7KE/?spm_id_from=333.999.0.0&amp;vd_source=8adc070117854dc6967b17bf3379321b">【中级篇】Part4_显示中文字符串</a></p>