91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 123KB
    文件類型: .zip
    金幣: 2
    下載: 2 次
    發布日期: 2021-05-14
  • 語言: 其他
  • 標簽: PLC??Qt??

資源簡介

Qt基于snap7第三方庫西門子PLC通信示例,附件中包括snap7.dll、snap7.lib、Qt示例源碼和配置文檔

資源截圖

代碼片段和文件信息

#include?“motioncontroll.h“
#include?“ui_motioncontroll.h“
#include?
#include?

#include?“snap7.h“

MotionControll::MotionControll(QWidget?*parent)?:
????QWidget(parent)
????ui(new?Ui::MotionControll)
{
????ui->setupUi(this);
????ptrPLC?=?new?TS7Client();

????ui->lineEdit_Distance->setDisabled(true);
????ui->btn_Stop->setstyleSheet(“background:rgb(20010070)“);
????m_bStatus?=?false;

????connect(&m_timer?SIGNAL(timeout())?this?SLOT(readHorisonVal()));
}

MotionControll::~MotionControll()
{
????delete?ui;
????m_timer.stop();
}

void?MotionControll::on_btn_Connect_clicked()
{
????if(!ptrPLC->Connected())
????{
????????int?res?=?ptrPLC->ConnectTo(“192.168.1.20“?0?1);
????????if(!res)
????????{
????????????ui->btn_Connect->setDisabled(true);
????????????m_timer.start(500);
????????}
????}
}

void?MotionControll::on_btn_RotateStart_clicked()
{
????if(ptrPLC->Connected())
????{
????????byte?buff?=?1;
????????ptrPLC->WriteArea(0x83?1?16?1?1?&buff);
????????ui->btn_RotateStart->setDisabled(true);
????????ui->btn_RotateStop->setDisabled(false);
????}
}

void?MotionControll::on_btn_RotateStop_clicked()
{
????if(ptrPLC->Connected())
????{
????????byte?buff?=?0;
????????ptrPLC->WriteArea(0x83?1?16?1?1?&buff);
????????ui->btn_RotateStart->setDisabled(true);
????????ui->btn_RotateStop->setDisabled(false);
????}
}


void?MotionControll::on_CheckBox_DistanceSet_stateChanged(int?arg1)
{
????if(ui->CheckBox_DistanceSet->isChecked())
????{
????????ui->lineEdit_Distance->setDisabled(false);
????}
????else
????{
????????ui->lineEdit_Distance->setDisabled(true);
????}
}


void?MotionControll::on_btn_GoEnd_clicked()
{
????//M201.5
????if(ptrPLC->Connected())
????{
????????byte?buff?=?1;
????????ptrPLC->WriteArea(0x83?1?1613?1?1?&buff);
????????buff?=?0;
????????ptrPLC->WriteArea(0x83?1?1613?1?1?&buff);
????}
}

void?MotionControll::on_btn_Stop_clicked()
{
????//M201.4
????if(ptrPLC->Connected())
????{
????????if(!m_bStatus)
????????{
????????????byte?buff?=?1;
????????????ptrPLC->WriteArea(0x83?1?1612?1?1?&buff);
????????????ui->btn_Stop->setstyleSheet(“background:rgb(02000)“);
????????????ui->btn_Stop->setText(“Continue“);
????????????m_bStatus?=?true;
????????}
????????else
????????{
????????????byte?buff?=?0;
????????????ptrPLC->WriteArea(0x83?1?1612?1?1?&buff);
????????????ui->btn_Stop->setstyleSheet(“background:rgb(20010070)“);
????????????ui->btn_Stop->setText(“Pause“);
????????????m_bStatus?=?false;
????????}
????}
}

void?MotionControll::on_btn_GoBeginMannul_pressed()
{
????//M200.2
????if(ptrPLC->Connected())
????{
????????byte?buff?=?1;
????????ptrPLC->WriteArea(0x83?1?1603?1?1?&buff);
????}
}

void?MotionControll::on_btn_GoBeginMannul_released()
{
????//M200.2
????if(ptrPLC->Connected())
????{
????????byte?buff?=?0;
????????ptrPLC->WriteArea(0x83?1?1603?1?1?&b

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2019-09-19?13:55??PLC通信\
?????文件????????5230??2019-09-18?09:27??PLC通信\motioncontroll.cpp
?????文件????????1046??2019-09-18?09:27??PLC通信\motioncontroll.h
?????文件????????3065??2019-09-18?09:27??PLC通信\motioncontroll.ui
?????目錄???????????0??2019-09-19?13:55??PLC通信\snap7\
?????文件??????244224??2019-09-12?13:45??PLC通信\snap7\snap7.dll
?????文件???????26188??2019-09-12?13:45??PLC通信\snap7\snap7.lib
?????文件???????30338??2019-09-18?09:27??PLC通信\snap7.cpp
?????文件???????41954??2019-09-18?09:27??PLC通信\snap7.h
?????文件?????????315??2019-10-05?20:18??PLC通信\庫添加.txt

評論

共有 條評論