|
直流電機仿真原理圖如下(proteus仿真工程文件可到本帖附件中下載)
0.png (12.41 KB, 下載次數(shù): 50)
下載附件
2018-5-13 17:13 上傳
0.png (47.11 KB, 下載次數(shù): 35)
下載附件
2018-5-13 17:13 上傳
直流電機正反轉(zhuǎn)單片機源程序如下:
- #include <reg52.h>
- #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)
- {
- uchar 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)%256;
- 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();
- }
- }
復(fù)制代碼
所有資料51hei提供下載:
直流電機Keil Proteus仿真.zip
(80.07 KB, 下載次數(shù): 43)
2018-5-13 16:13 上傳
點擊文件名下載附件
下載積分: 黑幣 -5
|
|