L298N is a high-voltage, high-current motor driver chip produced by ST Company. The chip is packaged in a 15- pin package. The main features are: high working voltage, the maximum working voltage can reach 46V ; large output current, the instantaneous peak current can reach 3A , the continuous working current is 2A ; the rated power is 25W . A high-voltage and high-current full-bridge driver containing two H- bridges, which can be used to drive DC motors, stepper motors, relay coils and other inductive loads; it adopts standard logic level signal control; it has two enable control terminals. There is a logic power input terminal to allow or disable the device to work without being affected by the input signal, so that the internal logic circuit part works at a low voltage; an external detection resistor can be connected to feed back the change to the control circuit. Use the L298N chip to drive the motor. This chip can drive a two-phase stepper motor or a four-phase stepper motor, or two DC motors.
A brief description:
1. Size: 80mmX45mm
2. Main chips: L298N , optocoupler
3. Working voltage: control signal DC 5V ; motor voltage DC 3V~46V (it is recommended to use below 36V )
4. Maximum working current: 2.5A
5. Rated power: 25W
Features: 1. With signal indication.
2. The speed is adjustable
3. Strong anti-interference ability
4. With over-voltage and over-current protection
5. Can control two DC motors independently
6. Can control a stepper motor independently
7. PWM pulse width smooth speed regulation
8. Can realize forward and reverse rotation
9. Use photoelectric isolation
The stepper motor rotates 1.8 degrees every time you press it
#include<reg52.h>
/****************************************************** ****************/
/*Suppose the last four digits of the program, 1111, correspond to ABCD, and 0000 is abcd. Then the stepper motor can be subdivided into the following combinations
Abcd》aBcd》abCd》abcD The corresponding array is 0x08,0x04,0x02,0x01
The corresponding array of ABcd》aBCd》abCD》AbcD is 0x0C,0x06,0x03,0x09
ABcd》aBcd》aBCd》abCd》abCD》abcD》AbcD》AbcD The corresponding array is 0x0C,0x04,0x06,0x02,0x03,0x01,0x09,0x08
As long as the power is turned on in the order of ABCD, various combinations of products can be produced.
/****************************************************** ****************/
code unsigned char run[8]={0x03,0x0b,0x09,0x0d,0x0c,0x0e,0x06,0x07};
unsigned char a,s,i,j,k;
sbit ANJIAN=P2^0;
void delay(i)//delay function
{
for(j=0;j<i;j++)
for(k=0;k<250;k++);
}
main()
{
unsigned char z,y;
y=10; //Define the delay time. The longer the time, the slower the motor speed and vice versa.
a=0;
while(1)
{
if(ANJIAN==0)
{
a++;
while(!ANJIAN);
//delay(y);
switch(a)
{
case 1:P1=run[0];delay(y);break;//P1=run[1];delay(y);break;
case 2:P1=run[2];delay(y);break;//P1=run[3];delay(y);break;
case 3:P1=run[4];delay(y);break;//P1=run[5];delay(y);break;
case 4:P1=run[6];delay(y);break;//P1=run[7];delay(y);break;
case 5:P1=run[0];delay(y);break;//P1=run[1];delay(y);break;
case 6:P1=run[2];delay(y);break;//P1=run[3];delay(y);break;
case 7:P1=run[4];delay(y);break;//P1=run[5];delay(y);break;
case 8:P1=run[2];delay(y);break;//P1=run[3];delay(y);break;
case 9:P1=run[0];delay(y);break;//P1=run[1];delay(y);break;
case 10:P1=run[6];delay(y);break;//P1=run[7];delay(y);break;
case 11:P1=run[4];delay(y);break;//P1=run[5];delay(y);break;
case 12:P1=run[2];delay(y);break;//P1=run[3];delay(y);break;
case 13:P1=run[0];delay(y);break;//P1=run[1];delay(y);break;
case 14:a=0;break;
default:break;
}
}
}
}
All reference designs on this site are sourced from major semiconductor manufacturers or collected online for learning and research. The copyright belongs to the semiconductor manufacturer or the original author. If you believe that the reference design of this site infringes upon your relevant rights and interests, please send us a rights notice. As a neutral platform service provider, we will take measures to delete the relevant content in accordance with relevant laws after receiving the relevant notice from the rights holder. Please send relevant notifications to email: bbs_service@eeworld.com.cn.
It is your responsibility to test the circuit yourself and determine its suitability for you. EEWorld will not be liable for direct, indirect, special, incidental, consequential or punitive damages arising from any cause or anything connected to any reference design used.
Supported by EEWorld Datasheet