⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 000.c

📁 Controlling stepper motor by AVR (Proteus simulation included)
💻 C
字号:
/*********************************************
Chip type           : ATmega128
Program type        : Application
Clock frequency     : 8.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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -