Proteus simulation diagram and source code of DC motor control

Publisher:心连心意Latest update time:2018-10-06 Source: eefocus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1. Simulate the proteus diagram and run it directly:



Proteus simulation diagram and source code of DC motor control

2. 51 MCU source code, keil development environment:


#include


#define uchar unsigned char


#define uint unsigned int


sbit IN1 = P2^0;


sbit IN2 = P2^1;


sbit PWM = P2^2;


sbit Key1 = P1^7;


sbit Key2 = P1^6;


sbit Key3 = P1^5;


sbit Key4 = P1^4;


sbit Key5 = P1^3;


uint t = 46082;


void delay_ms(uchar t)


{


fly x,y;


for(x = t;x > 0;x--)


for(y = 110;y > 0;y--);


}


void Timer0_Init()


{


TMOD = 0X01;


TH0 = (65536 - 46082)/256;


TL0 = (65536 - 46082)%6;


EA = 1 ;


ET0 = 1;


TR0 = 1;


}


void Positive_Rotation()


{


IN1 = 0;


IN2 = 1;


}


void Reverse_Rotation()

{


IN1 = 1;


IN2 = 0;


}


void Stop_Rotation()


{


IN1 = 1;


IN2 = 1;


}


void Key_Scan()


{


if(Key1 == 0)


{


delay_ms(20);


if(Key1 == 0)


{


Positive_Rotation();


}


}


else if(Key2 == 0)


{


delay_ms(20);


if(Key2 == 0)


{


Reverse_Rotation();


}


}


else if(Key3 == 0)


{


delay_ms(20);


if(Key3 == 0)


{


Stop_Rotation();


}


}


else if(Key4 == 0)


{


delay_ms(20);


if(Key4 == 0)


{


t = t + 100;


if(t > 65000)


t = 65000;


}


}


else if(Key5 == 0)


{


delay_ms(20);


if(Key5 == 0)


{


t = t - 100;


if(t < 500)


t = 500;


}


}


}


void main()


{


Timer0_Init();


while(1)


{


Key_Scan();


}


}


void timer0() interrupt 1


{


TH0 = t/256;


TL0 = t%6;


PWM = ~PWM;


}


Download address of Proteus simulation diagram and source code package file of DC motor control:


Link:https://pan.baidu.com/s/1dbb8EpFazh_FmQ7DWpOfxQ  Password: ooee


Reference address:Proteus simulation diagram and source code of DC motor control

Previous article:Application of DS1302 clock chip in single chip perpetual calendar
Next article:KEILC51 compilation problem ERRORL104: MULTIPLEPUBLICDEFINITIONS repeated definition

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

Implementation of breathing light based on PIC16F877A + Proteus simulation
Preface While learning the PWM module, I saw few posts about the breathing light of PIC microcontroller in the forum, so I tried to do this experiment myself. Because I am learning the CCP module of PIC 16F877A recently, I thought that the PIC microcontroller has an integrated hardware PWM module, and such a good func
[Microcontroller]
Implementation of breathing light based on PIC16F877A + Proteus simulation
Würth Elektronik releases new radio modules - Proteus-III and Thyone-I
Two flexible 2.4 GHz radio applications: Würth Elektronik has released the Bluetooth Low Energy (BLE) 5.1 module Proteus-III and a proprietary version Thyone-I. The module measures only 8×12×2mm and has an integrated antenna, encryption technology and six configurable IO pins. It is based on the nRF52840 chipset from
[Embedded]
Würth Elektronik releases new radio modules - Proteus-III and Thyone-I
The use of single chip microcomputer simulation software proteus
1. How to use templates in proteus file--〉new design: In the pop-up dialog box, you can select a template. file--〉save design as template… and you can save your template. Open or create a circuit that you often use . Save as a template, that is: save as template to replace TemplatesDefault.DTF in the default fold
[Microcontroller]
Design and Proteus simulation of multi-channel servo control PWM generator
Abstract: PWM pulse width signal modulation is a kind of pulse signal widely used in modern electronics industry, and its typical application is steering gear control. Based on Proteus and Keil software, this paper introduces the implementation method of using 51 single-chip microcomputer to generate multiple PWM pu
[Industrial Control]
Design and Proteus simulation of multi-channel servo control PWM generator
Based on 1602 LCD voltage driver applied in proteus simulation
This example uses 1602 driven by 5V voltage, with backlight, can display two lines, 16 characters per line, cannot display Chinese characters, has a built-in ASCII character set library containing 128 characters, only has a parallel interface, no serial interface. Analyzing the timing diagram, we can see that the pro
[Power Management]
Based on 1602 LCD voltage driver applied in proteus simulation
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号