| 
  
| 感谢21ic组织的活动,板子收到好多天了,今天是第二次打开,沉金工艺,第一眼看到这个板子,我就非常的喜欢,加上这个不需要额外的仿真器支持,更让开发的难度降低了很多。 1、先看板与盒子:再说一下这个板子,真心喜欢,沉金加红色,太靓了,我手上的板子都没有一块比的上这个,绝配,一定要当宝贝,都舍不得上锡。
 
 
 
 
 
 2.上原理图
 PF5是接的LED,PF6是接的按键。
 
 3、上LED闪烁代码:
 uint8_t counter;
 /* button init */
 PORTF.DIRCLR = PIN6_bm; /* set PF6 as input */
 PORTF.PIN6CTRL = PORT_PULLUPEN_bm; /* enable internal pull-up */
 /* LED init */
 PORTF.OUTSET = PIN5_bm; /* LED is turned off */
 PORTF.DIRSET = PIN5_bm; /* set PF5 as output */
 
 while (1)
 {
 if (!(PORTF.IN & PIN6_bm)) /* check PF6 button is pressed */
 {
 counter = 0;
 while (!(PORTF.IN & PIN6_bm)) /* wait until PF6 button is released */
 {
 _delay_ms(STEP_DELAY);
 counter++;
 if (counter >= THRESHOLD)
 {
 LED_blink(SLOW_BLINK, NUMBER_OF_BLINKS);
 while (!(PORTF.IN & PIN6_bm));  /* wait until PF6 button is released */
 break;
 }
 }
 if (counter < THRESHOLD)
 {
 LED_blink(FAST_BLINK, NUMBER_OF_BLINKS);
 }
 
 4.点PF5,LED0灯
 PORTF.OUTTGL = PIN5_bm;
 _delay_ms(500);
 
 5.点灯图:
 
 6.闪烁视频
 
 
 | 
 
×本帖子中包含更多资源您需要 登录 才可以下载或查看,没有账号?注册 
  |