Some time ago, when I was out shopping, I passed by a scrap collection station and saw an aunt dismantling parts from a machine. I didn't know what machine it was, but I suddenly saw her dismantling a round thing. I walked closer and saw that it was a motor with four wires. I thought it must be a stepper motor. Although it was old, the quality looked good, so I liked it very much. I asked the aunt how much it cost and wanted to buy it. The aunt said ten yuan, not a cent less. I had no choice but to pay ten yuan to buy this "iron block"! Due to time constraints, I have never had the opportunity to tinker with it. Today I have some time, so I took it out to study it.
After measurement, this is a two-phase four-wire stepper motor with a step angle of 1.8 degrees. There are two working modes. One is the 4-beat mode and the other is the 8-beat mode. The timing of the 4-beat mode is as follows:
a~ and b~ represent reverse currents.
ab - a~b - a~b~ - ab~ is one direction.
ab - ab~ - a~b~ - a~b is the opposite direction.
The timing of the 8-beat method is as follows:
A B C D E F G H (timing)
A 1 1 0 0 0 0 0 1
A- 0 0 0 1 1 1 0 0
B 0 1 1 1 0 0 0 0
B- 0 0 0 0 0 1 1 1
I use the 8-beat method here. Procedure:
/***
**********************************************************************
**Program function:
**Chip model: STC11F16XE
**Crystal frequency: 22.1184M
**Date of writing: October 2010
**Writer: wang QQ: 349259818 Email: hongfadg@163.com
**Remarks:
*******************************************************************/
//The following are the required header files
//#include
//#include
//#include
#include
//Define keywords for easy use
#define uchar unsigned char
#define uint unsigned int
#define ulong unsigned long
/*
sbit p10=P1^0;//The first group of motors
sbit p11=P1^1;
sbit p12=P1^2;//The first group of motor
sbits p13=P1^3;//The second group of motor
sbits p14=P1^4;
sbit p15=P1^5;//The second group of motors
*/
uchar step[]={0x25,0x2d,0x2c,0x2e,0x26,0x36,0x34,0x35};//Timing parameter table
/* Delay function
*******************************************************************
**Function prototype: void delay(void)
**Function function: delay function
**Input parameters: None
**Output parameters: None
**Remarks:
*******************************************************************/
void delay(void)
{
unsigned char a,b,c;
for(c=18;c>0;c--)
for(b=19;b>0;b--)
for(a=23;a>0;a-- );
}
/* Main function
****************************************************************
**Function prototype: main()
**Function function:
**Input parameters: None
**Output parameters: None
**Remarks: Complete the main functions of the program
*******************************************************************/
main()
{
unsigned char c;
while(1) //Main loop
{
for(c=0;c<8;c++)
{
P1=step[c]; //Motor drive
delay(); //Delay
}
}
}
[page]
Circuit Diagram:
Stepper motor driver board
Control Panel
Assemble the whole
Previous article:U-BOOT transplant experience
Next article:12864 LCD display without font library
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Using registers to do STM8 UART1 error request help
- BearPi-HM Nano Development Board Review 0 Unboxing and Development Environment Setup
- I found another DK IOT STUDIO online IDE that runs RAPID IOT. I guess they are the same but distributed on different websites.
- ECG-based heart rate monitoring using the LaunchPad Value Line development kit for the MSP430G2452 microcontroller
- [GD32L233C-START Review] - VII. SPI mode driving 1.5-inch OLED screen
- My creative plan and functional implementation plan
- The more I read, the more I like these sentences. Each sentence is more philosophical than the last, and each sentence is very inspiring.
- 【Want to buy】College students want to buy ATmega16 development board
- AC-DC controllers, gate drivers, digital isolators
- kernel make zImage compilation failed