Proteus simulation of MCU driving 4-phase stepper motor

Publisher:tgdddtLatest update time:2015-02-09 Source: 51heiKeywords:MCU Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

The IO driving capability of the microcontroller is not enough, so the ULN2003 driver is used.

It adopts 4-phase 8-beat drive mode. The stepper motor is motor-stepper in proteus. The connection method is: the middle lead is connected to the power supply, and the other legs can be connected clockwise or counterclockwise.




The procedure is as follows:

#include
#define uchar unsigned char
#define uint unsigned int
void delay(uint a);
const uchar step_table[]={0x04,0x0c,0x08,0x18,0x10,0x30,0x20,0x24};//4相8拍方式
void main()
{
uint i,j;
j=300;
while(j--)
{
for(i=0;i<8;i++)
{
P0=step_table[i];
delay(1);
}
}
while(1);
}
void delay(uint a)
{
uint i,j;
for(i=a;i>0;i--)
for(j=122;j>0;j--);
}

Keywords:MCU Reference address:Proteus simulation of MCU driving 4-phase stepper motor

Previous article:C51--DS18B20 digital thermometer--C language
Next article:51 microcontroller 2-way servo driver (timer method)

Recommended ReadingLatest update time:2024-11-16 22:22

ROM and RAM How does the microcontroller execute step by step after power is turned on?
ROM: (Read Only Memory) Program memory Used to store program data and constant data or variable data in the microcontroller. All codes in c files and h files, global variables, local variables, constant data defined by the 'const' qualifier, and codes in the startup.asm file (similar to the bootloader in ARM or the BI
[Microcontroller]
Hardware design of gas flow meter detector based on C8051F350 microcontroller
Gas flow meter is a commonly used instrument equipment. The bell-type gas flow standard device is a measurement standard device that uses air as the medium to verify, calibrate and detect gas flow meters. It is mainly suitable for the verification, calibration and type evaluation of speed, volumetric and differential
[Microcontroller]
Hardware design of gas flow meter detector based on C8051F350 microcontroller
Matrix keyboard driver for single chip microcomputer
#include reg52.h   #define KEYPORT P1 #include "./delay/delay.h"   sbit seg_select = P2^0; //segment selection sbit bit_select = P2^1; //bit selection #define SEGPORT  P0     unsigned char segdata = {0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f}; unsigned char bitdata = {0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f}
[Microcontroller]
Microcontroller C language programming: 10s stopwatch
/* Name: 10s stopwatch         Note: The first press starts the timing, the second press pauses, and the third press resets the timing. */ #include reg51.h #define uchar unsigned char #define uint unsigned int sbit K1=P3^7; uchar i,Second_Counts,Key_Flag_Idx; bit Key_State; uchar     DSY_CODE
[Microcontroller]
Microcontroller C language programming: 10s stopwatch
Performance comparison and analysis of 51 MCU, PIC MCU and AVR MCU
The 8-bit single-chip microcomputer is widely used in some simple controllers due to its simple internal structure, small size and low cost. Even in this century, it still occupies a considerable share in the application of single-chip microcomputers. Due to the wide variety of 8-bit single-chip microcomputers, this a
[Microcontroller]
Performance comparison and analysis of 51 MCU, PIC MCU and AVR MCU
P87LPC762 MCU writes CC1000 internal register program
The procedure for writing CC 1000 internal registers of P87LPC762 microcontroller is as follows: C Program write_com(uchar addr,uchar com_data) //Write internal register Device Subroutine { char i; addr =1; pale=0; //Allow address latching for(i=0;i 7;i++) { //Send address addr =1; p_data=CY; pclk=0; // rising edg
[Microcontroller]
STC single chip microcomputer uses digital tube to display I love you (keyboard version)
  #include stc12c5a.h #define uchar unsigned char #define uint unsigned int uchar led ={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f}; uchar key ={0xfe,0xfd,0xfb}; unsigned char get() {    uchar x,y,lie,i;    x=0;y=0;    for(i=0;i 3;i++)    {       P1=key ;   lie=P1&0x38;   if(lie
[Microcontroller]
STC single chip microcomputer uses digital tube to display I love you (keyboard version)
Reading the commonly used instructions of PIC8-bit single-chip assembly language
The instruction system of each major category of single-chip microcomputer is not universal. It is stipulated by the single-chip microcomputer manufacturer, so users must follow the standards stipulated by the manufacturer to achieve the purpose of using the single-chip microcomputer. There are three levels of PIC 8-
[Microcontroller]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号