<?xml version="1.0" standalone="yes"?>
<?xml-stylesheet type="text/xsl" href="css/rss.xslt"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>MYRADIO168的Blog - STM32学习</title><link>http://www.myradio168.net/wb/</link><description>  - </description><generator>RainbowSoft Studio Z-Blog 1.8 Walle Build 100427</generator><language>zh-CN</language><copyright>Copyright 2010-2020 www.myradio168.net  ,  QQ超级群：219925149 , QQ普通群：16925777</copyright><pubDate>Sat, 16 May 2026 04:33:10 +0800</pubDate><item><title>转速电压测试仪</title><author>a@b.com (shijy1977)</author><link>http://www.myradio168.net/wb/post/15.html</link><pubDate>Wed, 10 Apr 2013 11:11:00 +0800</pubDate><guid>http://www.myradio168.net/wb/post/15.html</guid><description><![CDATA[<p>&nbsp;<img onload="ResizeImage(this,520)" src="http://www.myradio168.net/wb/upload/2013/4/20130410_110411.jpg" alt="" title="" /></p><p>根据同学要求做的测试画面</p>]]></description><category>STM32学习</category><comments>http://www.myradio168.net/wb/post/15.html#comment</comments><wfw:comment>http://www.myradio168.net/wb/</wfw:comment><wfw:commentRss>http://www.myradio168.net/wb/feed.asp?cmt=15</wfw:commentRss><trackback:ping>http://www.myradio168.net/wb/cmd.asp?act=tb&amp;id=15&amp;key=60b77d4e</trackback:ping></item><item><title>STM32处理器FLASH读写</title><author>a@b.com (shijy1977)</author><link>http://www.myradio168.net/wb/post/14.html</link><pubDate>Tue, 09 Apr 2013 21:38:50 +0800</pubDate><guid>http://www.myradio168.net/wb/post/14.html</guid><description><![CDATA[<p>&nbsp;/*---------------------------------------------------------------</p><div>1k=0x400&nbsp;</div><div>10k=0x2800&nbsp;</div><div>不同容量的CPU对应的EndAddr</div><div>64k:EndAddr=0x08010000</div><div>128k:EndAddr=0x08020000</div><div>256k:EndAddr=0x08040000</div><div>512k:EndAddr=0x08080000</div><div>&nbsp;</div><div>u32 vw_p[10]= {1,3,5,7,9,2,4,6,8,10};</div><div>u32 StartAddr=((u32)EndAddr-UserFlashSize);</div><div>&nbsp;</div><div>int i;</div><div>&nbsp;</div><div>Flash_write(vw_p,10);</div><div>for (i=0;i&lt;10;i++)</div><div>&nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp;USART_OUT(USART1,&quot;%d&quot;,Flash_Read(i)); &nbsp; &nbsp; &nbsp;//读取方法</div><div>&nbsp; &nbsp; }</div><div>*/</div><div>&nbsp;</div><div>u32 Address=0;</div><div>volatile FLASH_Status FLASHStatus;</div><div>&nbsp;</div><div>/*****************************写Flash函数*****************************</div><div>src ：待写入的数据起始地址</div><div>size：数据长度</div><div>*/</div><div>&nbsp;</div><div>void Flash_write(unsigned int *src,u32 size)</div><div>{&nbsp;</div><div>&nbsp; u32 i=0;</div><div>&nbsp;</div><div>&nbsp; RCC_HSICmd(ENABLE);</div><div>&nbsp;</div><div>&nbsp; FLASH_Unlock();</div><div>&nbsp;</div><div>&nbsp; FLASH_ClearFlag(FLASH_FLAG_BSY | FLASH_FLAG_EOP | FLASH_FLAG_PGERR | FLASH_FLAG_WRPRTERR); &nbsp; &nbsp; &nbsp; &nbsp;</div><div>&nbsp; FLASHStatus = FLASH_ErasePage(StartAddr);</div><div>&nbsp;</div><div>&nbsp; Address = StartAddr;</div><div>&nbsp; if(FLASHStatus == FLASH_COMPLETE)</div><div>&nbsp; &nbsp; {</div><div><span class="Apple-tab-span" style="white-space:pre">	</span> while(i&lt;size)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;FLASHStatus = FLASH_ProgramWord(Address, *(src+i));</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Address+=4;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;i++;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</div><div>&nbsp; &nbsp; }</div><div>&nbsp;</div><div>&nbsp; FLASH_Lock();</div><div>}</div><div>/*****************************读Flash函数*****************************</div><div>rdadr ：数据偏移地址</div><div>*/</div><div>u8 Flash_Read(u32 rdadr)</div><div>{</div><div>&nbsp; return(*(u8*)(StartAddr + rdadr*4));</div><div>}</div>]]></description><category>STM32学习</category><comments>http://www.myradio168.net/wb/post/14.html#comment</comments><wfw:comment>http://www.myradio168.net/wb/</wfw:comment><wfw:commentRss>http://www.myradio168.net/wb/feed.asp?cmt=14</wfw:commentRss><trackback:ping>http://www.myradio168.net/wb/cmd.asp?act=tb&amp;id=14&amp;key=a342e6df</trackback:ping></item><item><title>数值转字符串</title><author>a@b.com (shijy1977)</author><link>http://www.myradio168.net/wb/post/13.html</link><pubDate>Tue, 09 Apr 2013 21:35:21 +0800</pubDate><guid>http://www.myradio168.net/wb/post/13.html</guid><description><![CDATA[<p>&nbsp;/******************************************************</p><div><span class="Apple-tab-span" style="white-space:pre">		</span>整形数据转字符串函数</div><div>&nbsp; &nbsp; &nbsp; &nbsp; char *itoa(int value, char *string, int radix)</div><div><span class="Apple-tab-span" style="white-space:pre">		</span>radix=10 标示是10进制<span class="Apple-tab-span" style="white-space:pre">	</span>非十进制，转换结果为0; &nbsp;</div><div>&nbsp;</div><div><span class="Apple-tab-span" style="white-space:pre">	</span> &nbsp; &nbsp;例：d=-379;</div><div><span class="Apple-tab-span" style="white-space:pre">		</span>执行<span class="Apple-tab-span" style="white-space:pre">	</span>itoa(d, buf, 10); 后</div><div><span class="Apple-tab-span" style="white-space:pre">		</span></div><div><span class="Apple-tab-span" style="white-space:pre">		</span>buf=&quot;-379&quot;<span class="Apple-tab-span" style="white-space:pre">							</span> &nbsp; <span class="Apple-tab-span" style="white-space:pre">			</span> &nbsp;</div><div>**********************************************************/</div><p>char *itoa(int value, char *string, int radix)</p><div>{</div><div>&nbsp;int &nbsp; &nbsp; i, d;</div><div>&nbsp;int &nbsp; &nbsp; flag = 0;</div><div>&nbsp;char &nbsp; &nbsp;*ptr = string;</div><div>&nbsp;</div><div>&nbsp;if (radix != 10)</div><div>&nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; *ptr = 0;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; return string;</div><div>&nbsp; &nbsp; }</div><div>&nbsp;</div><div>&nbsp;if (!value)</div><div>&nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; *ptr++ = 0x30;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; *ptr = 0;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; return string;</div><div>&nbsp; &nbsp; }</div><div>&nbsp;</div><div>&nbsp; &nbsp; if (value &lt; 0)</div><div>&nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; *ptr++ = '-';</div><div>&nbsp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; value *= -1;</div><div>&nbsp; &nbsp; }</div><div>&nbsp;</div><div>&nbsp;for(i = 10000; i &gt; 0; i /= 10)</div><div>&nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp;d = value / i;</div><div>&nbsp;</div><div>&nbsp; &nbsp; &nbsp;if (d || flag)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; *ptr++ = (char)(d + 0x30);</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; value -= (d * i);</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; flag = 1;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; }</div><div>&nbsp; &nbsp; }</div><div>&nbsp;</div><div>&nbsp;*ptr = 0;</div><div>&nbsp;</div><div>&nbsp;return string;</div><div>}&nbsp;</div>]]></description><category>STM32学习</category><comments>http://www.myradio168.net/wb/post/13.html#comment</comments><wfw:comment>http://www.myradio168.net/wb/</wfw:comment><wfw:commentRss>http://www.myradio168.net/wb/feed.asp?cmt=13</wfw:commentRss><trackback:ping>http://www.myradio168.net/wb/cmd.asp?act=tb&amp;id=13&amp;key=e2bcd76e</trackback:ping></item><item><title>浮点数转字符串</title><author>a@b.com (shijy1977)</author><link>http://www.myradio168.net/wb/post/12.html</link><pubDate>Tue, 09 Apr 2013 21:33:17 +0800</pubDate><guid>http://www.myradio168.net/wb/post/12.html</guid><description><![CDATA[<p>&nbsp;void FToStr1(float fl , char *str, uint8_t d) &nbsp;// fl:浮点数 &nbsp; &nbsp;d:小数位数</p><div>{</div><div>&nbsp; &nbsp; int &nbsp; &nbsp; integer = 0; &nbsp; &nbsp; //整数部分</div><div>&nbsp; &nbsp; float &nbsp; decimal &nbsp;= 0; &nbsp; &nbsp;//小数部分</div><div>&nbsp; &nbsp; int &nbsp; &nbsp; temp;</div><div>&nbsp; &nbsp; uint8_t i, n;</div><div>&nbsp; &nbsp; //整数部分</div><div>&nbsp; &nbsp; integer = (int)(fl);</div><div>&nbsp; &nbsp; temp = integer;</div><div>&nbsp; &nbsp; n = 0;</div><div>&nbsp; &nbsp; do</div><div>&nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; n++;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; temp = (int)(temp / 10); &nbsp;//计算有几位整数位 n</div><div>&nbsp; &nbsp; }</div><div>&nbsp; &nbsp; while(temp != 0);</div><div>&nbsp;</div><div>&nbsp; &nbsp; temp = integer;</div><div>&nbsp; &nbsp; for( i = 0; i &lt; n ; i++)</div><div>&nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; *(str + n - 1 - i) = (uint8_t)(temp % 10) + '0'; //此处跳出</div><div>&nbsp; &nbsp; &nbsp; &nbsp; temp = (int)(temp / 10);</div><div>&nbsp; &nbsp; }</div><div>&nbsp; &nbsp; if( d == 0 )</div><div>&nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; *(str + i) = '\0';</div><div>&nbsp; &nbsp; }</div><div>&nbsp; &nbsp; else</div><div>&nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; *(str + i) = '.';</div><div>&nbsp; &nbsp; }</div><div>&nbsp; &nbsp; //小数部分</div><div>&nbsp; &nbsp; decimal = fl - integer;</div><div>&nbsp; &nbsp; for(i = n + 1; i &lt; d + n + 1 ; i++)</div><div>&nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; decimal = decimal * 10;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; *(str + i) = (uint8_t)(decimal) + '0';</div><div>&nbsp; &nbsp; &nbsp; &nbsp; decimal = decimal - (uint8_t)(decimal);</div><div>&nbsp; &nbsp; }</div><div>&nbsp; &nbsp; *(str + i) = '\0';</div><div>}</div>]]></description><category>STM32学习</category><comments>http://www.myradio168.net/wb/post/12.html#comment</comments><wfw:comment>http://www.myradio168.net/wb/</wfw:comment><wfw:commentRss>http://www.myradio168.net/wb/feed.asp?cmt=12</wfw:commentRss><trackback:ping>http://www.myradio168.net/wb/cmd.asp?act=tb&amp;id=12&amp;key=1cf911ef</trackback:ping></item><item><title>JLINK V8 固件烧写和修复说明 </title><author>a@b.com (shijy1977)</author><link>http://www.myradio168.net/wb/post/8.html</link><pubDate>Fri, 28 Sep 2012 11:17:23 +0800</pubDate><guid>http://www.myradio168.net/wb/post/8.html</guid><description><![CDATA[<p>1. 确保电路没有短路，没有开路。<br />2. 此时插上USB 线连上电脑，会出现无法识别的USB 设备 <br />3. 将板上的 ERASE 管脚用跳线接高电平超过20 秒，将芯片的全部FLASH 擦出。 <br />4. 拔掉USB线，也就是使板子断电。注意去掉ERASE 管跳线。 <br />5. 插上USB线，将TST管脚用跳线接高电平超过10秒，此时芯片拷贝BOOT 固件到第一启动区。<br />6. 拔掉USB线，也就是使板子断电。注意去掉TST管脚跳线。 <br />7. 在次插上USB时，电脑会发现新硬件，安装SAM-BA软件后，发现的新硬件会自动安装驱动。 <br />8. 打开SAM-BA软件，选择AT91SAM7S64-EK，点连接。<br />9. 在发送文件处，加入你要写入的JLINK V8固件，点发送。出现扇区解锁后，点&lsquo;是&rsquo;。此时就会开始下载固件。下载完后出现是否要加锁扇区，这里要点击&lsquo;否&rsquo;。如果点&lsquo;是&rsquo;，JLINK 将不能完成自动升级。 <br />10. 大功告成，重新连接USB后指示灯会闪动，安装上Jlink驱动后，就可以工作。</p>]]></description><category>STM32学习</category><comments>http://www.myradio168.net/wb/post/8.html#comment</comments><wfw:comment>http://www.myradio168.net/wb/</wfw:comment><wfw:commentRss>http://www.myradio168.net/wb/feed.asp?cmt=8</wfw:commentRss><trackback:ping>http://www.myradio168.net/wb/cmd.asp?act=tb&amp;id=8&amp;key=96fe9d56</trackback:ping></item></channel></rss>
