led.c

来自「avr mega128的源代码串口」· C语言 代码 · 共 29 行

C
29
字号
#include <iom128.h>
#include "global.h"
#include "uart.h"

/*
u8:       run
u7:       rf
u6:       tag
u5:       com data
*/
void initLed(void)
{
  DDRB = 0xf2;    //config portc as outport
  PORTB = 0xf2;   // init for '1' 
  
  PORTB &= 0x80;  //
}
void ledDriver(void)
{
//  unsigned char s[4];
  static unsigned char run=0;
  if(gc_counter>100)  //run led
  {
    gc_counter = 0;run = ~run;
    if(run == 0){ PORTB &= 0x7f;}
    else        { PORTB |= 0x80;}   
  } 
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?