【ATmega4809 Curiosity Nano测评】按键
<div class='showpostmsg'><p>ATmega4809 Curiosity Nano上,按键使用了PF6,它也是RST引脚,默认设置是GPIO模式。因为PF6上有100K的上拉电阻R200,所以程序中可以不需要设置内部上拉。<br /> </p>
<p>下面的代码显示了按键的使用,按下ATmega4809 Curiosity Nano的按键后,LED亮。</p>
<p> </p>
<pre>
<code class="language-cpp">#include <avr/io.h>
int main(void) {
/* Replace with your application code */
PORTF.DIRSET |= (1<<5);
while (1) {
if(PORTF.IN & (1<<6))
PORTF.OUTSET |= (1<<5);
else
PORTF.OUTCLR |= (1<<5);
}
return 0;
}</code></pre>
<p><br />
<b><font color="#5E7384">此内容由EEWORLD论坛网友<font size="3">dcexpert</font>原创,如需转载或用于商业用途需征得作者同意并注明出处</font></b></p>
</div><script> var loginstr = '<div class="locked">查看本帖全部内容,请<a href="javascript:;" style="color:#e60000" class="loginf">登录</a>或者<a href="https://bbs.eeworld.com.cn/member.php?mod=register_eeworld.php&action=wechat" style="color:#e60000" target="_blank">注册</a></div>';
if(parseInt(discuz_uid)==0){
(function($){
var postHeight = getTextHeight(400);
$(".showpostmsg").html($(".showpostmsg").html());
$(".showpostmsg").after(loginstr);
$(".showpostmsg").css({height:postHeight,overflow:"hidden"});
})(jQuery);
} </script><script type="text/javascript">(function(d,c){var a=d.createElement("script"),m=d.getElementsByTagName("script"),eewurl="//counter.eeworld.com.cn/pv/count/";a.src=eewurl+c;m.parentNode.insertBefore(a,m)})(document,523)</script>
页:
[1]