000.c~

来自「stepper motor using l298 and MCU Atmega1」· C~ 代码 · 共 46 行

C~
46
字号
/*********************************************
Chip type           : ATmega128
Program type        : Application
Clock frequency     : 16.000000 MHz
Memory model        : Small
Internal SRAM size  : 4096
External SRAM size  : 0
Data Stack size     : 1024
*********************************************/

#include <mega16.h>              
#include <delay.h>

void main(void)
{

int i,j;
DDRB=0xFF;
PORTB=0x00;

while (1)
      {
      
      // Place your code here
       for(i=1;i<=25;i++)
       {
        for(j=1;j<=8;j=j*2)
        {
                PORTB=~j;
                delay_ms(200);
        }
       }   

       for(i=1;i<=25;i++)
       {
        for(j=8;j>=1;j=j/2)
        {
                PORTB=~j;
                delay_ms(200);
        }
       }  
        
      };
}

⌨️ 快捷键说明

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