Herunterladen Inhalt Inhalt Diese Seite drucken

Mitsubishi Electric MELFA CR750 Bedienungs- Und Programmieranleitung Seite 782

Industrieroboter
Inhaltsverzeichnis

Werbung

Beispielprogramme
long lng2[8];// Typ Ganze Zahl [% / non-unit].
} dat2;
unsigned short RecvType3;// Zuordnung der Antwortdaten Zusatz 3.
unsigned short reserve3; // Reserve 3
union rtdata3 {// Überwachungsdaten 3.
POSE pos3;// Typ XYZ [mm/rad].
JOINT jnt3;// Typ Gelenk [mm/rad].
PULSE pls3;// Typ Impuls [mm/rad] oder Typ Ganze Zahl [% / non-unit].
long lng3[8];// Typ Ganze Zahl [% / non-unit].
} dat3;
} MXTCMD;
Quelldatei sample.cpp
// sample.cpp
#include <windows.h>
#include <iostream.h>
#include <winsock.h>
#include <stdio.h>
#include <conio.h>
#include <string.h>
#include <math.h>
#include "strdef.h"
#define NO_FLAGS_SET 0
#define MAXBUFLEN 512
INT main(VOID)
{
WSADATA Data;
SOCKADDR_IN destSockAddr;
SOCKET destSocket;
unsigned long destAddr;
int status;
int numsnt;
int numrcv;
char sendText[MAXBUFLEN];
char recvText[MAXBUFLEN];
char dst_ip_address[MAXBUFLEN];
unsigned short port;
char msg[MAXBUFLEN];
char buf[MAXBUFLEN];
char type, type_mon[4];
unsigned short IOSendType;// Ein-/Ausgangssignalzuordnung für Datenübertragung
unsigned short IORecvType;// Ein-/Ausgangssignalzuordnung der Antwortdaten
unsigned short IOBitTop=0;
unsigned short IOBitMask=0xffff;
unsigned short IOBitData=0;
cout << " Input connection destination IP address (192.168.0.1) ->";
cin.getline(dst_ip_address, MAXBUFLEN);
if(dst_ip_address[0]==0) strcpy(dst_ip_address, "192.168.0.1");
cout << " Input connection destination port No. (10000) -> ";
cin.getline(msg, MAXBUFLEN);
if(msg[0]!=0) port=atoi(msg);
else port=10000;
cout << " Use input/output signal?([Y] / [N])-> ";
cin.getline(msg, MAXBUFLEN);
if(msg[0]!=0 && (msg[0]=='Y' || msg[0]=='y')) {
cout << "What is target? Input signal/output signal([I]nput / [O]utput)-> ";
cin.getline(msg, MAXBUFLEN);
11 - 16
Programmfunktionen und -beispiele

Werbung

Inhaltsverzeichnis
loading

Inhaltsverzeichnis