• 大小: 147KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-01-05
  • 语言: VB
  • 标签: 上位机VB  

资源简介

用VB做上位机,可显示波曲线。用STC89C52做电机的MCU,L298驱动带速度反溃直流电机。PID算法在单片机和上位机中都已实现,PID三个参数都在上位机中调整

资源截图

代码片段和文件信息

#include “60S2.H“
#include “UART1.H“
#include “PWM.H“
#include “GetSpeed.H“
#include “Pid.H“


#define START 0xFF

xdata unsigned long int temp;

void RX_COM(void);

void main()
{
UART1_INIT();
PWM_INIT();
GetSpeed_INIT();
    Pid_Init(&motor1);
    Pid_Init(&motor2);
Pid_Add(&motor1);

EA=0;
    motor1.Set_val=0x190; //100 r/s
motor2.Set_val=0x190;
pid_en=1;
EA=1;


P2=0xf6;

while(1){
if(UART1_RX_flat==1)
{
RX_COM();
UART1_RX_flat=0;
}

if(GetSpeed_REF==1)
{
EA=0;

if(GetSpeed_th0==0xff)motor1.Get_val=0;
else{
temp=(GetSpeed_th0<<8)+GetSpeed_tl0;
temp=(0x1FFFE0)/temp;
motor1.Get_val=(temp&0xffff);
}

if(GetSpeed_th1==0xff)motor2.Get

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2011-08-06 15:53  PID调速\
     目录           0  2011-08-06 15:53  PID调速\STC12C5A60S2_24M\
     文件       17837  2011-07-24 17:01  PID调速\STC12C5A60S2_24M\60S2.h
     文件        2116  2011-07-30 22:54  PID调速\STC12C5A60S2_24M\GetSpeed.h
     文件       17536  2011-07-31 01:30  PID调速\STC12C5A60S2_24M\hot51
     文件        6240  2011-07-31 01:30  PID调速\STC12C5A60S2_24M\hot51.hex
     文件          41  2011-07-31 01:30  PID调速\STC12C5A60S2_24M\hot51.lnp
     文件       19761  2011-07-31 01:30  PID调速\STC12C5A60S2_24M\hot51.M51
     文件        1533  2011-07-31 01:32  PID调速\STC12C5A60S2_24M\hot51.Opt
     文件         202  2011-08-06 15:54  PID调速\STC12C5A60S2_24M\hot51.plg
     文件        2115  2011-07-30 02:45  PID调速\STC12C5A60S2_24M\hot51.Uv2
     文件        1527  2011-07-30 21:29  PID调速\STC12C5A60S2_24M\hot51_Opt.Bak
     文件        2099  2011-07-24 22:40  PID调速\STC12C5A60S2_24M\hot51_Uv2.Bak
     文件        2848  2011-07-31 01:20  PID调速\STC12C5A60S2_24M\main.c
     文件       58827  2011-07-31 01:30  PID调速\STC12C5A60S2_24M\main.LST
     文件       19975  2011-07-31 01:30  PID调速\STC12C5A60S2_24M\main.OBJ
     文件         941  2011-07-31 01:32  PID调速\STC12C5A60S2_24M\PID.H
     文件        3075  2011-07-30 00:53  PID调速\STC12C5A60S2_24M\PID01.H
     文件         595  2011-07-29 12:01  PID调速\STC12C5A60S2_24M\PWM.H
     文件         606  2011-07-30 09:13  PID调速\STC12C5A60S2_24M\UART1.h
     目录           0  2011-08-06 15:53  PID调速\VB\
     文件      952082  2011-07-31 00:05  PID调速\VB\000517_left.bmp
     文件      952082  2011-07-31 00:05  PID调速\VB\000517_right.bmp
     文件      952082  2011-07-30 23:55  PID调速\VB\235534_left.bmp
     文件      952082  2011-07-30 23:59  PID调速\VB\235941_left.bmp
     文件      952082  2011-07-30 23:59  PID调速\VB\235941_right.bmp
     文件       51057  2011-07-31 00:27  PID调速\VB\Form1.frm
     文件          74  2011-07-31 00:27  PID调速\VB\Form1.frx
     文件        4076  2011-07-25 18:21  PID调速\VB\Form2.frm
     文件        4930  2011-07-25 18:21  PID调速\VB\Form2.frx
     文件         488  2011-07-26 01:50  PID调速\VB\Module1.bas
............此处省略4个文件信息

评论

共有 条评论