diff --git a/HSI_HexagonMI_EF3.sln b/HSI_HexagonMI_EF3.sln index ff0b6e3..88ffb57 100644 --- a/HSI_HexagonMI_EF3.sln +++ b/HSI_HexagonMI_EF3.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.28307.2017 +# Visual Studio Version 17 +VisualStudioVersion = 17.3.32922.545 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HSI_Sevenocean_EF1", "..\EF3-Interfac\PcDmis\Base\Interfac\Msi\Hsi\Tools\UsbUtility\HSI_Sevenocean_EF1\HSI_Sevenocean_EF1.vcxproj", "{09F6ECED-CD30-4ACA-BD5E-FFB4F53C353A}" EndProject @@ -18,6 +18,11 @@ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WPFSerialAssistant", "SerialAssistant\WPFSerialAssistant\WPFSerialAssistant.csproj", "{DA01B86D-5BC1-4863-BAAC-71B309B09CC0}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HSI_SEVENOCEAN_EF1_CsTest", "HSI_SEVENOCEAN_EF1_CsTest\HSI_SEVENOCEAN_EF1_CsTest.csproj", "{7ED499CB-651C-4154-9741-EEF347BDBFB5}" + ProjectSection(ProjectDependencies) = postProject + {ECCF081D-DDA4-49D5-A03F-9DD5AB8B666B} = {ECCF081D-DDA4-49D5-A03F-9DD5AB8B666B} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ACSPL_VS2017", "C:\Program Files (x86)\ACS Motion Control\SPiiPlus ADK Suite v3.02\ACSC\C_CPP\Samples\Reciprocated\ACSPL\ACSPL_VS2017.vcxproj", "{26BA6D1A-E94D-46EE-A361-2D1AFDB2338A}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -111,6 +116,18 @@ Global {7ED499CB-651C-4154-9741-EEF347BDBFB5}.Release|x64.Build.0 = Release|Any CPU {7ED499CB-651C-4154-9741-EEF347BDBFB5}.Release|x86.ActiveCfg = Release|x86 {7ED499CB-651C-4154-9741-EEF347BDBFB5}.Release|x86.Build.0 = Release|x86 + {26BA6D1A-E94D-46EE-A361-2D1AFDB2338A}.Debug|Any CPU.ActiveCfg = Debug|x64 + {26BA6D1A-E94D-46EE-A361-2D1AFDB2338A}.Debug|Any CPU.Build.0 = Debug|x64 + {26BA6D1A-E94D-46EE-A361-2D1AFDB2338A}.Debug|x64.ActiveCfg = Debug|x64 + {26BA6D1A-E94D-46EE-A361-2D1AFDB2338A}.Debug|x64.Build.0 = Debug|x64 + {26BA6D1A-E94D-46EE-A361-2D1AFDB2338A}.Debug|x86.ActiveCfg = Debug|Win32 + {26BA6D1A-E94D-46EE-A361-2D1AFDB2338A}.Debug|x86.Build.0 = Debug|Win32 + {26BA6D1A-E94D-46EE-A361-2D1AFDB2338A}.Release|Any CPU.ActiveCfg = Release|x64 + {26BA6D1A-E94D-46EE-A361-2D1AFDB2338A}.Release|Any CPU.Build.0 = Release|x64 + {26BA6D1A-E94D-46EE-A361-2D1AFDB2338A}.Release|x64.ActiveCfg = Release|x64 + {26BA6D1A-E94D-46EE-A361-2D1AFDB2338A}.Release|x64.Build.0 = Release|x64 + {26BA6D1A-E94D-46EE-A361-2D1AFDB2338A}.Release|x86.ActiveCfg = Release|Win32 + {26BA6D1A-E94D-46EE-A361-2D1AFDB2338A}.Release|x86.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/HSI_HexagonMI_EF3/ACS/ACSC.h b/HSI_HexagonMI_EF3/ACS/ACSC.h new file mode 100644 index 0000000..d435e89 --- /dev/null +++ b/HSI_HexagonMI_EF3/ACS/ACSC.h @@ -0,0 +1,3683 @@ +////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ACS Motion Control Ltd. +// Copyright ?1999 - 2020. All Rights Reserved. +// +// PROJECT : SPiiPlus +// SUBSYSTEM : SPiiPlus C Library +// FILE : ACSC.h +// VERSION : 6.71.0.0 +// OVERVIEW +// ======== +// +// SPiiPlus C Library export functions definition +// +////////////////////////////////////////////////////////////////////////////////////////////////// +#ifndef _ACSC_H_ +#define _ACSC_H_ +#if defined(_WIN32) && !defined(UNDER_RTSS) +// For compilation targets 32-bit ARM, 64-bit ARM, x86, or x64 +#include +#include +#include +#elif defined(_WIN32) && defined(UNDER_RTSS) +// RTX +#include +#include +#endif +#include +////////////////////////////////////////////////////////////////////////////////////////////////// +// General definitions +////////////////////////////////////////////////////////////////////////////////////////////////// +#define ACSC_VER 0x6470000 +#define ACSC_MAXCHANNEL 10 //Maximum number of communication channels +#define ACSC_INVALID (HANDLE)-1 //Invalid communication handle +#define ACSC_NONE -1 +#define ACSC_INT_BINARY 4 //Size of the controller integer variable +#define ACSC_REAL_BINARY 8 //Size of the controller real variable +#define ACSC_FILE -2 +#define ACSC_DEFAULT_REMOTE_PORT 9999 +#define ACSC_AXES_MAX_NUMBER 64 //Maximum number of supported axes +#define ACSC_BUFFERS_MAX_NUMBER 65 //Maximum number of supported buffers (including D-Buffer) +#define ACSC_SP_MAX_NUMBER 64 //Maximum number of supported Servo Processors (SP) +#define ACSC_DC_VAR_MAX_NUMBER 10 //Maximum number of variables to be collected by one command +#define ACSC_MAX_LINE 100000 //Maximum number of lines in program buffer +#define ACSC_COUNTERCLOCKWISE 1 //Counterclockwise rotation +#define ACSC_CLOCKWISE -1 //Clockwise rotation +#define ACSC_POSITIVE_DIRECTION 1 //A move in positive direction +#define ACSC_NEGATIVE_DIRECTION -1 //A move in negative direction +// for compatibility with the previous library +#define MAXCHANNEL 10 +// Set/Get configuration keys +#define ACSC_CONF_WORD1_KEY 1 +#define ACSC_CONF_INT_EDGE_KEY 3 +#define ACSC_CONF_ENCODER_KEY 4 +#define ACSC_CONF_MFLAGS9_KEY 204 +#define ACSC_CONF_DIGITAL_SOURCE_KEY 205 +#define ACSC_CONF_SP_OUT_PINS_KEY 206 +#define ACSC_CONF_OUT_KEY 29 +#define ACSC_CONF_BRAKE_OUT_KEY 229 +// System Information keys +#define ACSC_SYS_MODEL_KEY 1 +#define ACSC_SYS_VERSION_KEY 2 +#define ACSC_SYS_NBUFFERS_KEY 10 +#define ACSC_SYS_DBUF_INDEX_KEY 11 +#define ACSC_SYS_NAXES_KEY 13 +#define ACSC_SYS_NNODES_KEY 14 +#define ACSC_SYS_NDCCH_KEY 15 +#define ACSC_SYS_ECAT_KEY 16 +////////////////////////////////////////////////////////////////////////////////////////////////// +// ACSPL+ variables types +////////////////////////////////////////////////////////////////////////////////////////////////// +#define ACSC_INT_TYPE 1 //Integer type of the variable (Decimal representation) +#define ACSC_REAL_TYPE 2 //Real type of the variable (Decimal representation) +////////////////////////////////////////////////////////////////////////////////////////////////// +// Represintation types of file stored variables +////////////////////////////////////////////////////////////////////////////////////////////////// +#define ACSC_DEC_REAL_TYPE 8 //Decimal representation of Real type variable +#define ACSC_DEC_INT_TYPE 4 //Decimal representation of Integer type variable +#define ACSC_BIN_INT_TYPE 2 //Binary representation of Integer type variable +#define ACSC_OCT_INT_TYPE 1 //Octal representation of Integer type variable +#define ACSC_HEX_INT_TYPE 16 //Hexadecimal representation of Integer type variable +////////////////////////////////////////////////////////////////////////////////////////////////// +// Serial communication options +////////////////////////////////////////////////////////////////////////////////////////////////// +#define ACSC_AUTO -1 +////////////////////////////////////////////////////////////////////////////////////////////////// +// Ethernet communication options +////////////////////////////////////////////////////////////////////////////////////////////////// +#define ACSC_SOCKET_DGRAM_PORT 700 +#define ACSC_SOCKET_STREAM_PORT 701 +////////////////////////////////////////////////////////////////////////////////////////////////// +// Old Axes Definitions +////////////////////////////////////////////////////////////////////////////////////////////////// +#define ACSC_AXIS_X 0 +#define ACSC_AXIS_Y 1 +#define ACSC_AXIS_Z 2 +#define ACSC_AXIS_T 3 +#define ACSC_AXIS_A 4 +#define ACSC_AXIS_B 5 +#define ACSC_AXIS_C 6 +#define ACSC_AXIS_D 7 +////////////////////////////////////////////////////////////////////////////////////////////////// +// New Axes Definitions +////////////////////////////////////////////////////////////////////////////////////////////////// +#define ACSC_PAR_ALL -2 +#define ACSC_SYSTEM -3 +#define ACSC_AXIS_0 0 +#define ACSC_AXIS_1 1 +#define ACSC_AXIS_2 2 +#define ACSC_AXIS_3 3 +#define ACSC_AXIS_4 4 +#define ACSC_AXIS_5 5 +#define ACSC_AXIS_6 6 +#define ACSC_AXIS_7 7 +#define ACSC_AXIS_8 8 +#define ACSC_AXIS_9 9 +#define ACSC_AXIS_10 10 +#define ACSC_AXIS_11 11 +#define ACSC_AXIS_12 12 +#define ACSC_AXIS_13 13 +#define ACSC_AXIS_14 14 +#define ACSC_AXIS_15 15 +#define ACSC_AXIS_16 16 +#define ACSC_AXIS_17 17 +#define ACSC_AXIS_18 18 +#define ACSC_AXIS_19 19 +#define ACSC_AXIS_20 20 +#define ACSC_AXIS_21 21 +#define ACSC_AXIS_22 22 +#define ACSC_AXIS_23 23 +#define ACSC_AXIS_24 24 +#define ACSC_AXIS_25 25 +#define ACSC_AXIS_26 26 +#define ACSC_AXIS_27 27 +#define ACSC_AXIS_28 28 +#define ACSC_AXIS_29 29 +#define ACSC_AXIS_30 30 +#define ACSC_AXIS_31 31 +#define ACSC_AXIS_32 32 +#define ACSC_AXIS_33 33 +#define ACSC_AXIS_34 34 +#define ACSC_AXIS_35 35 +#define ACSC_AXIS_36 36 +#define ACSC_AXIS_37 37 +#define ACSC_AXIS_38 38 +#define ACSC_AXIS_39 39 +#define ACSC_AXIS_40 40 +#define ACSC_AXIS_41 41 +#define ACSC_AXIS_42 42 +#define ACSC_AXIS_43 43 +#define ACSC_AXIS_44 44 +#define ACSC_AXIS_45 45 +#define ACSC_AXIS_46 46 +#define ACSC_AXIS_47 47 +#define ACSC_AXIS_48 48 +#define ACSC_AXIS_49 49 +#define ACSC_AXIS_50 50 +#define ACSC_AXIS_51 51 +#define ACSC_AXIS_52 52 +#define ACSC_AXIS_53 53 +#define ACSC_AXIS_54 54 +#define ACSC_AXIS_55 55 +#define ACSC_AXIS_56 56 +#define ACSC_AXIS_57 57 +#define ACSC_AXIS_58 58 +#define ACSC_AXIS_59 59 +#define ACSC_AXIS_60 60 +#define ACSC_AXIS_61 61 +#define ACSC_AXIS_62 62 +#define ACSC_AXIS_63 63 +////////////////////////////////////////////////////////////////////////////////////////////////// +// Buffers Definitions +////////////////////////////////////////////////////////////////////////////////////////////////// +#define ACSC_BUFFER_ALL -2 +#define ACSC_BUFFER_0 0 +#define ACSC_BUFFER_1 1 +#define ACSC_BUFFER_2 2 +#define ACSC_BUFFER_3 3 +#define ACSC_BUFFER_4 4 +#define ACSC_BUFFER_5 5 +#define ACSC_BUFFER_6 6 +#define ACSC_BUFFER_7 7 +#define ACSC_BUFFER_8 8 +#define ACSC_BUFFER_9 9 +#define ACSC_BUFFER_10 10 +#define ACSC_BUFFER_11 11 +#define ACSC_BUFFER_12 12 +#define ACSC_BUFFER_13 13 +#define ACSC_BUFFER_14 14 +#define ACSC_BUFFER_15 15 +#define ACSC_BUFFER_16 16 +#define ACSC_BUFFER_17 17 +#define ACSC_BUFFER_18 18 +#define ACSC_BUFFER_19 19 +#define ACSC_BUFFER_20 20 +#define ACSC_BUFFER_21 21 +#define ACSC_BUFFER_22 22 +#define ACSC_BUFFER_23 23 +#define ACSC_BUFFER_24 24 +#define ACSC_BUFFER_25 25 +#define ACSC_BUFFER_26 26 +#define ACSC_BUFFER_27 27 +#define ACSC_BUFFER_28 28 +#define ACSC_BUFFER_29 29 +#define ACSC_BUFFER_30 30 +#define ACSC_BUFFER_31 31 +#define ACSC_BUFFER_32 32 +#define ACSC_BUFFER_33 33 +#define ACSC_BUFFER_34 34 +#define ACSC_BUFFER_35 35 +#define ACSC_BUFFER_36 36 +#define ACSC_BUFFER_37 37 +#define ACSC_BUFFER_38 38 +#define ACSC_BUFFER_39 39 +#define ACSC_BUFFER_40 40 +#define ACSC_BUFFER_41 41 +#define ACSC_BUFFER_42 42 +#define ACSC_BUFFER_43 43 +#define ACSC_BUFFER_44 44 +#define ACSC_BUFFER_45 45 +#define ACSC_BUFFER_46 46 +#define ACSC_BUFFER_47 47 +#define ACSC_BUFFER_48 48 +#define ACSC_BUFFER_49 49 +#define ACSC_BUFFER_50 50 +#define ACSC_BUFFER_51 51 +#define ACSC_BUFFER_52 52 +#define ACSC_BUFFER_53 53 +#define ACSC_BUFFER_54 54 +#define ACSC_BUFFER_55 55 +#define ACSC_BUFFER_56 56 +#define ACSC_BUFFER_57 57 +#define ACSC_BUFFER_58 58 +#define ACSC_BUFFER_59 59 +#define ACSC_BUFFER_60 60 +#define ACSC_BUFFER_61 61 +#define ACSC_BUFFER_62 62 +#define ACSC_BUFFER_63 63 +#define ACSC_BUFFER_64 64 +////////////////////////////////////////////////////////////////////////////////////////////////// +// Servo Processors Definitions +////////////////////////////////////////////////////////////////////////////////////////////////// +#define ACSC_SP_ALL -2 +#define ACSC_SP_0 0 +#define ACSC_SP_1 1 +#define ACSC_SP_2 2 +#define ACSC_SP_3 3 +#define ACSC_SP_4 4 +#define ACSC_SP_5 5 +#define ACSC_SP_6 6 +#define ACSC_SP_7 7 +#define ACSC_SP_8 8 +#define ACSC_SP_9 9 +#define ACSC_SP_10 10 +#define ACSC_SP_11 11 +#define ACSC_SP_12 12 +#define ACSC_SP_13 13 +#define ACSC_SP_14 14 +#define ACSC_SP_15 15 +#define ACSC_SP_16 16 +#define ACSC_SP_17 17 +#define ACSC_SP_18 18 +#define ACSC_SP_19 19 +#define ACSC_SP_20 20 +#define ACSC_SP_21 21 +#define ACSC_SP_22 22 +#define ACSC_SP_23 23 +#define ACSC_SP_24 24 +#define ACSC_SP_25 25 +#define ACSC_SP_26 26 +#define ACSC_SP_27 27 +#define ACSC_SP_28 28 +#define ACSC_SP_29 29 +#define ACSC_SP_30 30 +#define ACSC_SP_31 31 +#define ACSC_SP_32 32 +#define ACSC_SP_33 33 +#define ACSC_SP_34 34 +#define ACSC_SP_35 35 +#define ACSC_SP_36 36 +#define ACSC_SP_37 37 +#define ACSC_SP_38 38 +#define ACSC_SP_39 39 +#define ACSC_SP_40 40 +#define ACSC_SP_41 41 +#define ACSC_SP_42 42 +#define ACSC_SP_43 43 +#define ACSC_SP_44 44 +#define ACSC_SP_45 45 +#define ACSC_SP_46 46 +#define ACSC_SP_47 47 +#define ACSC_SP_48 48 +#define ACSC_SP_49 49 +#define ACSC_SP_50 50 +#define ACSC_SP_51 51 +#define ACSC_SP_52 52 +#define ACSC_SP_53 53 +#define ACSC_SP_54 54 +#define ACSC_SP_55 55 +#define ACSC_SP_56 56 +#define ACSC_SP_57 57 +#define ACSC_SP_58 58 +#define ACSC_SP_59 59 +#define ACSC_SP_60 60 +#define ACSC_SP_61 61 +#define ACSC_SP_62 62 +#define ACSC_SP_63 63 +////////////////////////////////////////////////////////////////////////////////////////////////// +// PCI interrupts flags +////////////////////////////////////////////////////////////////////////////////////////////////// +#define ACSC_INTR_PEG 3 +#define ACSC_INTR_MARK1 7 +#define ACSC_INTR_MARK2 8 +#define ACSC_INTR_EMERGENCY 15 +#define ACSC_INTR_PHYSICAL_MOTION_END 16 +#define ACSC_INTR_LOGICAL_MOTION_END 17 +#define ACSC_INTR_MOTION_FAILURE 18 +#define ACSC_INTR_MOTOR_FAILURE 19 +#define ACSC_INTR_PROGRAM_END 20 +#define ACSC_INTR_COMMAND 21 // FOR BACKWARD COMPATIBILITY +#define ACSC_INTR_ACSPL_PROGRAM_EX 21 +#define ACSC_INTR_ACSPL_PROGRAM 22 +#define ACSC_INTR_INPUT 23 +#define ACSC_INTR_MOTION_START 24 +#define ACSC_INTR_MOTION_PHASE_CHANGE 25 +#define ACSC_INTR_TRIGGER 26 +#define ACSC_INTR_NEWSEGM 27 +#define ACSC_INTR_SYSTEM_ERROR 28 +#define ACSC_INTR_ETHERCAT_ERROR 29 +#define ACSC_INTR_CYCLE 30 +#define ACSC_INTR_MESSAGE 31 +#define ACSC_INTR_COMM_CHANNEL_CLOSED 32 +#define ACSC_INTR_SOFTWARE_ESTOP 33 +////////////////////////////////////////////////////////////////////////////////////////////////// +// Bit masks definitions +////////////////////////////////////////////////////////////////////////////////////////////////// +// Communication options +#define ACSC_COMM_USE_CHECKSUM 0x00000001 +#define ACSC_COMM_AUTORECOVER_HW_ERROR 0x00000002 +// Motion flags +#define ACSC_AMF_WAIT 0x00000001 +#define ACSC_AMF_RELATIVE 0x00000002 +#define ACSC_AMF_VELOCITY 0x00000004 +#define ACSC_AMF_ENDVELOCITY 0x00000008 +#define ACSC_AMF_POSITIONLOCK 0x00000010 +#define ACSC_AMF_VELOCITYLOCK 0x00000020 +#define ACSC_AMF_CYCLIC 0x00000100 +#define ACSC_AMF_VARTIME 0x00000200 // SAME AS ACSC_ STALLED +#define ACSC_AMF_STALLED 0x00000200 // SAME AS ACSC_AMF_VARTIME +#define ACSC_AMF_CUBIC 0x00000400 +#define ACSC_AMF_EXTRAPOLATED 0x00001000 +#define ACSC_AMF_AXISLIMIT 0x00002000 +#define ACSC_AMF_MAXIMUM 0x00004000 // SAME AS ACSC_AMF_SEGTIME +#define ACSC_AMF_SYNCHRONOUS 0x00008000 +#define ACSC_AMF_JUNCTIONVELOCITY 0x00010000 +#define ACSC_AMF_ANGLE 0x00020000 // SAME AS ACSC_AMF_ACCURATE AND ACSC_AMF_SEGACCEL +#define ACSC_AMF_ACCURATE 0x00020000 // SAME AS ACSC_AMF_ANGLE AND ACSC_AMF_SEGACCEL +#define ACSC_AMF_USERVARIABLES 0x00040000 +#define ACSC_AMF_INVERT_OUTPUT 0x00080000 +#define ACSC_AMF_CURVEVELOCITY 0x00100000 // SAME AS ACSC_AMF_DWELLTIME +// Corner flags +#define ACSC_AMF_CORNERDEVIATION 0x00200000 +#define ACSC_AMF_CORNERRADIUS 0x00400000 +#define ACSC_AMF_CORNERLENGTH 0x00800000 +//BSEG flags +#define ACSC_AMF_DWELLTIME 0x00100000 // SAME AS ACSC_AMF_CURVEVELOCITY +#define ACSC_AMF_BSEGTIME 0x00004000 // SAME AS ACSC_AMF_MAXIMUM +#define ACSC_AMF_BSEGACC 0x00020000 // SAME AS ACSC_AMF_ANGLE AND ACSC_AMF_ACCURATE +#define ACSC_AMF_BSEGJERK 0x00008000 // SAME AS ACSC_AMF_SYNCHRONOUS +#define ACSC_AMF_CURVEAUTO 0x01000000 +// Data collection flags +#define ACSC_DCF_TEMPORAL 0x00000001 +#define ACSC_DCF_CYCLIC 0x00000002 +#define ACSC_DCF_SYNC 0x00000004 +#define ACSC_DCF_WAIT 0x00000008 +// Motor states +#define ACSC_MST_ENABLE 0x00000001 +#define ACSC_MST_INPOS 0x00000010 +#define ACSC_MST_MOVE 0x00000020 +#define ACSC_MST_ACC 0x00000040 +// Motion states +#define ACSC_AST_LEAD 0x00000001 +#define ACSC_AST_DC 0x00000002 +#define ACSC_AST_PEG 0x00000004 +#define ACSC_AST_PEGREADY 0x00000010 +#define ACSC_AST_MOVE 0x00000020 +#define ACSC_AST_ACC 0x00000040 +#define ACSC_AST_SEGMENT 0x00000080 +#define ACSC_AST_VELLOCK 0x00000100 +#define ACSC_AST_POSLOCK 0x00000200 +// Index states +#define ACSC_IST_IND 0x00000001 +#define ACSC_IST_IND2 0x00000002 +#define ACSC_IST_MARK 0x00000004 +#define ACSC_IST_MARK2 0x00000008 +// Program states +#define ACSC_PST_COMPILED 0x00000001 +#define ACSC_PST_RUN 0x00000002 +#define ACSC_PST_SUSPEND 0x00000004 +#define ACSC_PST_DEBUG 0x00000020 +#define ACSC_PST_AUTO 0x00000080 +// Safety control masks +#define ACSC_SAFETY_RL 0x00000001 +#define ACSC_SAFETY_LL 0x00000002 +#define ACSC_SAFETY_NETWORK 0x00000004 +#define ACSC_SAFETY_HOT 0x00000010 +#define ACSC_SAFETY_SRL 0x00000020 +#define ACSC_SAFETY_SLL 0x00000040 +#define ACSC_SAFETY_ENCNC 0x00000080 +#define ACSC_SAFETY_ENC2NC 0x00000100 +#define ACSC_SAFETY_DRIVE 0x00000200 +#define ACSC_SAFETY_ENC 0x00000400 +#define ACSC_SAFETY_ENC2 0x00000800 +#define ACSC_SAFETY_PE 0x00001000 +#define ACSC_SAFETY_CPE 0x00002000 +#define ACSC_SAFETY_VL 0x00004000 +#define ACSC_SAFETY_AL 0x00008000 +#define ACSC_SAFETY_CL 0x00010000 +#define ACSC_SAFETY_SP 0x00020000 +#define ACSC_SAFETY_STO 0x00040000 +#define ACSC_SAFETY_HSSINC 0x00100000 +#define ACSC_SAFETY_EXTNT 0x00800000 +#define ACSC_SAFETY_TEMP 0x01000000 +#define ACSC_SAFETY_PROG 0x02000000 +#define ACSC_SAFETY_MEM 0x04000000 +#define ACSC_SAFETY_TIME 0x08000000 +#define ACSC_SAFETY_ES 0x10000000 +#define ACSC_SAFETY_INT 0x20000000 +#define ACSC_SAFETY_INTGR 0x40000000 +#define ACSC_SAFETY_FAILURE 0x80000000 +// EtherCAT flags +#define ACSC_ETHERCAT_1BYTE 0x00000001 +#define ACSC_ETHERCAT_2BYTES 0x00000002 +#define ACSC_ETHERCAT_4BYTES 0x00000004 +#define ACSC_ETHERCAT_FLOAT 0x00000008 +////////////////////////////////////////////////////////////////////////////////////////////////// +// Old Axes Masks +////////////////////////////////////////////////////////////////////////////////////////////////// +#define ACSC_MASK_AXIS_X 0x00000001 +#define ACSC_MASK_AXIS_Y 0x00000002 +#define ACSC_MASK_AXIS_Z 0x00000004 +#define ACSC_MASK_AXIS_T 0x00000008 +#define ACSC_MASK_AXIS_A 0x00000010 +#define ACSC_MASK_AXIS_B 0x00000020 +#define ACSC_MASK_AXIS_C 0x00000040 +#define ACSC_MASK_AXIS_D 0x00000080 +////////////////////////////////////////////////////////////////////////////////////////////////// +// New Axes Masks +////////////////////////////////////////////////////////////////////////////////////////////////// +#define ACSC_MASK_AXIS_0 0x0000000000000001 +#define ACSC_MASK_AXIS_1 0x0000000000000002 +#define ACSC_MASK_AXIS_2 0x0000000000000004 +#define ACSC_MASK_AXIS_3 0x0000000000000008 +#define ACSC_MASK_AXIS_4 0x0000000000000010 +#define ACSC_MASK_AXIS_5 0x0000000000000020 +#define ACSC_MASK_AXIS_6 0x0000000000000040 +#define ACSC_MASK_AXIS_7 0x0000000000000080 +#define ACSC_MASK_AXIS_8 0x0000000000000100 +#define ACSC_MASK_AXIS_9 0x0000000000000200 +#define ACSC_MASK_AXIS_10 0x0000000000000400 +#define ACSC_MASK_AXIS_11 0x0000000000000800 +#define ACSC_MASK_AXIS_12 0x0000000000001000 +#define ACSC_MASK_AXIS_13 0x0000000000002000 +#define ACSC_MASK_AXIS_14 0x0000000000004000 +#define ACSC_MASK_AXIS_15 0x0000000000008000 +#define ACSC_MASK_AXIS_16 0x0000000000010000 +#define ACSC_MASK_AXIS_17 0x0000000000020000 +#define ACSC_MASK_AXIS_18 0x0000000000040000 +#define ACSC_MASK_AXIS_19 0x0000000000080000 +#define ACSC_MASK_AXIS_20 0x0000000000100000 +#define ACSC_MASK_AXIS_21 0x0000000000200000 +#define ACSC_MASK_AXIS_22 0x0000000000400000 +#define ACSC_MASK_AXIS_23 0x0000000000800000 +#define ACSC_MASK_AXIS_24 0x0000000001000000 +#define ACSC_MASK_AXIS_25 0x0000000002000000 +#define ACSC_MASK_AXIS_26 0x0000000004000000 +#define ACSC_MASK_AXIS_27 0x0000000008000000 +#define ACSC_MASK_AXIS_28 0x0000000010000000 +#define ACSC_MASK_AXIS_29 0x0000000020000000 +#define ACSC_MASK_AXIS_30 0x0000000040000000 +#define ACSC_MASK_AXIS_31 0x0000000080000000 +#define ACSC_MASK_AXIS_32 0x0000000100000000 +#define ACSC_MASK_AXIS_33 0x0000000200000000 +#define ACSC_MASK_AXIS_34 0x0000000400000000 +#define ACSC_MASK_AXIS_35 0x0000000800000000 +#define ACSC_MASK_AXIS_36 0x0000001000000000 +#define ACSC_MASK_AXIS_37 0x0000002000000000 +#define ACSC_MASK_AXIS_38 0x0000004000000000 +#define ACSC_MASK_AXIS_39 0x0000008000000000 +#define ACSC_MASK_AXIS_40 0x0000010000000000 +#define ACSC_MASK_AXIS_41 0x0000020000000000 +#define ACSC_MASK_AXIS_42 0x0000040000000000 +#define ACSC_MASK_AXIS_43 0x0000080000000000 +#define ACSC_MASK_AXIS_44 0x0000100000000000 +#define ACSC_MASK_AXIS_45 0x0000200000000000 +#define ACSC_MASK_AXIS_46 0x0000400000000000 +#define ACSC_MASK_AXIS_47 0x0000800000000000 +#define ACSC_MASK_AXIS_48 0x0001000000000000 +#define ACSC_MASK_AXIS_49 0x0002000000000000 +#define ACSC_MASK_AXIS_50 0x0004000000000000 +#define ACSC_MASK_AXIS_51 0x0008000000000000 +#define ACSC_MASK_AXIS_52 0x0010000000000000 +#define ACSC_MASK_AXIS_53 0x0020000000000000 +#define ACSC_MASK_AXIS_54 0x0040000000000000 +#define ACSC_MASK_AXIS_55 0x0080000000000000 +#define ACSC_MASK_AXIS_56 0x0100000000000000 +#define ACSC_MASK_AXIS_57 0x0200000000000000 +#define ACSC_MASK_AXIS_58 0x0400000000000000 +#define ACSC_MASK_AXIS_59 0x0800000000000000 +#define ACSC_MASK_AXIS_60 0x1000000000000000 +#define ACSC_MASK_AXIS_61 0x2000000000000000 +#define ACSC_MASK_AXIS_62 0x4000000000000000 +#define ACSC_MASK_AXIS_63 0x8000000000000000 +// Buffer masks +#define ACSC_MASK_BUFFER_0 0x0000000000000001 +#define ACSC_MASK_BUFFER_1 0x0000000000000002 +#define ACSC_MASK_BUFFER_2 0x0000000000000004 +#define ACSC_MASK_BUFFER_3 0x0000000000000008 +#define ACSC_MASK_BUFFER_4 0x0000000000000010 +#define ACSC_MASK_BUFFER_5 0x0000000000000020 +#define ACSC_MASK_BUFFER_6 0x0000000000000040 +#define ACSC_MASK_BUFFER_7 0x0000000000000080 +#define ACSC_MASK_BUFFER_8 0x0000000000000100 +#define ACSC_MASK_BUFFER_9 0x0000000000000200 +#define ACSC_MASK_BUFFER_10 0x0000000000000400 +#define ACSC_MASK_BUFFER_11 0x0000000000000800 +#define ACSC_MASK_BUFFER_12 0x0000000000001000 +#define ACSC_MASK_BUFFER_13 0x0000000000002000 +#define ACSC_MASK_BUFFER_14 0x0000000000004000 +#define ACSC_MASK_BUFFER_15 0x0000000000008000 +#define ACSC_MASK_BUFFER_16 0x0000000000010000 +#define ACSC_MASK_BUFFER_17 0x0000000000020000 +#define ACSC_MASK_BUFFER_18 0x0000000000040000 +#define ACSC_MASK_BUFFER_19 0x0000000000080000 +#define ACSC_MASK_BUFFER_20 0x0000000000100000 +#define ACSC_MASK_BUFFER_21 0x0000000000200000 +#define ACSC_MASK_BUFFER_22 0x0000000000400000 +#define ACSC_MASK_BUFFER_23 0x0000000000800000 +#define ACSC_MASK_BUFFER_24 0x0000000001000000 +#define ACSC_MASK_BUFFER_25 0x0000000002000000 +#define ACSC_MASK_BUFFER_26 0x0000000004000000 +#define ACSC_MASK_BUFFER_27 0x0000000008000000 +#define ACSC_MASK_BUFFER_28 0x0000000010000000 +#define ACSC_MASK_BUFFER_29 0x0000000020000000 +#define ACSC_MASK_BUFFER_30 0x0000000040000000 +#define ACSC_MASK_BUFFER_31 0x0000000080000000 +#define ACSC_MASK_BUFFER_32 0x0000000100000000 +#define ACSC_MASK_BUFFER_33 0x0000000200000000 +#define ACSC_MASK_BUFFER_34 0x0000000400000000 +#define ACSC_MASK_BUFFER_35 0x0000000800000000 +#define ACSC_MASK_BUFFER_36 0x0000001000000000 +#define ACSC_MASK_BUFFER_37 0x0000002000000000 +#define ACSC_MASK_BUFFER_38 0x0000004000000000 +#define ACSC_MASK_BUFFER_39 0x0000008000000000 +#define ACSC_MASK_BUFFER_40 0x0000010000000000 +#define ACSC_MASK_BUFFER_41 0x0000020000000000 +#define ACSC_MASK_BUFFER_42 0x0000040000000000 +#define ACSC_MASK_BUFFER_43 0x0000080000000000 +#define ACSC_MASK_BUFFER_44 0x0000100000000000 +#define ACSC_MASK_BUFFER_45 0x0000200000000000 +#define ACSC_MASK_BUFFER_46 0x0000400000000000 +#define ACSC_MASK_BUFFER_47 0x0000800000000000 +#define ACSC_MASK_BUFFER_48 0x0001000000000000 +#define ACSC_MASK_BUFFER_49 0x0002000000000000 +#define ACSC_MASK_BUFFER_50 0x0004000000000000 +#define ACSC_MASK_BUFFER_51 0x0008000000000000 +#define ACSC_MASK_BUFFER_52 0x0010000000000000 +#define ACSC_MASK_BUFFER_53 0x0020000000000000 +#define ACSC_MASK_BUFFER_54 0x0040000000000000 +#define ACSC_MASK_BUFFER_55 0x0080000000000000 +#define ACSC_MASK_BUFFER_56 0x0100000000000000 +#define ACSC_MASK_BUFFER_57 0x0200000000000000 +#define ACSC_MASK_BUFFER_58 0x0400000000000000 +#define ACSC_MASK_BUFFER_59 0x0800000000000000 +#define ACSC_MASK_BUFFER_60 0x1000000000000000 +#define ACSC_MASK_BUFFER_61 0x2000000000000000 +#define ACSC_MASK_BUFFER_62 0x4000000000000000 +#define ACSC_MASK_BUFFER_63 0x8000000000000000 +// Input masks +#define ACSC_MASK_INPUT_0 0x00000001 +#define ACSC_MASK_INPUT_1 0x00000002 +#define ACSC_MASK_INPUT_2 0x00000004 +#define ACSC_MASK_INPUT_3 0x00000008 +#define ACSC_MASK_INPUT_4 0x00000010 +#define ACSC_MASK_INPUT_5 0x00000020 +#define ACSC_MASK_INPUT_6 0x00000040 +#define ACSC_MASK_INPUT_7 0x00000080 +#define ACSC_MASK_INPUT_8 0x00000100 +#define ACSC_MASK_INPUT_9 0x00000200 +#define ACSC_MASK_INPUT_10 0x00000400 +#define ACSC_MASK_INPUT_11 0x00000800 +#define ACSC_MASK_INPUT_12 0x00001000 +#define ACSC_MASK_INPUT_13 0x00002000 +#define ACSC_MASK_INPUT_14 0x00004000 +#define ACSC_MASK_INPUT_15 0x00008000 +#define ACSC_MASK_INPUT_16 0x00010000 +#define ACSC_MASK_INPUT_17 0x00020000 +#define ACSC_MASK_INPUT_18 0x00040000 +#define ACSC_MASK_INPUT_19 0x00080000 +#define ACSC_MASK_INPUT_20 0x00100000 +#define ACSC_MASK_INPUT_21 0x00200000 +#define ACSC_MASK_INPUT_22 0x00400000 +#define ACSC_MASK_INPUT_23 0x00800000 +#define ACSC_MASK_INPUT_24 0x01000000 +#define ACSC_MASK_INPUT_25 0x02000000 +#define ACSC_MASK_INPUT_26 0x04000000 +#define ACSC_MASK_INPUT_27 0x08000000 +#define ACSC_MASK_INPUT_28 0x10000000 +#define ACSC_MASK_INPUT_29 0x20000000 +#define ACSC_MASK_INPUT_30 0x40000000 +#define ACSC_MASK_INPUT_31 0x80000000 +////////////////////////////////////////////////////////////////////////////////////////////////// +// Errors codes +////////////////////////////////////////////////////////////////////////////////////////////////// +#define ACSC_ERRORBASE 100 +#define ACSC_UNKNOWNERROR ACSC_ERRORBASE //Unknown error +#define ACSC_ONLYSYNCHRONOUS (ACSC_ERRORBASE+1) //Asynchronous call is not supported +#define ACSC_ENOENTLOGFILE (ACSC_ERRORBASE+2) //No such file or directory +#define ACSC_OLD_FW (ACSC_ERRORBASE+3) //FW does not support all desired features +#define ACSC_MEMORY_OVERFLOW (ACSC_ERRORBASE+4) //Controllers reply is too long +#define ACSC_EBADFLOGFILE (ACSC_ERRORBASE+9) //Invalid log file handle +#define ACSC_RTOS_NOT_INITIALIZED (ACSC_ERRORBASE+10) //RTOS is not initialized +#define ACSC_SHM_NOT_INITIALIZED (ACSC_ERRORBASE+11) //Shared Memory is not initialized +#define ACSC_SHM_WRONG_TYPE (ACSC_ERRORBASE+12) //Wrong type of shared memory variable +#define ACSC_SHM_INVALID_ADDRESS (ACSC_ERRORBASE+13) //Invalid address of shared memory variable +#define ACSC_SHE_NOT_SUPPORTED (ACSC_ERRORBASE+14) //Shared Event is not supported +#define ACSC_SHE_INITERROR (ACSC_ERRORBASE+15) //Shared Event initialization error +#define ACSC_SHE_NOT_INITIALIZED (ACSC_ERRORBASE+16) //Shared Event is not initialized +#define ACSC_SHE_ARG_READ_ERROR (ACSC_ERRORBASE+17) //Shared Event argument read error +#define ACSC_SHE_CLOSE_ERROR (ACSC_ERRORBASE+18) //Shared Event close error +#define ACSC_EINVALLOGFILE (ACSC_ERRORBASE+22) //Write error in Log file +#define ACSC_EMFILELOGFILE (ACSC_ERRORBASE+24) //Unable to open file +#define ACSC_ENOSPCLOGFILE (ACSC_ERRORBASE+28) //Cannot open Log file. The drive is full +#define ACSC_TIMEOUT (ACSC_ERRORBASE+30) //The controller stopped responding +#define ACSC_SIMULATOR_NOT_RUN (ACSC_ERRORBASE+31) //Atempted to stop simulator that was not running +#define ACSC_INITFAILURE (ACSC_ERRORBASE+32) //Communication initialization failure +#define ACSC_SIMULATOR_RUN_EXT (ACSC_ERRORBASE+33) //Stand-alone simulator has been executed not via UMD +#define ACSC_INVALIDHANDLE (ACSC_ERRORBASE+34) //Invalid communication handle +#define ACSC_ALLCHANNELSBUSY (ACSC_ERRORBASE+35) //All channels are busy +#define ACSC_SIMULATOR_NOT_SET (ACSC_ERRORBASE+36) //Stand-alone simulator has not been set in UMD +#define ACSC_RECEIVEDTOOLONG (ACSC_ERRORBASE+37) //Received message too long(more than size of user buffer) +#define ACSC_INVALIDBUFSIZE (ACSC_ERRORBASE+38) //Functions acsc_DownloadBuffer: the program contains string longer than 2032 bytes + +#define ACSC_INVALIDPARAMETERS (ACSC_ERRORBASE+39) //Function parameters are invalid +#define ACSC_CLOSEDHISTORYBUF (ACSC_ERRORBASE+40) //History buffer is closed +#define ACSC_EMPTYNAMEVAR (ACSC_ERRORBASE+41) //Name variable must be specified +#define ACSC_INPUTPAR (ACSC_ERRORBASE+42) //Error in index specification +#define ACSC_RECEIVEDTOOSMALL (ACSC_ERRORBASE+43) //Controller reply contains less values than expected +#define ACSC_FUNCTIONNOTSUPPORTED (ACSC_ERRORBASE+45) //Function is not supported in current version +#define ACSC_INITHISTORYBUFFAILED (ACSC_ERRORBASE+47) //History buffer initialization failure +#define ACSC_CLOSEDMESSAGEBUF (ACSC_ERRORBASE+50) //Unsolicited messages buffer is closed +#define ACSC_SETCALLBACKERROR (ACSC_ERRORBASE+51) //Callback registration error +#define ACSC_CALLBACKALREADYSET (ACSC_ERRORBASE+52) //Callback function has been already installed +#define ACSC_CHECKSUMERROR (ACSC_ERRORBASE+53) //Checksum of controller reply error +#define ACSC_REPLIESSEQUENCEERROR (ACSC_ERRORBASE+54) //Internal error: Replies sequence error +#define ACSC_WAITFAILED (ACSC_ERRORBASE+55) //Internal error: WaitForSingleObject error +#define ACSC_INITMESSAGEBUFFAILED (ACSC_ERRORBASE+57) //Unsolicited messages buffer initialization failure +#define ACSC_OPERATIONABORTED (ACSC_ERRORBASE+58) //Non-waiting call has been aborted +#define ACSC_CANCELOPERATIONERROR (ACSC_ERRORBASE+59) //Error of the non-waiting call cancellation +#define ACSC_COMMANDSQUEUEFULL (ACSC_ERRORBASE+60) //Internal error: Queue of transmitted commands is full +#define ACSC_SENDINGFAILED (ACSC_ERRORBASE+62) //Internal error: Sending is failed +#define ACSC_RECEIVINGFAILED (ACSC_ERRORBASE+63) //Internal error: Receiving is failed +#define ACSC_CHAINSENDINGFAILED (ACSC_ERRORBASE+64) //Internal error: Sending of chain is failed +#define ACSC_DUPLICATED_IP (ACSC_ERRORBASE+65) //Specified IP address is duplicated +#define ACSC_APPLICATION_NOT_FOUND (ACSC_ERRORBASE+66) //There is no Application with such Handle +#define ACSC_ARRAY_EXPECTED (ACSC_ERRORBASE+67) //Array name was expected +#define ACSC_INVALID_FILE_FORMAT (ACSC_ERRORBASE+68) //The file is not a valid ANSI data file +#define ACSC_APPSL_CRC (ACSC_ERRORBASE+71) // Application Saver Loader CRC Error +#define ACSC_APPSL_HEADERCRC (ACSC_ERRORBASE+72) // Application Saver Loader Header CRC Error +#define ACSC_APPSL_FILESIZE (ACSC_ERRORBASE+73) // Application Saver Loader File Size Error +#define ACSC_APPSL_FILEOPEN (ACSC_ERRORBASE+74) // Application Saver Loader File Open Error +#define ACSC_APPSL_UNKNOWNFILE (ACSC_ERRORBASE+75) // Application Saver Loader Unknown File Error +#define ACSC_APPSL_VERERROR (ACSC_ERRORBASE+76) // Application Saver Loader Format Version Error +#define ACSC_APPSL_SECTION_SIZE (ACSC_ERRORBASE+77) // Application Saver Loader Section Size is Zero +#define ACSC_TLSERROR (ACSC_ERRORBASE+79) //Internal error: Thread local storage error +#define ACSC_INITDRIVERFAILED (ACSC_ERRORBASE+80) //PCI driver initialization failure +#define ACSC_CAN_INITFAILURE (ACSC_ERRORBASE+81) //CAN library not found or initialization failure +#define ACSC_CLOSED_BY_CONTROLLER (ACSC_ERRORBASE+82) //CAN library not found or initialization failure +#define ACSC_INVALIDPOINTER (ACSC_ERRORBASE+85) //Pointer to the buffer is invalid || Null pointer recieved instead of user allocated object + +#define ACSC_SETPRIORITYERROR (ACSC_ERRORBASE+89) //Specified priority for the callback thread cannot be set +#define ACSC_DIRECTDPRAMACCESS (ACSC_ERRORBASE+90) //Attempt to access DPRAM not via PCI +#define ACSC_DDERROR (ACSC_ERRORBASE+91) //Spii.vxd/sys can not be found or installed +#define ACSC_INVALID_DPRAM_ADDR (ACSC_ERRORBASE+92) //Invalid DPRAM address +#define ACSC_OLD_SIMULATOR (ACSC_ERRORBASE+93) //Old version of SPiiPlus Simulator +#define ACSC_HW_PROBLEM (ACSC_ERRORBASE+94) //Hardware won't work properly +#define ACSC_FILE_NOT_FOUND (ACSC_ERRORBASE+95) +#define ACSC_SERVEREXCEPTION (ACSC_ERRORBASE+97) +#define ACSC_STOPPED_RESPONDING (ACSC_ERRORBASE+98) +#define ACSC_DLL_UMD_VERSION (ACSC_ERRORBASE+99) //DLL and Server are not of the same Version +#define ACSC_FRF_INPUT_START_FREQUENCY_OUT_OF_RANGE (ACSC_ERRORBASE+100) +#define ACSC_FRF_INPUT_END_FREQUENCY_OUT_OF_RANGE (ACSC_ERRORBASE+101) +#define ACSC_FRF_INPUT_START_FREQUENCY_IS_HIGHER_THAN_END_FREQUENCY (ACSC_ERRORBASE+102) +#define ACSC_FRF_INPUT_FREQPERDEC_OUT_OF_RANGE (ACSC_ERRORBASE+103) // Standard resolution frequency per decade is out of range + +#define ACSC_FRF_INPUT_HR_FREQPERDEC_OUT_OF_RANGE (ACSC_ERRORBASE+104) // High resolution frequency per decade is out of range + +#define ACSC_FRF_INPUT_FREQUENCY_RESOLUTION_LINEAR_OUT_OF_RANGE (ACSC_ERRORBASE+105) // Required freqeuncy resolution (linear distribution) is out of range + +#define ACSC_FRF_INPUT_AMPLITUDE_OUT_OF_RANGE (ACSC_ERRORBASE+106) //Excitation amplitude is out of range +#define ACSC_FRF_INPUT_AXIS_OUT_OF_RANGE (ACSC_ERRORBASE+107) // Axis is out of range of Controller axes +#define ACSC_FRF_INPUT_NUMBER_OF_REPETITIONS_OUT_OF_RANGE (ACSC_ERRORBASE+108) // Number of Excitation repetitions is out of range + +#define ACSC_FRF_INPUT_DURATION_OUT_OF_RANGE (ACSC_ERRORBASE+109) // Excitation duration is out of range +#define ACSC_FRF_INPUT_ENUM_VALUE_OUT_OF_RANGE (ACSC_ERRORBASE + 110) // Excitation duration is out of range +#define ACSC_FRF_MEMORY_ALLOCATION_FAILED_AT_HOST (ACSC_ERRORBASE+111) // Failed to allocate memory at PC +#define ACSC_FRF_DATA_READ_FROM_CONTROLLER_INCONSISTENT (ACSC_ERRORBASE+112) // Internal error +#define ACSC_FRF_DSP_DOESNT_HAVE_REQUIRED_PARAMETERS (ACSC_ERRORBASE+113) // DSP should have appropriate parameters +#define ACSC_FRF_FAILED_TO_COMMUNICATE_WITH_CONTROLLER (ACSC_ERRORBASE+114) // Failed to send/receive command to/from controller + +#define ACSC_FRF_FAILED_TO_READ_SERVO_PARAMETERS (ACSC_ERRORBASE+115) //internal error +#define ACSC_FRF_DUMMY_AXIS_NOT_SUPPORTED (ACSC_ERRORBASE+116) +#define ACSC_FRF_MOTOR_SHOULD_BE_SET_TO_CLOSED_LOOP (ACSC_ERRORBASE+117) //MFLAGS.#OPEN should be set to 1 +#define ACSC_FRF_MOTOR_SHOULD_BE_ENABLED (ACSC_ERRORBASE+118) +#define ACSC_FRF_MOTOR_SHOULD_COMMUTATED (ACSC_ERRORBASE+119) // For brushless motors +#define ACSC_FRF_SPDC_IS_ALREADY_IN_PROGRESS (ACSC_ERRORBASE+120) //SPDC command is already running +#define ACSC_FRF_ABORTED_BY_USER (ACSC_ERRORBASE+121) // FRF abort issued by the user +#define ACSC_FRF_MOTOR_DISABLED_DURING_MEASUREMENT (ACSC_ERRORBASE+122) +#define ACSC_FRF_DISABLE_OR_FAULT_OCCURED_DURING_MEASUREMENT (ACSC_ERRORBASE+123) +#define ACSC_FRF_FAULT_OCCURED_DURING_MEASUREMENT (ACSC_ERRORBASE+124) +#define ACSC_FRF_ARRAY_SIZES_INCOMATIBLE (ACSC_ERRORBASE+125) //internal error +#define ACSC_FRF_NUMBER_OF_POINTS_SHOULD_BE_POSITIVE (ACSC_ERRORBASE+126) //internal error +#define ACSC_FRF_MEMORY_ALLOCATION_FAILED_AT_CONTROLLER (ACSC_ERRORBASE+127) // Failed to allocate memory in controller +#define ACSC_FRF_EXCITATION_DURATION_IS_TOO_LONG (ACSC_ERRORBASE+128) //internal error +#define ACSC_FRF_USER_DEFINED_EXCITATION_SIGNAL_REQUIRED_BUT_NOT_DEFINED (ACSC_ERRORBASE+129) // +#define ACSC_FRF_USER_DEFINED_EXCITATION_SIGNAL_OUT_OF_BOUNDARIES (ACSC_ERRORBASE+130) // +#define ACSC_FRF_FRD_LENGTH_TOO_SHORT (ACSC_ERRORBASE+131) // +#define ACSC_FRF_FRD_FREQUENCIES_SHOULD_BE_CONTINUOUSLY_INCREASING (ACSC_ERRORBASE+132) // +#define ACSC_JITTER_ANALYSIS_JITTER_ARRAY_TOO_SHORT (ACSC_ERRORBASE+133) +#define ACSC_JITTER_ANALYSIS_SAMPLING_FREQUENCY_NOT_VALID (ACSC_ERRORBASE+134) // Frequency should not be >= 0 +#define ACSC_JITTER_ANALYSIS_WINDOW_TYPE_NOT_SUPPORTED (ACSC_ERRORBASE+135) // +#define ACSC_JITTER_ANALYSIS_FREQUENCY_RANGE_NOT_VALID (ACSC_ERRORBASE+136) // +#define ACSC_JITTER_ANALYSIS_FREQUENCY_RESOLUTION_NOT_VALID (ACSC_ERRORBASE+137) // +#define ACSC_LICENSE_COMMON_PROBLEM (ACSC_ERRORBASE+138) +#define ACSC_LICENSE_DONGLE_NOT_FOUND (ACSC_ERRORBASE+139) +#define ACSC_LICENSE_ENTRY_NOT_FOUND (ACSC_ERRORBASE+140) +#define ACSC_LICENSE_INVALID_HANDLE (ACSC_ERRORBASE+141) +#define ACSC_LICENSE_NO_DATA_AVAILABLE (ACSC_ERRORBASE+142) +#define ACSC_LICENSE_INVALID_PN (ACSC_ERRORBASE+143) +#define ACSC_SC_INCORRECT_PROC_ALLOC (ACSC_ERRORBASE+144) //SPiiPlusSC: Incorrect Windows Processor Allocation +#define ACSC_SC_MISSING_DRIVERS (ACSC_ERRORBASE+145) //SPiiPlusSC: Missing drivers +#define ACSC_SC_INCORRECT_MEMORY (ACSC_ERRORBASE+146) //SPiiPlusSC: Incorrect Memory Reservations +#define ACSC_SC_RTOS_SERVICE (ACSC_ERRORBASE+147) //SPiiPlusSC: RTOS Service isn't running +#define ACSC_SC_REBOOT (ACSC_ERRORBASE+148) //SPiiPlusSC: System requires reboot +#define ACSC_SC_DONGLE_VERSION (ACSC_ERRORBASE+149) //SPiiPlusSC: Detected CmStick Version of Dongle is too old +#define ACSC_LICENSE_NONLICENSED_FEATURE_MATLAB (ACSC_ERRORBASE+150) // MATLAB labrary is not licensed according to existing License PN + +#define ACSC_LICENSE_NONLICENSED_FEATURE_FRF (ACSC_ERRORBASE+151) // FRF library is not licensed according to existing License PN + +#define ACSC_LICENSE_NONLICENSED_FEATURE_COMMON (ACSC_ERRORBASE+152) // Feature is not licensed according to existing License PN + +#define ACSC_FRF_GENERAL_ERROR (ACSC_ERRORBASE+153) //General error mainly for .]resolving .NET library conflict when function returns 0 and errorCode is also 0 + +#define ACSC_HW_ERRORBASE 500 // Hardware specific errors +#define ACSC_HW_NO_INT (ACSC_HW_ERRORBASE+2) +#define ACSC_HW_INT_PERIOD (ACSC_HW_ERRORBASE+4) +#define ACSC_HW_NO_INT_NOTIF (ACSC_HW_ERRORBASE+6) +#define ACSC_HW_SPiiFAILURE (ACSC_HW_ERRORBASE+8) +#define ACSC_CANDEVICE_CUSTOM1 1 +#define ACSC_CANDEVICE_CUSTOM2 2 +#define ACSC_CANDEVICE_NI 11 +#if defined (_ACSC_LIBRARY_DLL_) +#define _ACSCLIB_ __declspec( dllexport ) +#else +#define _ACSCLIB_ __declspec( dllimport ) +#endif +using FRF_LOOP_TYPE = enum +{ + PositionVelocity, + Position, + Velocity, + Current, + Open, +}; +using FRF_OVERLAP = enum +{ + NoOverlap, + HalfSignal +}; +using FRF_EXCITATION_TYPE = enum +{ + WhiteNoise, + ChirpPeriodic, + UserDefined +}; +using FRF_CHIRP_TYPE = enum +{ + LogarithmicChirp, + LinearChirp +}; +using FRF_WINDOW_TYPE = enum +{ + Hanning, + Rectangular, + Hamming +}; +using FRF_FREQUENCY_DISTRIBUTION_TYPE = enum +{ + Logarithmic, + Linear +}; + +struct FRD +{ + double* real; + double* imag; + double* frequencyHz; + unsigned int length; +}; + +struct FRF_STABILITY_MARGINS +{ + double* gainMarginArray; + double* gainMarginArrayFrequencyHz; + unsigned int gainMarginArrayLength; + double gainMarginWorst; + double gainMarginWorstFrequencyHz; + double* phaseMarginArray; + double* phaseMarginArrayFrequencyHz; + unsigned int phaseMarginArrayLength; + double phaseMarginWorst; + double phaseMarginWorstFrequencyHz; + double modulusMargin; + double modulusMarginFrequencyHz; + double bandwidth; +}; + +struct FRF_DURATION_CALCULATION_PARAMETERS +{ + FRF_FREQUENCY_DISTRIBUTION_TYPE frequencyDistributionType; + double startFreqHz; + double endFreqHz; + int freqPerDec; + double highResolutionStart; + int highResolutionFreqPerDec; + double frequencyHzResolutionForLinear; +}; + +// Structure used for defining FRF input parameters +struct FRF_INPUT +{ + int axis; + FRF_LOOP_TYPE loopType; + FRF_EXCITATION_TYPE excitationType; + FRF_CHIRP_TYPE chirpType; + FRF_WINDOW_TYPE windowType; + FRF_FREQUENCY_DISTRIBUTION_TYPE frequencyDistributionType; + FRF_OVERLAP overlap; + double startFreqHz; + double endFreqHz; + int freqPerDec; + double excitationAmplitudePercentIp; + int numberOfRepetitions; + double highResolutionStart; + int highResolutionFreqPerDec; + double durationSec; // applicable for Chirp and White Noise options + // User defined excitation signal + double* userDefinedExcitationSignal; + int userDefinedExcitationSignalLength; + // Quick recalculate without remeasuring + double* inRaw; + double* outRaw; + int lengthRaw; + BOOL recalculate; +}; + +// Structure used for defining FRF output parameters +struct FRF_OUTPUT +{ + // Plant parameters + FRD* plant; //P + FRD* controller; //C + FRD* openLoop; //L + FRD* closedLoop; //T + FRD* sensitivity; //S + FRD* coherence; + FRF_STABILITY_MARGINS* stabilityMargins; + FRF_LOOP_TYPE loopType; + double* inRaw; + double* outRaw; + int lengthRaw; + double excitationAmplitude; +}; + +struct SERVO_PARAMETERS +{ + double SLIKP; + double SLIKI; + double SLILI; + double SLPKP; + double SLPKI; + double SLPLI; + double SLVKP; + double SLVKI; + double SLVLI; + double SLVSOF; + double SLVSOFD; + double SLVNFRQ; + double SLVNWID; + double SLVNATT; + double SLVB0NF; + double SLVB0DF; + double SLVB0ND; + double SLVB0DD; + double SLVB1NF; + double SLVB1DF; + double SLVB1ND; + double SLVB1DD; + double XVEL; + double EFAC; + double SLVRAT; + double SLAFF; + INT32 MFLAGS; + INT32 MFLAGSX; +}; + +struct JITTER_ANALYSIS_INPUT +{ + // Jitter array + double* jitter; + unsigned int jitterLength; + unsigned int samplingFrequencyHz; + double desiredFrequencyResolutionHz; + // Parameters for frequency bands cumulative analysis + double* jitterFrequencyBandsCumulativeAmplitudeRMSthreshold; + double* frequencyBandsHz; + unsigned int frequencyBandsHzLength; + // Window type. Applied to a signal in time domain + FRF_WINDOW_TYPE windowType; +}; + +struct JITTER_ANALYSIS_OUTPUT +{ + //following three arrays have the same length defined in frequencyLength + double* jitterAmplitudeRMS; + double* jitterCumulativeAmplitudeRMS; + double* frequencyHz; + unsigned int frequencyLength; + // Result of frequency bands cumulative analysis + double* jitterFrequencyBandsCumulativeAmplitudeRMS; + double* frequencyBandsHz; + unsigned int frequencyBandsHzLength; + int jitterFrequencyBandsResultBool; + double jitterRMS; + double jitterAmplitudePeak2Peak; +}; + +// Structure is used for non-waiting calls of the library functions +typedef struct +{ + HANDLE Event; //signal event + int Ret; //code of return +} ACSC_WAITBLOCK, *LP_ACSC_WAITBLOCK, WAITBLOCK, *LP_WAITBLOCK; + +//Defines for COMLib 6.5 +#define ACSC_SYNCHRONOUS (LP_ACSC_WAITBLOCK)NULL // Synchronous call +#define ACSC_IGNORE (LP_ACSC_WAITBLOCK)-1 // Ignore result of Asyncronous call +#define ACSC_ASYNCHRONOUS (LP_ACSC_WAITBLOCK)-2 // Asynchronous call +using ACSC_RETURN_TYPE = enum +{ + Default_Type = 0, + String_Type = 0, + Buffer_Type = 1, + Integer_Type = 2, + Real_Type = 3, + Scalar_Type = 4, + Vector_Type = 5, + Matrix_Type = 6, + Typeless_Type = 7, + Binary_Type = 8 +}; + +// Structure defines a physical location of PCI card +typedef struct +{ + unsigned int BusNumber; //PCI physical bus number of card + unsigned int SlotNumber; //PCI physical slot number of card + unsigned int Function; //PCI function of card +} ACSC_PCI_SLOT, *LP_ACSC_PCI_SLOT, PCI_SLOT, *LP_PCI_SLOT; + +using ACSC_LOG_DETALIZATION_LEVEL = enum +{ + Minimum, + Medium, + Maximum +}; +using ACSC_LOG_DATA_PRESENTATION = enum +{ + Compact, + Formatted, + Full +}; +//This struct describes single UMD connection +using ACSC_CONNECTION_DESC = struct +{ + char Application[100]; // Application Name + HANDLE Handle; // Channel's Handle + DWORD ProcessId; +}; +using ACSC_CONNECTION_TYPE = enum +{ + ACSC_NOT_CONNECTED = 0, + ACSC_SERIAL = 1, + ACSC_PCI = 2, + ACSC_ETHERNET = 3, + ACSC_DIRECT = 4 +}; +using ACSC_CONNECTION_INFO = struct +{ + ACSC_CONNECTION_TYPE Type; + int SerialPort; + int SerialBaudRate; + int PCISlot; + int EthernetProtocol; + char EthernetIP[100]; + int EthernetPort; +}; +//This structures used for Application Saver / Loader functions +using ACSC_APPSL_STRING = struct +{ + int length; + char* string; +}; +using ACSC_APPSL_FILETYPE = enum +{ + ACSC_ADJ, + ACSC_SP, + ACSC_ACSPL, + ACSC_PAR, + ACSC_USER, + ACSC_PROT_STRING +}; +using ACSC_APPSL_SECTION = struct +{ + ACSC_APPSL_FILETYPE type; // section type + ACSC_APPSL_STRING filename; // section file name + ACSC_APPSL_STRING description; // section description + unsigned int size; // data size + unsigned int offset; // offset in the file data section + unsigned int CRC; // data CRC + int inuse; // selected for save/load + int error; // error code + char* data; // data as is +}; +// Atrriburte key-value pair structure +using ACSC_APPSL_ATTRIBUTE = struct +{ + ACSC_APPSL_STRING key; // attribute's key (name) + ACSC_APPSL_STRING value; // key data +}; +// Data file structure +// Describe data file header, attributes array and file sections array +using ACSC_APPSL_INFO = struct +{ + ACSC_APPSL_STRING filename; // file name + ACSC_APPSL_STRING description; // file description + int isNewFile; // 1 - if writing new file, 0 - if adding + int ErrCode; // Error code from controller + unsigned int attributes_num; // attributes count + ACSC_APPSL_ATTRIBUTE* attributes; // attributes array + unsigned int sections_num; // sections count + ACSC_APPSL_SECTION* sections; // sections array +}; +// Structure of history and message buffer +// Please never change data of this structure! +struct ACSC_HISTORYBUFFER +{ + int Max; //buffer size + int Cur; //number of bytes currently stored in the buffer + int Ring; //circular index in the buffer + char* Buf; //pointer to buffer +}; + +// struct for controller info +//for acsc_GetEthernetCardsExt function +struct ACSC_CONTROLLER_INFO +{ + in_addr IpAddress; // controller ip adrress + char SerialNumber[100]; // controller serial number + char PartNumber[100]; // controller part number + char Version[100]; // controller firmware version +}; + +using LP_ACSC_HISTORYBUFFER = struct ACSC_HISTORYBUFFER*; +using ACSC_INTR_CALLBACK_FUNC = int(WINAPI *)(int Param); +using ACSC_INTR_CALLBACK_FUNC_EXT = int(WINAPI *)(int Param, void* CardContext); +using ACSC_USER_CONDITION_FUNC = int(WINAPI *)(HANDLE Handle); +#define ACSC_DUMMY_CALLBACK (ACSC_INTR_CALLBACK_FUNC)-1 +#define ACSC_DUMMY_CALLBACK_EXT (ACSC_INTR_CALLBACK_FUNC_EXT)-1 +////////////////////////////////////////////////////////////////////////////////////////////////// +using ACSC_USER_CALLBACK_FUNCTION = int(WINAPI *)(unsigned __int64 Param, void* CardContext); +#define ACSC_DUMMY_CALLBACK_FUNCTION (ACSC_USER_CALLBACK_FUNCTION)-1 +////////////////////////////////////////////////////////////////////////////////////////////////// +#ifdef __cplusplus +extern "C" { +#endif +////////////////////////////////////////////////////////////////////////////////////////////////// +// If you want to load ACSC.dll dynamically at runtime, +// define ACSC_RUNTIME_DYNAMIC_LINKING in your project before including this file +// Otherwise load-time dynamic linking is implied +////////////////////////////////////////////////////////////////////////////////////////////////// +#if !defined (ACSC_RUNTIME_DYNAMIC_LINKING) +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function initiates communication via serial port +////////////////////////////////////////////////////////////////////////////////////////////////// +HANDLE _ACSCLIB_ WINAPI acsc_OpenCommSerial(int Channel, int Rate); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function initiates communication via Ethernet +////////////////////////////////////////////////////////////////////////////////////////////////// +HANDLE _ACSCLIB_ WINAPI acsc_OpenCommEthernet(char* Address, int Port); +// new functions with any custom port as parameter +HANDLE _ACSCLIB_ WINAPI acsc_OpenCommEthernetTCP(char* Address, int Port); +HANDLE _ACSCLIB_ WINAPI acsc_OpenCommEthernetUDP(char* Address, int Port); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function initiates direct communication with simulator +////////////////////////////////////////////////////////////////////////////////////////////////// +HANDLE _ACSCLIB_ WINAPI acsc_OpenCommDirect(); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The functions collects IP addresses of SPiiPlus cards connected to the local segment +///////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ acsc_GetEthernetCards(struct in_addr* IPaddresses, int Max, int* Ncontrollers, + unsigned long BroadcastAddress); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The functions collects IP addresses,serial number and part number of SPiiPlus cards connected to the local segment +///////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ acsc_GetEthernetCardsExt(ACSC_CONTROLLER_INFO* ControllerInfo, unsigned long ControllerInfoSize, int Max, + int* Ncontrollers, unsigned long BroadcastAddress); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function initiates communication via PCI device driver +////////////////////////////////////////////////////////////////////////////////////////////////// +HANDLE _ACSCLIB_ WINAPI acsc_OpenCommPCI(int SlotNumber); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function retrieves a PCI bus information for the PCI cards installed +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_GetPCICards(ACSC_PCI_SLOT* Cards, int Count, int* ObtainedCards); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function closes communication (for all kinds of communications) +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_CloseComm(HANDLE Handle); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function sends message +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_Send(HANDLE Handle, char* Buf, int Count, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function receives message +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_Receive(HANDLE Handle, char* Buf, int Count, int* Received, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function provides transaction: sends request and receives reply +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_Transaction(HANDLE Handle, char* OutBuf, int OutCount, char* InBuf, int InCount, + int* Received, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function sends a command to the controller and analyzes the controller response. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_Command(HANDLE Handle, char* OutBuf, int OutCount, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function waits for completion of asynchronous call and retrieves a data. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_WaitForAsyncCall(HANDLE Handle, void* Buf, int* Received, ACSC_WAITBLOCK* Wait, int Timeout); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function cancels any asynchronous (non-waiting) call +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_CancelOperation(HANDLE Handle, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function retrieves the last error code +////////////////////////////////////////////////////////////////////////////////////////////////// +// function of the new library +int _ACSCLIB_ WINAPI acsc_GetLastError(); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function retrieves the explanation of an error code. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_GetErrorString(HANDLE Handle, int ErrorCode, char* ErrorStr, int Count, int* Received); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function sets communication call delay +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_SetQueueOverflowTimeout(HANDLE Handle, int Timeout); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function retrieves communication call delay +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_GetQueueOverflowTimeout(HANDLE Handle); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function sets communication timeout +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_SetTimeout(HANDLE Handle, int Timeout); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function retrieves communication timeout +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_GetTimeout(HANDLE Handle); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function retrieves default communication timeout +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_GetDefaultTimeout(HANDLE Handle); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function sets the number of iterations of one transaction +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_SetIterations(HANDLE Handle, int Iterations); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function sets communication options +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_SetCommOptions(HANDLE Handle, unsigned int Options); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function retrieves communication options +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_GetCommOptions(HANDLE Handle, unsigned int* Options); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function Clears breakpoints +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_ClearBreakpoints(HANDLE handle, int Buffer, int line, ACSC_WAITBLOCK* wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function Sets a breakpoint +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_SetBreakpoint(HANDLE handle, int Buffer, int line, ACSC_WAITBLOCK* wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function retrieves breakpoints of a buffer +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_GetBreakpointsList(HANDLE handle, int Buffer, int* ArrayIn, int ArraySize, int* replySize, + ACSC_WAITBLOCK* wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function retrieves ACSC Library version +////////////////////////////////////////////////////////////////////////////////////////////////// +unsigned int _ACSCLIB_ WINAPI acsc_GetLibraryVersion(); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function loads ACSPL+ program to the specified program buffer. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_LoadBuffer(HANDLE Handle, int Buffer, char* Text, int Count, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function loads ACSPL+ program to the specified program buffer. +// Service lines are ignored. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_LoadBufferIgnoreServiceLines(HANDLE Handle, int Buffer, char* Text, int Count, + ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function loads ACSPL+ programs to the specified program buffers. +// From *.prg file +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_LoadBuffersFromFile(HANDLE Handle, char* Filename, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function appends one or more ACSPL+ lines to the program in the specified program buffer. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_AppendBuffer(HANDLE Handle, int Buffer, char* Text, int Count, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function downloads text to a program buffer. The function is similar to the function acsc_AppendBuffer() +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_DownloadBuffer(HANDLE Handle, int Buffer, char* Text, int Count, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function uploads text from a program buffer +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_UploadBuffer(HANDLE Handle, int Buffer, int Offset, char* Text, int Count, int* Received, + ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function deletes the specified ACSPL+ program lines in the specified program buffer. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_ClearBuffer(HANDLE Handle, int Buffer, int FromLine, int ToLine, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function compiles ACSPL+ program in the specified program buffer(s). +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_CompileBuffer(HANDLE Handle, int Buffer, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function starts up ACSPL+ program in the specified program buffer. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_RunBuffer(HANDLE Handle, int Buffer, char* Label, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function stops ACSPL+ program in the specified program buffer(s). +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_StopBuffer(HANDLE Handle, int Buffer, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function suspends ACSPL+ program in the specified program buffer(s). +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_SuspendBuffer(HANDLE Handle, int Buffer, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function reads value(s) from integer variable +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_ReadInteger(HANDLE Handle, int NBuf, char* Var, int From1, int To1, int From2, int To2, + int* Values, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function writes value(s) to integer variable +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_WriteInteger(HANDLE Handle, int NBuf, char* Var, int From1, int To1, int From2, int To2, + int* Values, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function reads value(s) from real variable +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_ReadReal(HANDLE Handle, int NBuf, char* Var, int From1, int To1, int From2, int To2, + double* Values, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function writes value(s) to real variable +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_WriteReal(HANDLE Handle, int NBuf, char* Var, int From1, int To1, int From2, int To2, + double* Values, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function captures communication +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_CaptureComm(HANDLE Handle); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function releases communication +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_ReleaseComm(HANDLE Handle); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function initiates history buffer +////////////////////////////////////////////////////////////////////////////////////////////////// +LP_ACSC_HISTORYBUFFER _ACSCLIB_ WINAPI acsc_OpenHistoryBuffer(HANDLE Handle, int Size); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function closes history buffer +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_CloseHistoryBuffer(HANDLE Handle); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function retrieves the contents of the history buffer +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_GetHistory(HANDLE Handle, char* Buf, int Count, int* Received, BOOL bClear); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function initiates unsolicited messages buffer +////////////////////////////////////////////////////////////////////////////////////////////////// +LP_ACSC_HISTORYBUFFER _ACSCLIB_ WINAPI acsc_OpenMessageBuffer(HANDLE Handle, int Size); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function closes unsolicited messages buffer +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_CloseMessageBuffer(HANDLE Handle); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function retrieves all stored unsolicited messages from buffer +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_GetMessage(HANDLE Handle, char* Buf, int Count, int* Received, BOOL bClear); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function retrieves a single unsolicited message or exits by timeout +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_GetSingleMessage(HANDLE Handle, char* Buf, int Count, int* Received, int Timeout); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function opens logfile. Now all communication will be saved in the logfile. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_OpenLogFile(HANDLE Handle, char* FileName); +int _ACSCLIB_ WINAPI acsc_OpenSCLogFile(HANDLE Handle, char* FileName); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function closes logfile. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_CloseLogFile(HANDLE Handle); +int _ACSCLIB_ WINAPI acsc_CloseSCLogFile(HANDLE Handle); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function writes to logfile. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_WriteLogFile(HANDLE Handle, char* Buf, int Count); +int _ACSCLIB_ WINAPI acsc_WriteSCLogFile(HANDLE Handle, char* Buf, int Count); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function writes to logfile. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_FlushLogFile(char* Filename); +int _ACSCLIB_ WINAPI acsc_FlushSCLogFile(char* Filename, BOOL bClear); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function retrieves the data of firmware log +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_GetLogData(HANDLE Handle, char* Buf, int Count, int* Received, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function defines a value of motion velocity. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_SetVelocity(HANDLE Handle, int Axis, double Velocity, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function retrieves a value of motion velocity. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_GetVelocity(HANDLE Handle, int Axis, double* Velocity, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function defines a value of motion acceleration. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_SetAcceleration(HANDLE Handle, int Axis, double Acceleration, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function retrieves a value of motion acceleration. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_GetAcceleration(HANDLE Handle, int Axis, double* Acceleration, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function defines a value of motion deceleration. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_SetDeceleration(HANDLE Handle, int Axis, double Deceleration, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function retrieves a value of motion deceleration. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_GetDeceleration(HANDLE Handle, int Axis, double* Deceleration, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function defines a value of motion jerk. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_SetJerk(HANDLE Handle, int Axis, double Jerk, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function retrieves a value of motion jerk. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_GetJerk(HANDLE Handle, int Axis, double* Jerk, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function defines a value of kill deceleration. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_SetKillDeceleration(HANDLE Handle, int Axis, double KillDeceleration, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function retrieves a value of kill deceleration. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_GetKillDeceleration(HANDLE Handle, int Axis, double* KillDeceleration, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function provides on-the-fly change a value of motion velocity. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_SetVelocityImm(HANDLE Handle, int Axis, double Velocity, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function provides on-the-fly change a value of motion acceleration. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_SetAccelerationImm(HANDLE Handle, int Axis, double Acceleration, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function provides on-the-fly change a value of motion deceleration. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_SetDecelerationImm(HANDLE Handle, int Axis, double Deceleration, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function provides on-the-fly change a value of motion jerk. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_SetJerkImm(HANDLE Handle, int Axis, double Jerk, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function provides on-the-fly change a value of kill deceleration. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI +acsc_SetKillDecelerationImm(HANDLE Handle, int Axis, double KillDeceleration, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function assigns a current value of target position for several axes. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_SetTargetPositionM(HANDLE Handle, int* Axes, double* TargetPositions, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function assigns a current value of target position. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_SetTargetPosition(HANDLE Handle, int Axis, double TargetPosition, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function retrieves a current value of motor feedback position. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_GetTargetPosition(HANDLE Handle, int Axis, double* TargetPosition, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function assigns a current value of target position. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_SetFPosition(HANDLE Handle, int Axis, double FPosition, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function retrieves a current value of motor feedback position. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_GetFPosition(HANDLE Handle, int Axis, double* FPosition, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function assigns a current value of reference position. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_SetRPosition(HANDLE Handle, int Axis, double RPosition, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function retrieves a current value of reference position. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_GetRPosition(HANDLE Handle, int Axis, double* RPosition, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function retrieves a current value of motor feedback velocity. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_GetFVelocity(HANDLE Handle, int Axis, double* FVelocity, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function retrieves a current value of reference velocity. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_GetRVelocity(HANDLE Handle, int Axis, double* RVelocity, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function activates a motor. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_Enable(HANDLE Handle, int Axis, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function activates several motors. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_EnableM(HANDLE Handle, int* Axes, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function shuts off a motor. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_Disable(HANDLE Handle, int Axis, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function shuts off several motors. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_DisableM(HANDLE Handle, int* Axes, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function shuts off all motors. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_DisableAll(HANDLE Handle, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function performs commutation to brushless motor. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_Commut(HANDLE Handle, int Axis, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function performs commutation to brushless motor. Extended parameters +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_CommutExt(HANDLE Handle, int Axis, float Current, int Settle, int Slope, + ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function creates a coordinate system for multi-axis motion. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_Group(HANDLE Handle, int* Axes, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function breaks down an axis group created before by the acsc_Group function. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_Split(HANDLE Handle, int* Axes, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function breaks down all axis groups created before by the acsc_Group function. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_SplitAll(HANDLE Handle, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function starts up a motion that is waiting in the specified motion queue. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_Go(HANDLE Handle, int Axis, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function synchronously starts up several motions +// that are waiting in the specified motion queues. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_GoM(HANDLE Handle, int* Axes, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function terminates a motion using the full deceleration profile. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_Halt(HANDLE Handle, int Axis, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function terminates several motions using the full deceleration profile. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_HaltM(HANDLE Handle, int* Axes, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function terminates a motion using reduced deceleration profile. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_Kill(HANDLE Handle, int Axis, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function terminates several motions using reduced deceleration profile. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_KillM(HANDLE Handle, int* Axes, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function terminates all currently executed motions. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_KillAll(HANDLE Handle, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function terminates a motion immediately and +// provides a smooth transition to the next motion. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_Break(HANDLE Handle, int Axis, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function terminates several motions immediately and +// provides a smooth transition to the next motions. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_BreakM(HANDLE Handle, int* Axes, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function initiates a single-axis motion to the specified point. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_ToPoint(HANDLE Handle, int Flags, int Axis, double Point, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function initiates a multi-axis motion to the specified point +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_ToPointM(HANDLE Handle, int Flags, int* Axes, double* Point, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function initiates a single-axis motion to the specified point +// using the specified velocity or end velocity. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_ExtToPoint(HANDLE Handle, int Flags, int Axis, double Point, double Velocity, + double EndVelocity, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function initiates a multi-axis motion to the specified point +// using the specified velocity or end velocity. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_ExtToPointM(HANDLE Handle, int Flags, int* Axes, double* Point, double Velocity, + double EndVelocity, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function initiates a single-axis track motion. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_Track(HANDLE Handle, int Flags, int Axis, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function initiates a multile-axis track motion. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_TrackM(HANDLE Handle, int Flags, int* Axis, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function clears the current faults and results of previous faults stored in the MERR variable. +// For single axis +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_FaultClear(HANDLE Handle, int Axis, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function clears the current faults and results of previous faults stored in the MERR variable. +// For multiple axes +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_FaultClearM(HANDLE Handle, int* Axes, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function reads number of available axes +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_GetAxesCount(HANDLE Handle, double* Value, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function reads number of available ACSPL+ programming buffers +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_GetBuffersCount(HANDLE Handle, double* Value, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function reads index of D-Buffer +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_GetDBufferIndex(HANDLE Handle, double* Value, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function reads system information +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_SysInfo(HANDLE Handle, int Key, double* Value, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function writes system configuration +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_SetConf(HANDLE Handle, int Key, int Index, double Value, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function reads system configuration +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_GetConf(HANDLE Handle, int Key, int Index, double* Value, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function writes system configuration-obsolete +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_Setconf(HANDLE Handle, int Key, int Index, int Value, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function reads system configuration-obsolete +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_Getconf(HANDLE Handle, int Key, int Index, int* Value, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function initiates a single-axis jog motion. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_Jog(HANDLE Handle, int Flags, int Axis, double Velocity, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function initiates a multi-axis jog motion. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_JogM(HANDLE Handle, int Flags, int* Axes, int* Direction, double Velocity, + ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function initiates calculating of master value for an axis. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_SetMaster(HANDLE Handle, int Axis, char* Formula, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function initiates a master-slave motion. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_Slave(HANDLE Handle, int Flags, int Axis, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function initiates a master-slave motion with a limited following area. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_SlaveStalled(HANDLE Handle, int Flags, int Axis, double Left, double Right, + ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function initiates a single-axis multi-point motion. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_MultiPoint(HANDLE Handle, int Flags, int Axis, double Dwell, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function initiates a multi-axis multi-point motion. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_MultiPointM(HANDLE Handle, int Flags, int* Axes, double Dwell, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function initiates a single-axis spline motion. +// The motion follows an arbitrary path defined by a set of points. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_Spline(HANDLE Handle, int Flags, int Axis, double Period, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function initiates a multi-axis spline motion. +// The motion follows an arbitrary path defined by a set of points. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_SplineM(HANDLE Handle, int Flags, int* Axes, double Period, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function initiates a multi-axis segmented motion. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_Segment(HANDLE Handle, int Flags, int* Axes, double* Point, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function initiates a multi-axis segmented motion. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_SegmentedMotion(HANDLE Handle, int Flags, int* Axes, double* Point, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function initiates a multi-axis extended segmented motion. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_ExtendedSegmentedMotion(HANDLE Handle, int Flags, int* Axes, double* Point, double Velocity, + double EndVelocity, double JunctionVelocity, double Angle, + double StarvationMargin, char* Segments, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function initiates a multi-axis extended segmented motion. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_ExtendedSegmentedMotionExt(HANDLE Handle, int Flags, int* Axes, double* Point, + double Velocity, double EndVelocity, double JunctionVelocity, + double Angle, double CurveVelocity, double Deviation, + double Radius, double MaxLength, double StarvationMargin, + char* Segments, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function initiates a multi-axis blended segmented motion. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_BlendedSegmentMotion(HANDLE Handle, int Flags, int* Axes, double* Point, double SegmentTime, + double AccelerationTime, double JerkTime, double DwellTime, + ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function adds a linear segment to a blended segmented motion +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_BlendedLine(HANDLE Handle, int Flags, int* Axes, double* Point, double SegmentTime, + double AccelerationTime, double JerkTime, double DwellTime, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function adds an arc segment to a segmented motion and specifies the coordinates +// of center point, coordinates of the final point and the direction of rotation. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_BlendedArc1(HANDLE Handle, int Flags, int* Axes, double* Center, double* FinalPoint, + int Rotation, double SegmentTime, double AccelerationTime, double JerkTime, + double DwellTime, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function adds an arc segment to a segmented motion and specifies the coordinates +// of center point, rotation angle +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_BlendedArc2(HANDLE Handle, int Flags, int* Axes, double* Center, double Angle, + double SegmentTime, double AccelerationTime, double JerkTime, double DwellTime, + ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function adds a linear segment to a segmented motion. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_Line(HANDLE Handle, int* Axes, double* Point, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function adds a linear segment to a segmented motion and specifies a motion velocity. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_ExtLine(HANDLE Handle, int* Axes, double* Point, double Velocity, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function adds a linear segment to a segmented motion +// Specifies motion velocity, end motion velocity, and user variables parameters +// -- Obsolete -- +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_SegmentLine(HANDLE Handle, int Flags, int* Axes, double* Point, double Velocity, + double EndVelocity, char* Values, char* Variables, int Index, char* Masks, + ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function adds a linear segment to a segmented motion +// Specifies motion velocity, end motion velocity, and user variables parameters +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_SegmentLineExt(HANDLE Handle, int Flags, int* Axes, double* Point, double Velocity, + double EndVelocity, double Time, char* Values, char* Variables, int Index, + char* Masks, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function adds an arc segment to a segmented motion and specifies the coordinates +// of center point, coordinates of the final point and the direction of rotation. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_Arc1(HANDLE Handle, int* Axes, double* Center, double* FinalPoint, int Rotation, + ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function adds an arc segment to a segmented motion and specifies the coordinates +// of center point, coordinates of the final point, direction of rotation and +// the vector velocity for the current segment. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_ExtArc1(HANDLE Handle, int* Axes, double* Center, double* FinalPoint, int Rotation, + double Velocity, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function adds an arc segment to a segmented motion and specifies the coordinates +// of center point, coordinates of the final point, direction of rotation, vector velocity, +// end motion velocity, and user variables parameters for the current segment. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_SegmentArc1(HANDLE Handle, int Flags, int* Axes, double* Center, double* FinalPoint, + int Rotation, double Velocity, double EndVelocity, char* Values, char* Variables, + int Index, char* Masks, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function adds an arc segment to a segmented motion and specifies the coordinates +// of center point, coordinates of the final point, direction of rotation, vector velocity, +// end motion velocity, and user variables parameters for the current segment. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_SegmentArc1Ext(HANDLE Handle, int Flags, int* Axes, double* Center, double* FinalPoint, + int Rotation, double Velocity, double EndVelocity, double Time, char* Values, + char* Variables, int Index, char* Masks, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function adds an arc segment to a segmented motion and specifies the coordinates +// of center point, coordinates of the final point, direction of rotation, vector velocity, +// end motion velocity, and user variables parameters for the current segment. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_ExtendedSegmentArc1(HANDLE Handle, int Flags, int* Axes, double* Center, double* FinalPoint, + int Rotation, double Velocity, double EndVelocity, double Time, + char* Values, char* Variables, int Index, char* Masks, + ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function adds an arc segment to a segmented motion and specifies the coordinates +// of center point and rotation angle. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_Arc2(HANDLE Handle, int* Axes, double* Center, double Angle, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function adds an arc segment to a segmented motion and specifies the coordinates +// of center point, rotation angle and the vector velocity for the current segment. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_ExtArc2(HANDLE Handle, int* Axes, double* Center, double Angle, double Velocity, + ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function adds an arc segment to a segmented motion and specifies the coordinates +// of center point, rotation angle, vector velocity, +// end motion velocity, and user variables parameters for the current segment. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_SegmentArc2(HANDLE Handle, int Flags, int* Axes, double* Center, double Angle, + double Velocity, double EndVelocity, char* Values, char* Variables, int Index, + char* Masks, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function adds an arc segment to a segmented motion and specifies the coordinates +// of center point, rotation angle, vector velocity, +// end motion velocity, and user variables parameters for the current segment. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_SegmentArc2Ext(HANDLE Handle, int Flags, int* Axes, double* Center, double Angle, + double Velocity, double EndVelocity, double Time, char* Values, + char* Variables, int Index, char* Masks, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function adds an arc segment to a segmented motion and specifies the coordinates +// of center point, rotation angle, final point for secondary axes, vector velocity, +// end motion velocity, and user variables parameters for the current segment. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_ExtendedSegmentArc2(HANDLE Handle, int Flags, int* Axes, double* Center, double Angle, + double* FinalPoint, double Velocity, double EndVelocity, double Time, + char* Values, char* Variables, int Index, char* Masks, + ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function provides a smooth transition between two segments of segmented motion. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_Stopper(HANDLE Handle, int* Axes, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function sets a projection matrix for segmented motion. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_Projection(HANDLE Handle, int* Axes, char* Matrix, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function adds a point to a single-axis multi-point or spline motion. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_AddPoint(HANDLE Handle, int Axis, double Point, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function adds a point to a multi-axis multi-point or spline motion. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_AddPointM(HANDLE Handle, int* Axes, double* Point, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function adds a point to a single-axis multi-point or spline motion. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_ExtAddPoint(HANDLE Handle, int Axis, double Point, double Rate, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function adds a point to a multi-axis multi-point or spline motion. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_ExtAddPointM(HANDLE Handle, int* Axes, double* Point, double Rate, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function adds a point to a single-axis PVT spline motion. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_AddPVTPoint(HANDLE Handle, int Axis, double Point, double Velocity, double TimeInterval, + ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function adds a point to a multi-axis PVT spline motion. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_AddPVTPointM(HANDLE Handle, int* Axis, double* Point, double* Velocity, double TimeInterval, + ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function adds a point to a single-axis PV spline motion. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_AddPVPoint(HANDLE Handle, int Axis, double Point, double Velocity, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function adds a point to a multi-axis PV spline motion. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_AddPVPointM(HANDLE Handle, int* Axis, double* Point, double* Velocity, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function adds an array of points to a single-axis multi-point or spline motion. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_AddMPoint(HANDLE Handle, int Axis, char* Name, int Count, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function adds an array of points to a multi-axis multi-point or spline motion. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_AddMPointM(HANDLE Handle, int* Axes, char* Name, int Count, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function informs the controller, that no more points will be specified for the current single-axis motion. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_EndSequence(HANDLE Handle, int Axis, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function informs the controller, that no more points or segments will be specified for the current multi-axis motion. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_EndSequenceM(HANDLE Handle, int* Axes, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function initiates data collection. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_Collect(HANDLE Handle, int Flags, char* Array, int NSample, int Period, char** Vars, + ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function initiates data collection. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_CollectB(HANDLE Handle, int Flags, char* Array, int NSample, int Period, char* Vars, + ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function initiates data collection. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_DataCollection(HANDLE Handle, int Flags, int Axis, char* Array, int NSample, int Period, + char* Vars, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function initiates data collection. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_DataCollectionExt(HANDLE Handle, int Flags, int Axis, char* Array, int NSample, double Period, + char* Vars, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function terminates data collection. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_StopCollect(HANDLE Handle, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function retrieves the current motor state. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_GetMotorState(HANDLE Handle, int Axis, int* State, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function retrieves the current axis state. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_GetAxisState(HANDLE Handle, int Axis, int* State, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function retrieves the current state of the index and mark variables. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_GetIndexState(HANDLE Handle, int Axis, int* State, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function resets the specified bits of the index/mark state. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_ResetIndexState(HANDLE Handle, int Axis, int Mask, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function retrieves the current state of the program buffer. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_GetProgramState(HANDLE Handle, int Buffer, int* State, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function retrieves the current state of the specified digital input. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_GetInput(HANDLE Handle, int Port, int Bit, int* Value, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function retrieves the current state of the specified digital input port. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_GetInputPort(HANDLE Handle, int Port, int* Value, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function retrieves the current state of the specified digital output. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_GetOutput(HANDLE Handle, int Port, int Bit, int* Value, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function retrieves the current state of the specified digital output port. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_GetOutputPort(HANDLE Handle, int Port, int* Value, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function sets the specified digital output to the specified value. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_SetOutput(HANDLE Handle, int Port, int Bit, int Value, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function sets the specified digital output port to the specified value. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_SetOutputPort(HANDLE Handle, int Port, int Value, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function retrieves the current numerical value of the specified analog inputs. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_GetAnalogInput(HANDLE Handle, int Port, int* Value, ACSC_WAITBLOCK* Wait); +int _ACSCLIB_ WINAPI acsc_GetAnalogInputNT(HANDLE Handle, int Port, double* Value, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function retrieves the current numerical value of the specified analog outputs. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_GetAnalogOutput(HANDLE Handle, int Port, int* Value, ACSC_WAITBLOCK* Wait); +int _ACSCLIB_ WINAPI acsc_GetAnalogOutputNT(HANDLE Handle, int Port, double* Value, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function writes the current numerical value to the specified analog outputs. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_SetAnalogOutput(HANDLE Handle, int Port, int Value, ACSC_WAITBLOCK* Wait); +int _ACSCLIB_ WINAPI acsc_SetAnalogOutputNT(HANDLE Handle, int Port, double Value, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function retrieves the current state of the specified extended input. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_GetExtInput(HANDLE Handle, int Port, int Bit, int* Value, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function retrieves the current state of the specified extended input port. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_GetExtInputPort(HANDLE Handle, int Port, int* Value, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function retrieves the current state of the specified extended output. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_GetExtOutput(HANDLE Handle, int Port, int Bit, int* Value, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function retrieves the current state of the specified extended output port. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_GetExtOutputPort(HANDLE Handle, int Port, int* Value, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function sets the specified extended output to the specified value. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_SetExtOutput(HANDLE Handle, int Port, int Bit, int Value, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function sets the specified extended output port to the specified value. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_SetExtOutputPort(HANDLE Handle, int Port, int Value, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function retrieves the set of bits, that indicate the motor or system faults. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_GetFault(HANDLE Handle, int Axis, int* Fault, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function retrieves the mask, that defines which controller faults are examined and processed. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_GetFaultMask(HANDLE Handle, int Axis, int* Mask, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function sets the mask, that enables/disables the examination and processing of the controller faults. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_SetFaultMask(HANDLE Handle, int Axis, int Mask, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function enables the specified motor or system fault. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_EnableFault(HANDLE Handle, int Axis, int Fault, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function disables the specified motor or system fault. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_DisableFault(HANDLE Handle, int Axis, int Fault, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function retrieves the mask, that defines for which motor or system faults the controller provides default response. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_GetResponseMask(HANDLE Handle, int Axis, int* Mask, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function sets the mask, that defines for which motor or system faults the controller provides default response. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_SetResponseMask(HANDLE Handle, int Axis, int Mask, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function enables the response to the specified motor or system fault. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_EnableResponse(HANDLE Handle, int Axis, int Response, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function disables the default response to the specified motor or system fault. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_DisableResponse(HANDLE Handle, int Axis, int Response, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function retrieves the current state of the specified safety input. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_GetSafetyInput(HANDLE Handle, int Axis, int Input, int* Value, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function retrieves the current state of the specified safety input port. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_GetSafetyInputPort(HANDLE Handle, int Axis, int* Value, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function retrieves the set of bits that define inversion for the specified safety input port. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_GetSafetyInputPortInv(HANDLE Handle, int Axis, int* Value, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function sets the set of bits that define inversion for the specified safety input port. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_SetSafetyInputPortInv(HANDLE Handle, int Axis, int Value, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function waits for the end of a motion. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_WaitMotionEnd(HANDLE Handle, int Axis, int Timeout); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function waits for the logical end of a motion. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_WaitLogicalMotionEnd(HANDLE Handle, int Axis, int Timeout); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function waits for the end of data collection. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_WaitCollectEnd(HANDLE Handle, int Timeout); //Deprecated +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function waits for the end of data collection. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_WaitCollectEndExt(HANDLE Handle, int Timeout, int Axis); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function waits for the program termination in the specified buffer. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_WaitProgramEnd(HANDLE Handle, int Buffer, int Timeout); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function waits for the specified state of the specified motor. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_WaitMotorEnabled(HANDLE Handle, int Axis, int State, int Timeout); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function waits for the specified state of the specified motor. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_WaitMotorCommutated(HANDLE Handle, int Axis, int State, int Timeout); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function waits for the specified state of digital input. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_WaitInput(HANDLE Handle, int Port, int Bit, int State, int Timeout); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function waits for user-defined condition. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_WaitUserCondition(HANDLE Handle, ACSC_USER_CONDITION_FUNC UserCondition, int Timeout); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function waits for the readiness of the PEG engine. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_WaitPegReadyNT(HANDLE Handle, int Axis, int Timeout); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function installs a user-defined callback function for the specified interrupt condition +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_SetCallback(HANDLE Handle, ACSC_INTR_CALLBACK_FUNC Callback, int Interrupt); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function installs a user-defined callback function for the specified interrupt condition +// with specified card context +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_SetCallbackExt(HANDLE Handle, ACSC_INTR_CALLBACK_FUNC_EXT Callback, void* CardContext, + int Interrupt); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function installs a user-defined callback function for the specified interrupt condition +// with specified card context +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_InstallCallback(HANDLE Handle, ACSC_USER_CALLBACK_FUNCTION Callback, void* CardContext, + int Interrupt); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function sets the priority for all callback threads. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_SetCallbackPriority(HANDLE Handle, int Priority); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function sets the mask for specified interrupt +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_SetInterruptMask(HANDLE Handle, int Interrupt, unsigned int Mask); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function sets the mask for specified callback +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_SetCallbackMask(HANDLE Handle, int Interrupt, unsigned __int64 Mask); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function retrieves the mask for specified interrupt +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_GetInterruptMask(HANDLE Handle, int Interrupt, unsigned int* Mask); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function retrieves the mask for specified callback +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_GetCallbackMask(HANDLE Handle, int Interrupt, unsigned __int64* Mask); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function creates the persistent global variable. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_DeclareVariable(HANDLE Handle, int Type, char* Name, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function deletes all persistent global variables. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_ClearVariables(HANDLE Handle, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function retrieves the firmware version of the controller. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_GetFirmwareVersion(HANDLE Handle, char* Version, int Count, int* Received, + ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function retrieves the controller serial number. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_GetSerialNumber(HANDLE Handle, char* SerialNumber, int Count, int* Received, + ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function terminates a motion using reduced deceleration profile with Reason of kill. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_KillExt(HANDLE Handle, int Axis, int Reason, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function disables motor and sets Reason of disable. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_DisableExt(HANDLE Handle, int Axis, int Reason, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function retrieves the reason why the motor was disabled. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_GetMotorError(HANDLE Handle, int Axis, int* Error, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function retrieves the termination code of the last executed motion of the specified axis. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_GetMotionError(HANDLE Handle, int Axis, int* Error, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function retrieves the error code of the last program error encountered in the specified buffer. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_GetProgramError(HANDLE Handle, int Buffer, int* Error, ACSC_WAITBLOCK* Wait); +//////////////////////////////////////////////////////////////////////////////////////////////// +// Those functions access directly DPRAM via PCI bus only +//////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_ReadDPRAMInteger(HANDLE Handle, int index, int* result); +int _ACSCLIB_ WINAPI acsc_WriteDPRAMInteger(HANDLE Handle, int index, int data); +int _ACSCLIB_ WINAPI acsc_ReadDPRAMReal(HANDLE Handle, int index, double* result); +int _ACSCLIB_ WINAPI acsc_WriteDPRAMReal(HANDLE Handle, int index, double data); +//////////////////////////////////////////////////////////////////////////////////////////////// +// Those functions provides access to Shared Memory variables +//////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_GetSharedMemoryAddress(HANDLE Handle, int NBuf, char* Var, unsigned int* Address, + ACSC_WAITBLOCK* Wait); +int _ACSCLIB_ WINAPI acsc_ReadSharedMemoryReal(HANDLE Handle, unsigned int Address, int From1, int To1, int From2, + int To2, double* Values); +int _ACSCLIB_ WINAPI acsc_ReadSharedMemoryInteger(HANDLE Handle, unsigned int Address, int From1, int To1, int From2, + int To2, int* Values); +int _ACSCLIB_ WINAPI acsc_WriteSharedMemoryReal(HANDLE Handle, unsigned int Address, int From1, int To1, int From2, + int To2, double* Values); +int _ACSCLIB_ WINAPI acsc_WriteSharedMemoryInteger(HANDLE Handle, unsigned int Address, int From1, int To1, int From2, + int To2, int* Values); +///////////////////////////////////////////////////////////////////////////////////////////////////// +//This function defines communication server IP address +///////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_SetServer(char* IP); +///////////////////////////////////////////////////////////////////////////////////////////////////// +//This function defines communication server IP address and Port +///////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_SetServerExt(char* IP, int Port); +int _ACSCLIB_ WINAPI acsc_SetServerExtLogin(char* IP, int Port, char* Username, char* Password, char* Domain); +///////////////////////////////////////////////////////////////////////////////////////////////////// +// These functions are related to Position Event Generation (PEG) +///////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_PegI(HANDLE Handle, int Flags, int Axis, double Width, int FirstPoint, int Interval, + int LastPoint, int TbNumber, double TbPeriod, ACSC_WAITBLOCK* Wait); +int _ACSCLIB_ WINAPI acsc_PegR(HANDLE Handle, int Flags, int Axis, double Width, char* PointArray, char* StateArray, + int TbNumber, double TbPeriod, ACSC_WAITBLOCK* Wait); +int _ACSCLIB_ WINAPI acsc_PegInc(HANDLE Handle, int Flags, int Axis, double Width, double FirstPoint, double Interval, + double LastPoint, int TbNumber, double TbPeriod, ACSC_WAITBLOCK* Wait); +int _ACSCLIB_ WINAPI acsc_PegRandom(HANDLE Handle, int Flags, int Axis, double Width, char* PointArray, + char* StateArray, int TbNumber, double TbPeriod, ACSC_WAITBLOCK* Wait); +int _ACSCLIB_ WINAPI acsc_AssignPins(HANDLE Handle, int Axis, unsigned short Mask, ACSC_WAITBLOCK* Wait); +int _ACSCLIB_ WINAPI acsc_StopPeg(HANDLE Handle, int Axis, ACSC_WAITBLOCK* Wait); +int _ACSCLIB_ WINAPI acsc_AssignPegNT(HANDLE Handle, int Axis, int EngToEncBitCode, int GpOutsBitCode, + ACSC_WAITBLOCK* Wait); +int _ACSCLIB_ WINAPI acsc_AssignPegOutputsNT(HANDLE Handle, int Axis, int OutputIndex, int BitCode, + ACSC_WAITBLOCK* Wait); +int _ACSCLIB_ WINAPI +acsc_AssignFastInputsNT(HANDLE Handle, int Axis, int InputIndex, int BitCode, ACSC_WAITBLOCK* Wait); +int _ACSCLIB_ WINAPI acsc_PegIncNT(HANDLE Handle, int Flags, int Axis, double Width, double FirstPoint, double Interval, + double LastPoint, int TbNumber, double TbPeriod, ACSC_WAITBLOCK* Wait); +int _ACSCLIB_ WINAPI acsc_PegRandomNT(HANDLE Handle, int Flags, int Axis, double Width, int Mode, int FirstIndex, + int LastIndex, char* PointArray, char* StateArray, int TbNumber, double TbPeriod, + ACSC_WAITBLOCK* Wait); +int _ACSCLIB_ WINAPI acsc_StartPegNT(HANDLE Handle, int Axis, ACSC_WAITBLOCK* Wait); +int _ACSCLIB_ WINAPI acsc_StopPegNT(HANDLE Handle, int Axis, ACSC_WAITBLOCK* Wait); +///////////////////////////////////////////////////////////////////////////////////////////////////// +//These functions are used for reading data from text files +///////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_LoadFileToIntegerVariable(HANDLE Handle, int NBuf, char* Var, int From1, int To1, int From2, + int To2, char* Filename, ACSC_WAITBLOCK* Wait); +int _ACSCLIB_ WINAPI acsc_LoadFileToRealVariable(HANDLE Handle, int NBuf, char* Var, int From1, int To1, int From2, + int To2, char* Filename, ACSC_WAITBLOCK* Wait); +int _ACSCLIB_ WINAPI acsc_DownloadBinVariableToFile(HANDLE Handle, int NBuf, char* Var, int Size, int From1, int To1, + int From2, int To2, char* Filename, char* Format, + ACSC_WAITBLOCK* Wait); +int _ACSCLIB_ WINAPI acsc_SetLogFileOptions(HANDLE Handle, ACSC_LOG_DETALIZATION_LEVEL Detalization, + ACSC_LOG_DATA_PRESENTATION Presentation); +int _ACSCLIB_ WINAPI acsc_LoadDataToController(HANDLE Handle, int Dest, char* DestName, int From1, int To1, int From2, + int To2, char* SrcFileName, int SrcNumFormat, BOOL bTranspose, + ACSC_WAITBLOCK* Wait); +int _ACSCLIB_ WINAPI acsc_UploadDataFromController(HANDLE Handle, int Src, char* SrcName, int SrcNumFormat, int From1, + int To1, int From2, int To2, char* DestFileName, char* DestNumFormat, + BOOL bTranspose, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function copies file to controller +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_CopyFileToController(HANDLE Handle, char* SourceFileName, char* DestinationFileName, + ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// The function deletes file from controller +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_DeleteFileFromController(HANDLE Handle, char* FileName, ACSC_WAITBLOCK* Wait); +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// The function retrieves the list of all currently opened communication channels(connections), on active Server.// +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_GetConnectionsList(ACSC_CONNECTION_DESC* ConnectionsList, int MaxNumConnections, + int* NumConnections); +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// The function retrieves additional information of specified connection, on active Server. // +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_GetConnectionInfo(HANDLE Handle, ACSC_CONNECTION_INFO* ConnectionInfo); +//////////////////////////////////////////////////////////////////////////////////////// +// The function terminates single communication channel(connection), on active Server.// +//////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_TerminateConnection(ACSC_CONNECTION_DESC* Connection); +//////////////////////////////////////////////////////////////////////////////////////// +// The functions for managing new UMD EmergencyStop functionality // +//////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_RegisterEmergencyStop(); +int _ACSCLIB_ WINAPI acsc_UnregisterEmergencyStop(); +//////////////////////////////////////////////////////////////////////////////////////// +// The function returns version of UMD // +//////////////////////////////////////////////////////////////////////////////////////// +unsigned int _ACSCLIB_ WINAPI acsc_GetUMDVersion(); +//////////////////////////////////////////////////////////////////////////////////////// +// These functions for Application Saver Loader functionality // +//////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_AnalyzeApplication(HANDLE Handle, const char* FileName, ACSC_APPSL_INFO** Info, + ACSC_WAITBLOCK* Wait); +int _ACSCLIB_ WINAPI acsc_FreeApplication(ACSC_APPSL_INFO* Info); +int _ACSCLIB_ WINAPI acsc_SaveApplication(HANDLE Handle, const char* FileName, ACSC_APPSL_INFO* Info, + ACSC_WAITBLOCK* Wait); +int _ACSCLIB_ WINAPI acsc_LoadApplication(HANDLE Handle, const char* FileName, ACSC_APPSL_INFO* Info, + ACSC_WAITBLOCK* Wait); +//////////////////////////////////////////////////////////////////////////////////////// +// These functions handles FRF // +//////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_FFT(double* in, double* outReal, double* outImag, int length, int* errorCode); +int _ACSCLIB_ WINAPI acsc_FRF_Measure(HANDLE Handle, FRF_INPUT* inputParams, FRF_OUTPUT** outputParams, int* errorCode); +int _ACSCLIB_ WINAPI acsc_FRF_Stop(HANDLE Handle, int Axis, int* errorCode); +int _ACSCLIB_ WINAPI acsc_FRF_CalculateMeasurementDuration(FRF_DURATION_CALCULATION_PARAMETERS* params, + double* duration, int* errorCode); +int _ACSCLIB_ WINAPI acsc_FRF_InitInput(FRF_INPUT* inputParams, int* errorCode); +int _ACSCLIB_ WINAPI acsc_FRF_FreeOutput(FRF_OUTPUT* inputParams, int* errorCode); +int _ACSCLIB_ WINAPI acsc_FRF_ReadServoParameters(HANDLE Handle, int axis, SERVO_PARAMETERS* servoParameters, + int* errorCode); +int _ACSCLIB_ WINAPI acsc_FRF_CalculateControllerFRD(SERVO_PARAMETERS* servoParameters, FRF_LOOP_TYPE loopType, + double* frequencyHz, int frequencyLength, FRD** controller, + int* errorCode); +int _ACSCLIB_ WINAPI acsc_FRF_CalculateOpenLoopFRD(SERVO_PARAMETERS* servoParameters, FRD* plant, + FRF_LOOP_TYPE loopType, FRD** openLoop, int* errorCode); +int _ACSCLIB_ WINAPI acsc_FRF_CalculateClosedLoopFRD(SERVO_PARAMETERS* servoParameters, FRD* plant, + FRF_LOOP_TYPE loopType, FRD** closedLoop, int* errorCode); +int _ACSCLIB_ WINAPI acsc_FRF_CalculateStabilityMargins(FRD* openLoop, FRF_STABILITY_MARGINS** stabilityMargins, + int* errorCode); +int _ACSCLIB_ WINAPI acsc_FRF_FreeFRD(FRD* inputParams, int* errorCode); +int _ACSCLIB_ WINAPI acsc_FRF_FreeStabilityMargins(FRF_STABILITY_MARGINS* inputParams, int* errorCode); +int _ACSCLIB_ WINAPI acsc_JitterAnalysis(JITTER_ANALYSIS_INPUT* in, JITTER_ANALYSIS_OUTPUT** out, int* errorCode); +int _ACSCLIB_ WINAPI acsc_JitterAnalysis_FreeOutput(JITTER_ANALYSIS_OUTPUT* inputParams, int* errorCode); +////////////////////////////////////////////////////////////////////////////////////////////////// +// These functions reboot controler with or without restoring defaults +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_ControllerReboot(HANDLE Handle, int Timeout); +int _ACSCLIB_ WINAPI acsc_ControllerFactoryDefault(HANDLE Handle, int Timeout); +////////////////////////////////////////////////////////////////////////////////////////////////// +// This function saves to flash +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_ControllerSaveToFlash(HANDLE Handle, int* Parameters, int* Buffers, int* SPPrograms, + char* UserArrays); +////////////////////////////////////////////////////////////////////////////////////////////////// +// These functions are related to EtherCAT +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_GetEtherCATState(HANDLE Handle, int* State, ACSC_WAITBLOCK* Wait); +int _ACSCLIB_ WINAPI acsc_GetEtherCATError(HANDLE Handle, int* Error, ACSC_WAITBLOCK* Wait); +int _ACSCLIB_ WINAPI acsc_MapEtherCATInput(HANDLE Handle, int Flags, int Offset, char* VariableName, + ACSC_WAITBLOCK* Wait); +int _ACSCLIB_ WINAPI acsc_MapEtherCATOutput(HANDLE Handle, int Flags, int Offset, char* VariableName, + ACSC_WAITBLOCK* Wait); +int _ACSCLIB_ WINAPI acsc_UnmapEtherCATInputsOutputs(HANDLE Handle, ACSC_WAITBLOCK* Wait); +int _ACSCLIB_ WINAPI acsc_GetEtherCATSlaveIndex(HANDLE Handle, int VendorID, int ProductID, int Count, + double* SlaveIndex, ACSC_WAITBLOCK* Wait); +int _ACSCLIB_ WINAPI acsc_GetEtherCATSlaveOffset(HANDLE Handle, char* VariableName, int SlaveIndex, double* SlaveOffset, + ACSC_WAITBLOCK* Wait); +int _ACSCLIB_ WINAPI acsc_GetEtherCATSlaveVendorID(HANDLE Handle, int SlaveIndex, double* VendorID, + ACSC_WAITBLOCK* Wait); +int _ACSCLIB_ WINAPI acsc_GetEtherCATSlaveProductID(HANDLE Handle, int SlaveIndex, double* ProductID, + ACSC_WAITBLOCK* Wait); +int _ACSCLIB_ WINAPI acsc_GetEtherCATSlaveRevision(HANDLE Handle, int SlaveIndex, double* Revision, + ACSC_WAITBLOCK* Wait); +int _ACSCLIB_ WINAPI acsc_GetEtherCATSlaveType(HANDLE Handle, int VendorID, int ProductID, double* SlaveType, + ACSC_WAITBLOCK* Wait); +int _ACSCLIB_ WINAPI +acsc_GetEtherCATSlaveState(HANDLE Handle, int SlaveIndex, double* SlaveState, ACSC_WAITBLOCK* Wait); +int _ACSCLIB_ WINAPI acsc_DownloadFileOverEtherCAT(HANDLE Handle, char* Path, char* Filename, int SlaveIndex, + ACSC_WAITBLOCK* Wait); +int _ACSCLIB_ WINAPI acsc_ReadSDOValueOverEtherCAT(HANDLE Handle, int Flags, int SlaveIndex, int Index, int SubIndex, + double* Value, ACSC_WAITBLOCK* Wait); +int _ACSCLIB_ WINAPI acsc_WriteSDOValueOverEtherCAT(HANDLE Handle, int Flags, int SlaveIndex, int Index, int SubIndex, + double Value, ACSC_WAITBLOCK* Wait); +//////////////////////////////////////////////////////////////////////////////////////// +// These functions returns RAM / Flash Information // +//////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_GetVolatileMemoryUsage(HANDLE Handle, double* UsageInPercents, ACSC_WAITBLOCK* Wait); +int _ACSCLIB_ WINAPI acsc_GetVolatileMemoryTotal(HANDLE Handle, double* TotalMemory, ACSC_WAITBLOCK* Wait); +int _ACSCLIB_ WINAPI acsc_GetVolatileMemoryFree(HANDLE Handle, double* FreeMemory, ACSC_WAITBLOCK* Wait); +int _ACSCLIB_ WINAPI acsc_GetNonVolatileMemoryUsage(HANDLE Handle, double* UsageInPercents, ACSC_WAITBLOCK* Wait); +int _ACSCLIB_ WINAPI acsc_GetNonVolatileMemoryTotal(HANDLE Handle, double* TotalMemory, ACSC_WAITBLOCK* Wait); +int _ACSCLIB_ WINAPI acsc_GetNonVolatileMemoryFree(HANDLE Handle, double* FreeMemory, ACSC_WAITBLOCK* Wait); +//////////////////////////////////////////////////////////////////////////////////////// +// These functions are used for starting / stopping SPiiPlusSC // +//////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_StartSPiiPlusSC(); +int _ACSCLIB_ WINAPI acsc_StopSPiiPlusSC(); +//////////////////////////////////////////////////////////////////////////////////////// +// These functions are used for starting / stopping SPiiPlus Simulator via RPC // +//////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_CloseSimulator(); +HANDLE _ACSCLIB_ WINAPI acsc_OpenCommSimulator(); +////////////////////////////////////////////////////////////////////////////////////////////////// +// Undocumented: The function waits for completion of asynchronous call and retrieves a data. *Buf pointer must be freed after use. +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_WaitForResult(HANDLE Handle, void** Buf, int* Received, ACSC_RETURN_TYPE* ReturnType, + ACSC_WAITBLOCK* Wait, int Timeout); +////////////////////////////////////////////////////////////////////////////////////////////////// +// Undocumented: Read variable typeless +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_ReadTypeless(HANDLE Handle, int NBuf, char* Var, int From1, int To1, int From2, int To2, + void** pValues, int* DataSize, int* Dim1, int* Dim2, int* DataOffset, + ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// Undocumented: Read variable typeless +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_ReadTypeless2(HANDLE Handle, int NBuf, char* Var, int From1, int To1, int From2, int To2, + void** pValues, int* DataSize, int* Dim1, int* Dim2, int* DataOffset, + ACSC_RETURN_TYPE ReturnType, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// Undocumented: Raw Transaction +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_RawTransaction(HANDLE Handle, char* OutBuf, int OutCount, BSTR* Reply, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// Undocumented: Transaction2 +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_Transaction2(HANDLE Handle, char* OutBuf, int OutCount, BSTR* Reply, ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// Undocumented: Transaction3 +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_Transaction3(HANDLE Handle, char* OutBuf, int OutCount, void** Reply, unsigned long* N, + ACSC_WAITBLOCK* Wait); +////////////////////////////////////////////////////////////////////////////////////////////////// +// Undocumented: UploadEntireBuffer +////////////////////////////////////////////////////////////////////////////////////////////////// +int _ACSCLIB_ WINAPI acsc_UploadEntireBuffer(HANDLE Handle, char* OutBuf, int OutCount, void** Reply, unsigned long* N, + ACSC_WAITBLOCK* Wait); +#else // defined (ACSC_RUNTIME_DYNAMIC_LINKING) +// function type definitions + typedef int (WINAPI *ACSC_AddMPoint)(HANDLE, int, char*, int, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_AddMPointM)(HANDLE, int*, char*, int, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_AddPoint)(HANDLE, int, double, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_AddPointM)(HANDLE, int*, double*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_AppendBuffer)(HANDLE, int, char*, int, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_Arc1)(HANDLE, int*, double*, double*, int, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_Arc2)(HANDLE, int*, double*, double, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_Break)(HANDLE, int, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_BreakM)(HANDLE, int*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_CancelOperation)(HANDLE, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_CaptureComm)(HANDLE); + typedef int (WINAPI *ACSC_ClearBreakpoints)(HANDLE handle, int Buffer, int line, ACSC_WAITBLOCK* wait); + typedef int (WINAPI *ACSC_ClearBuffer)(HANDLE, int, int, int, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_ClearVariables)(HANDLE, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_CloseComm)(HANDLE); + typedef int (WINAPI *ACSC_CloseHistoryBuffer)(HANDLE); + typedef int (WINAPI *ACSC_CloseLogFile)(HANDLE); + typedef int (WINAPI *ACSC_CloseSCLogFile)(HANDLE); + typedef int (WINAPI *ACSC_CloseMessageBuffer)(HANDLE); + typedef int (WINAPI *ACSC_Collect)(HANDLE, int, char*, int, int, char**, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_Command)(HANDLE, char*, int, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_Commut)(HANDLE, int, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_CommutExt)(HANDLE, int, float, int, int, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_CompileBuffer)(HANDLE, int, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_DeclareVariable)(HANDLE, int, char*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_Disable)(HANDLE, int, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_DisableAll)(HANDLE, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_DisableFault)(HANDLE, int, int, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_DisableM)(HANDLE, int*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_DisableResponse)(HANDLE, int, int, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_DownloadBuffer)(HANDLE, int, char*, int, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_Enable)(HANDLE, int, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_EnableFault)(HANDLE, int, int, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_EnableM)(HANDLE, int*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_EnableResponse)(HANDLE, int, int, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_EndSequence)(HANDLE, int, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_EndSequenceM)(HANDLE, int*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_ExtAddPoint)(HANDLE, int, double, double, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_ExtAddPointM)(HANDLE, int*, double*, double, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_ExtArc1)(HANDLE, int*, double*, double*, int, double, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_ExtArc2)(HANDLE, int*, double*, double, double, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_ExtLine)(HANDLE, int*, double*, double, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_ExtToPoint)(HANDLE, int, int, double, double, double, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_ExtToPointM)(HANDLE, int, int*, double*, double, double, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_FlushLogFile)(char*); + typedef int (WINAPI *ACSC_FlushSCLogFile)(char*); + typedef int (WINAPI *ACSC_GetAcceleration)(HANDLE, int, double*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_GetAnalogInput)(HANDLE, int, int*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_GetAnalogOutput)(HANDLE, int, int*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_GetAxisState)(HANDLE, int, int*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_GetBreakpointsList)(HANDLE handle, int BufferNum, int* Array, int Size, int* replySize, ACSC_WAITBLOCK* wait); + typedef int (WINAPI *ACSC_GetCommOptions)(HANDLE, unsigned int*); + typedef int (WINAPI *ACSC_GetDeceleration)(HANDLE, int, double*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_GetDefaultTimeout)(HANDLE); + typedef int (WINAPI *ACSC_GetErrorString)(HANDLE, int, char*, int, int*); + typedef int (WINAPI *ACSC_GetExtInput)(HANDLE, int, int, int*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_GetExtInputPort)(HANDLE, int, int*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_GetExtOutput)(HANDLE, int, int, int*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_GetExtOutputPort)(HANDLE, int, int*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_GetFPosition)(HANDLE, int, double*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_GetFVelocity)(HANDLE, int, double*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_GetFault)(HANDLE, int, int*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_GetFaultMask)(HANDLE, int, int*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_GetFirmwareVersion)(HANDLE, char*, int, int*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_GetHistory)(HANDLE, char*, int, int*, BOOL); + typedef int (WINAPI *ACSC_GetIndexState)(HANDLE, int, int*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_GetInput)(HANDLE, int, int, int*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_GetInputPort)(HANDLE, int, int*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_GetInterruptMask)(HANDLE, int, unsigned int*); + typedef int (WINAPI *ACSC_GetCallbackMask)(HANDLE, int, unsigned __int64*); + typedef int (WINAPI *ACSC_GetJerk)(HANDLE, int, double*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_GetKillDeceleration)(HANDLE, int, double*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_GetLastError)(); + typedef unsigned int (WINAPI *ACSC_GetLibraryVersion)(); + typedef int (WINAPI *ACSC_GetMessage)(HANDLE, char*, int, int*, BOOL); + typedef int (WINAPI *ACSC_GetMotionError)(HANDLE, int, int*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_GetMotorError)(HANDLE, int, int*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_GetMotorState)(HANDLE, int, int*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_GetOutput)(HANDLE, int, int, int*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_GetOutputPort)(HANDLE, int, int*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_GetPCICards)(ACSC_PCI_SLOT*, int, int*); + typedef int (WINAPI *ACSC_GetEthernetCards) (struct in_addr*, int, int*, unsigned long); + typedef int (WINAPI *ACSC_GetEthernetCardsExt) (struct ACSC_CONTROLLER_INFO*, unsigned long, int, int*, unsigned long); + typedef int (WINAPI *ACSC_GetProgramError)(HANDLE, int, int*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_GetProgramState)(HANDLE, int, int*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_GetRPosition)(HANDLE, int, double*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_GetRVelocity)(HANDLE, int, double*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_GetResponseMask)(HANDLE, int, int*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_GetSafetyInput)(HANDLE, int, int, int*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_GetSafetyInputPort)(HANDLE, int, int*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_GetSafetyInputPortInv)(HANDLE, int, int*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_GetSerialNumber)(HANDLE, char*, int, int*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_GetTimeout)(HANDLE); + typedef int (WINAPI *ACSC_GetVelocity)(HANDLE, int, double*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_Go)(HANDLE, int, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_GoM)(HANDLE, int*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_Group)(HANDLE, int*, ACSC_WAITBLOCK* Wait); + typedef int (WINAPI *ACSC_Halt)(HANDLE, int, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_HaltM)(HANDLE, int*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_Jog)(HANDLE, int, int, double, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_JogM)(HANDLE, int, int*, int*, double, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_Kill)(HANDLE, int, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_KillExt)(HANDLE, int, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_DisableExt)(HANDLE, int, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_KillAll)(HANDLE, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_KillM)(HANDLE, int*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_Line)(HANDLE, int*, double*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_LoadBuffer)(HANDLE, int, char*, int, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_MultiPoint)(HANDLE, int, int, double, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_MultiPointM)(HANDLE, int, int*, double, ACSC_WAITBLOCK*); + typedef HANDLE(WINAPI *ACSC_OpenCommDirect)(); + typedef int (WINAPI *ACSC_CloseSimulator)(); + typedef HANDLE(WINAPI *ACSC_OpenCommSimulator)(); + typedef HANDLE(WINAPI *ACSC_OpenCommEthernet)(char*, int); + typedef HANDLE(WINAPI *ACSC_OpenCommEthernetUDP)(char*, int); + typedef HANDLE(WINAPI *ACSC_OpenCommEthernetTCP)(char*, int); + typedef HANDLE(WINAPI *ACSC_OpenCommSerial)(int, int); + typedef HANDLE(WINAPI *ACSC_OpenCommPCI)(int); + typedef LP_ACSC_HISTORYBUFFER(WINAPI *ACSC_OpenHistoryBuffer)(HANDLE, int); + typedef int (WINAPI *ACSC_OpenLogFile)(HANDLE, char*); + typedef int (WINAPI *ACSC_OpenSCLogFile)(HANDLE, char*); + typedef LP_ACSC_HISTORYBUFFER(WINAPI *ACSC_OpenMessageBuffer)(HANDLE, int); + typedef int (WINAPI *ACSC_Projection)(HANDLE, int*, char*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_ReadDPRAMInteger)(HANDLE, int, int*); + typedef int (WINAPI *ACSC_ReadDPRAMReal)(HANDLE, int, double*); + typedef int (WINAPI *ACSC_ReadInteger)(HANDLE, int, char*, int, int, int, int, int*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_ReadReal)(HANDLE, int, char*, int, int, int, int, double*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_Receive)(HANDLE, char*, int, int*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_ReleaseComm)(HANDLE); + typedef int (WINAPI *ACSC_ResetIndexState)(HANDLE, int, int, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_RunBuffer)(HANDLE, int, char*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_Segment)(HANDLE, int, int*, double*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_Send)(HANDLE, char*, int, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_SetAcceleration)(HANDLE, int, double, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_SetAccelerationImm)(HANDLE, int, double, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_SetAnalogOutput)(HANDLE, int, int, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_SetBreakpoint)(HANDLE, int, int, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_SetCallback)(HANDLE, ACSC_INTR_CALLBACK_FUNC, int); + typedef int (WINAPI *ACSC_SetCallbackPriority)(HANDLE, int); + typedef int (WINAPI *ACSC_SetCommOptions)(HANDLE, unsigned int); + typedef int (WINAPI *ACSC_SetDeceleration)(HANDLE, int, double, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_SetDecelerationImm)(HANDLE, int, double, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_SetExtOutput)(HANDLE, int, int, int, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_SetExtOutputPort)(HANDLE, int, int, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_SetFPosition)(HANDLE, int, double, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_SetFaultMask)(HANDLE, int, int, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_SetInterruptMask)(HANDLE, int, unsigned int); + typedef int (WINAPI *ACSC_SetCallbackMask)(HANDLE, int, unsigned __int64); + typedef int (WINAPI *ACSC_SetIterations)(HANDLE, int); + typedef int (WINAPI *ACSC_SetJerk)(HANDLE, int, double, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_SetJerkImm)(HANDLE, int, double, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_SetKillDeceleration)(HANDLE, int, double, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_SetKillDecelerationImm)(HANDLE, int, double, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_SetMaster)(HANDLE, int, char*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_SetOutput)(HANDLE, int, int, int, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_SetOutputPort)(HANDLE, int, int, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_SetRPosition)(HANDLE, int, double, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_SetResponseMask)(HANDLE, int, int, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_SetSafetyInputPortInv)(HANDLE, int, int, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_SetTimeout)(HANDLE, int); + typedef int (WINAPI *ACSC_SetVelocity)(HANDLE, int, double, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_SetVelocityImm)(HANDLE, int, double, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_Slave)(HANDLE, int, int, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_SlaveStalled)(HANDLE, int, int, double, double, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_Spline)(HANDLE, int, int, double, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_SplineM)(HANDLE, int, int*, double, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_Split)(HANDLE, int*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_SplitAll)(HANDLE, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_StopBuffer)(HANDLE, int, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_StopCollect)(HANDLE, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_Stopper)(HANDLE, int*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_SuspendBuffer)(HANDLE, int, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_ToPoint)(HANDLE, int, int, double, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_ToPointM)(HANDLE, int, int*, double*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_Transaction)(HANDLE, char*, int, char*, int, int*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_UploadBuffer)(HANDLE, int, int, char*, int, int*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_WaitCollectEnd)(HANDLE, int); + typedef int (WINAPI *ACSC_WaitCollectEndExt)(HANDLE, int, int); + typedef int (WINAPI *ACSC_WaitForAsyncCall)(HANDLE, void*, int*, ACSC_WAITBLOCK*, int); + typedef int (WINAPI *ACSC_WaitInput)(HANDLE, int, int, int, int); + typedef int (WINAPI *ACSC_WaitLogicalMotionEnd)(HANDLE, int, int); + typedef int (WINAPI *ACSC_WaitMotionEnd)(HANDLE, int, int); + typedef int (WINAPI *ACSC_WaitMotorEnabled)(HANDLE, int, int, int); + typedef int (WINAPI *ACSC_WaitMotorCommutated)(HANDLE, int, int, int); + typedef int (WINAPI *ACSC_WaitProgramEnd)(HANDLE, int, int); + typedef int (WINAPI *ACSC_WaitUserCondition)(HANDLE, ACSC_USER_CONDITION_FUNC, int); + typedef int (WINAPI *ACSC_WriteDPRAMInteger)(HANDLE, int, int); + typedef int (WINAPI *ACSC_WriteDPRAMReal)(HANDLE, int, double); + typedef int (WINAPI *ACSC_WriteInteger)(HANDLE, int, char*, int, int, int, int, int*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_WriteLogFile)(HANDLE, char*, int); + typedef int (WINAPI *ACSC_WriteSCLogFile)(HANDLE, char*, int); + typedef int (WINAPI *ACSC_WriteReal)(HANDLE, int, char*, int, int, int, int, double*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_LoadBufferIgnoreServiceLines)(HANDLE, int, char*, int, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_LoadBuffersFromFile)(HANDLE, char*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_PegI)(HANDLE, int, int, double, int, int, int, int, double, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_PegR)(HANDLE, int, int, double, char*, char*, int, double, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_PegInc)(HANDLE, int, int, double, double, double, double, int, double, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_PegRandom)(HANDLE, int, int, double, char*, char*, int, double, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_AssignPins)(HANDLE, int, unsigned short, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_StopPeg)(HANDLE, int, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_AssignPegNT)(HANDLE Handle, int Axis, int EngToEncBitCode, int GpOutsBitCode, ACSC_WAITBLOCK* Wait); + typedef int (WINAPI *ACSC_AssignPegOutputsNT)(HANDLE Handle, int Axis, int OutputIndex, int BitCode, ACSC_WAITBLOCK* Wait); + typedef int (WINAPI *ACSC_AssignFastInputsNT)(HANDLE Handle, int Axis, int InputIndex, int BitCode, ACSC_WAITBLOCK* Wait); + typedef int (WINAPI *ACSC_PegIncNT)(HANDLE Handle, int Flags, int Axis, double Width, double FirstPoint, double Interval, double LastPoint, int TbNumber, double TbPeriod, ACSC_WAITBLOCK* Wait); + typedef int (WINAPI *ACSC_PegRandomNT)(HANDLE Handle, int Flags, int Axis, double Width, int Mode, int FirstIndex, int LastIndex, char* PointArray, char* StateArray, int TbNumber, double TbPeriod, ACSC_WAITBLOCK* Wait); + typedef int (WINAPI *ACSC_WaitPegReadyNT)(HANDLE Handle, int Axis, int Timeout); + typedef int (WINAPI *ACSC_StartPegNT)(HANDLE Handle, int Axis, ACSC_WAITBLOCK* Wait); + typedef int (WINAPI *ACSC_StopPegNT)(HANDLE Handle, int Axis, ACSC_WAITBLOCK* Wait); + typedef int (WINAPI *ACSC_CollectB)(HANDLE, int, char*, int, int, char*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_DataCollection)(HANDLE, int, int, char*, int, int, char*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_DataCollectionExt)(HANDLE Handle, int Flags, int Axis, char* Array, int NSample, double Period, char* Vars, ACSC_WAITBLOCK* Wait); + typedef int (WINAPI *ACSC_AddPVPoint)(HANDLE, int, double, double, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_AddPVPointM)(HANDLE, int*, double*, double*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_AddPVTPoint)(HANDLE, int, double, double, double, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_AddPVTPointM)(HANDLE, int*, double*, double*, double, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_LoadFileToRealVariable)(HANDLE, int, char*, int, int, int, int, char*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_LoadFileToIntegerVariable)(HANDLE, int, char*, int, int, int, int, char*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_LoadDataToController)(HANDLE, int, char*, int, int, int, int, char*, int, BOOL, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_UploadDataFromController)(HANDLE, int, char*, int, int, int, int, int, char*, char*, BOOL, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_SetQueueOverflowTimeout)(HANDLE, int); + typedef int (WINAPI *ACSC_GetQueueOverflowTimeout)(HANDLE); + typedef int (WINAPI *ACSC_SetTargetPosition)(HANDLE, int, double, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_GetTargetPosition)(HANDLE, int, double*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_SetTargetPositionM)(HANDLE, int*, double*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_Track)(HANDLE, int, int, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_TrackM)(HANDLE, int, int*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_FaultClearM)(HANDLE, int*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_FaultClear)(HANDLE, int, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_Getconf)(HANDLE, int, int, int*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_Setconf)(HANDLE, int, int, int, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_SetCallbackExt)(HANDLE, ACSC_INTR_CALLBACK_FUNC_EXT, void*, int); + typedef int (WINAPI *ACSC_InstallCallback)(HANDLE, ACSC_USER_CALLBACK_FUNCTION, void*, int); + typedef int (WINAPI *ACSC_DownloadBinVariableToFile)(HANDLE, int, char*, int, int, int, int, int, char*, char*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_SetLogFileOptions)(HANDLE, ACSC_LOG_DETALIZATION_LEVEL, ACSC_LOG_DATA_PRESENTATION); + typedef int (WINAPI *ACSC_GetConf)(HANDLE, int, int, double*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_SetConf)(HANDLE, int, int, double, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_SysInfo)(HANDLE Handle, int Key, double* Value, ACSC_WAITBLOCK* Wait); + typedef int (WINAPI *ACSC_GetAxesCount)(HANDLE Handle, double* Value, ACSC_WAITBLOCK* Wait); + typedef int (WINAPI *ACSC_GetBuffersCount)(HANDLE Handle, double* Value, ACSC_WAITBLOCK* Wait); + typedef int (WINAPI *ACSC_GetDBufferIndex)(HANDLE Handle, double* Value, ACSC_WAITBLOCK* Wait); + typedef int (WINAPI *ACSC_SetServer)(char* IP); + typedef int (WINAPI *ACSC_SetServerExt)(char*, int); + typedef int (WINAPI *ACSC_SetServerExtLogin)(char*, int, char*, char*, char*); + typedef int (WINAPI *ACSC_GetSingleMessage)(HANDLE Handle, char* Buf, int Count, int* Received, int Timeout); + typedef int (WINAPI *ACSC_GetConnectionsList)(ACSC_CONNECTION_DESC* ConnectionsList, int MaxNumConnections, int* NumConnections); + typedef int (WINAPI *ACSC_GetConnectionInfo)(HANDLE Handle, ACSC_CONNECTION_INFO* ConnectionInfo); + typedef int (WINAPI *ACSC_TerminateConnection)(ACSC_CONNECTION_DESC* Connection); + typedef int (WINAPI *ACSC_GetLogData)(HANDLE Handle, char* Buf, int Count, int* Received); + typedef int (WINAPI *ACSC_RegisterEmergencyStop)(); + typedef int (WINAPI *ACSC_UnregisterEmergencyStop)(); + typedef unsigned int (WINAPI *ACSC_GetUMDVersion)(); + typedef int (WINAPI* ACSC_AnalyzeApplication)(HANDLE, const char*, ACSC_APPSL_INFO**, ACSC_WAITBLOCK*); + typedef int (WINAPI* ACSC_FreeApplication)(ACSC_APPSL_INFO*); + typedef int (WINAPI* ACSC_SaveApplication)(HANDLE, const char*, ACSC_APPSL_INFO*, ACSC_WAITBLOCK*); + typedef int (WINAPI* ACSC_LoadApplication)(HANDLE, const char*, ACSC_APPSL_INFO*, ACSC_WAITBLOCK*); + typedef int (WINAPI* ACSC_FFT)(double*, double*, double*, int, int*); + typedef int (WINAPI* ACSC_FRF_Measure)(HANDLE, FRF_INPUT*, FRF_OUTPUT**, int*); + typedef int (WINAPI* ACSC_FRF_Stop)(HANDLE, int, int*); + typedef int (WINAPI* ACSC_FRF_CalculateMeasurementDuration)(FRF_DURATION_CALCULATION_PARAMETERS*, double*, int*); + typedef int (WINAPI* ACSC_FRF_InitInput)(FRF_INPUT*, int*); + typedef int (WINAPI* ACSC_FRF_FreeOutput)(FRF_OUTPUT*, int*); + typedef int (WINAPI* ACSC_FRF_ReadServoParameters)(HANDLE, int, SERVO_PARAMETERS*, int*); + typedef int (WINAPI* ACSC_FRF_CalculateControllerFRD)(SERVO_PARAMETERS*, FRF_LOOP_TYPE, double*, int, FRD**, int*); + typedef int (WINAPI* ACSC_FRF_CalculateOpenLoopFRD)(SERVO_PARAMETERS*, FRD*, FRF_LOOP_TYPE, FRD**, int*); + typedef int (WINAPI* ACSC_FRF_CalculateClosedLoopFRD)(SERVO_PARAMETERS*, FRD*, FRF_LOOP_TYPE, FRD**, int*); + typedef int (WINAPI* ACSC_FRF_CalculateStabilityMargins)(FRD*, FRF_STABILITY_MARGINS**, int*); + typedef int (WINAPI* ACSC_FRF_FreeFRD)(FRD*, int*); + typedef int (WINAPI* ACSC_FRF_FreeStabilityMargins)(FRF_STABILITY_MARGINS*, int*); + typedef int (WINAPI* ACSC_JitterAnalysis)(JITTER_ANALYSIS_INPUT*, JITTER_ANALYSIS_OUTPUT**, int*); + typedef int (WINAPI* ACSC_JitterAnalysis_FreeOutput)(JITTER_ANALYSIS_OUTPUT*, int*); + typedef int (WINAPI *ACSC_ControllerReboot)(HANDLE, int); + typedef int (WINAPI *ACSC_ControllerFactoryDefault)(HANDLE, int); + typedef int (WINAPI *ACSC_ControllerSaveToFlash)(HANDLE, int*, int*, int*, char*); + typedef int (WINAPI *ACSC_GetSharedMemoryAddress)(HANDLE, int, char*, unsigned int*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_ReadSharedMemoryReal)(HANDLE, unsigned int, int, int, int, int, double*); + typedef int (WINAPI *ACSC_ReadSharedMemoryInteger)(HANDLE, unsigned int, int, int, int, int, int*); + typedef int (WINAPI *ACSC_WriteSharedMemoryReal)(HANDLE, unsigned int, int, int, int, int, double*); + typedef int (WINAPI *ACSC_WriteSharedMemoryInteger)(HANDLE, unsigned int, int, int, int, int, int*); + typedef HANDLE(WINAPI *ACSC_GetEtherCATState)(HANDLE Handle, int* State, ACSC_WAITBLOCK* Wait); + typedef HANDLE(WINAPI *ACSC_GetEtherCATError)(HANDLE Handle, int* Error, ACSC_WAITBLOCK* Wait); + typedef HANDLE(WINAPI *ACSC_MapEtherCATInput)(HANDLE Handle, int Flags, int Offset, char* VariableName, ACSC_WAITBLOCK* Wait); + typedef HANDLE(WINAPI *ACSC_MapEtherCATOutput)(HANDLE Handle, int Flags, int Offset, char* VariableName, ACSC_WAITBLOCK* Wait); + typedef HANDLE(WINAPI *ACSC_UnmapEtherCATInputsOutputs)(HANDLE Handle, ACSC_WAITBLOCK* Wait); + typedef HANDLE(WINAPI *ACSC_GetEtherCATSlaveIndex)(HANDLE Handle, int VendorID, int ProductID, int Count, int* SlaveIndex, ACSC_WAITBLOCK* Wait); + typedef HANDLE(WINAPI *ACSC_GetEtherCATSlaveOffset)(HANDLE Handle, char* VariableName, int SlaveIndex, double* SlaveOffset, ACSC_WAITBLOCK* Wait); + typedef HANDLE(WINAPI *ACSC_GetEtherCATSlaveVendorID)(HANDLE Handle, int SlaveIndex, double* VendorID, ACSC_WAITBLOCK* Wait); + typedef HANDLE(WINAPI *ACSC_GetEtherCATSlaveProductID)(HANDLE Handle, int SlaveIndex, double* ProductID, ACSC_WAITBLOCK* Wait); + typedef HANDLE(WINAPI *ACSC_GetEtherCATSlaveRevision)(HANDLE Handle, int SlaveIndex, double* Revision, ACSC_WAITBLOCK* Wait); + typedef HANDLE(WINAPI *ACSC_GetEtherCATSlaveType)(HANDLE Handle, int SlaveIndex, double* SlaveType, ACSC_WAITBLOCK* Wait); + typedef HANDLE(WINAPI *ACSC_GetEtherCATSlaveState)(HANDLE Handle, int SlaveIndex, double* SlaveState, ACSC_WAITBLOCK* Wait); + typedef HANDLE(WINAPI *ACSC_DownloadFileOverEtherCAT)(HANDLE Handle, char* Path, char* Filename, int SlaveIndex, ACSC_WAITBLOCK* Wait); + typedef HANDLE(WINAPI *ACSC_ReadSDOValueOverEtherCAT)(HANDLE Handle, int Flags, int SlaveIndex, int Index, int SubIndex, double* Value, ACSC_WAITBLOCK* Wait); + typedef HANDLE(WINAPI *ACSC_WriteSDOValueOverEtherCAT)(HANDLE Handle, int Flags, int SlaveIndex, int Index, int SubIndex, double Value, ACSC_WAITBLOCK* Wait); + typedef int (WINAPI *ACSC_CopyFileToController)(HANDLE Handle, char* SourceFileName, char* DestinationFileName, ACSC_WAITBLOCK* Wait); + typedef int (WINAPI *ACSC_DeleteFileFromController)(HANDLE Handle, char* FileName, ACSC_WAITBLOCK* Wait); + typedef int (WINAPI *ACSC_SegmentedMotion)(HANDLE Handle, int Flags, int* Axes, double* Point, ACSC_WAITBLOCK* Wait); + typedef int (WINAPI *ACSC_ExtendedSegmentedMotion)(HANDLE Handle, int Flags, int* Axes, double* Point, double Velocity, double EndVelocity, double JunctionVelocity, double Angle, double StarvationMargin, char* Segments, ACSC_WAITBLOCK* Wait); + typedef int (WINAPI *ACSC_ExtendedSegmentedMotionExt)(HANDLE Handle, int Flags, int* Axes, double* Point, double Velocity, double EndVelocity, double JunctionVelocity, double Angle, double CurveVelocity, double Deviation, double Radius, double MaxLength, double StarvationMargin, char* Segments, ACSC_WAITBLOCK* Wait); + typedef int (WINAPI *ACSC_SegmentLine)(HANDLE Handle, int Flags, int* Axes, double* Point, double Velocity, double EndVelocity, char* Values, char* Variables, int Index, char* Masks, ACSC_WAITBLOCK* Wait); + typedef int (WINAPI *ACSC_SegmentLineExt)(HANDLE Handle, int Flags, int* Axes, double* Point, double Velocity, double EndVelocity, double Time, char* Values, char* Variables, int Index, char* Masks, ACSC_WAITBLOCK* Wait); + typedef int (WINAPI *ACSC_SegmentArc1)(HANDLE Handle, int Flags, int* Axes, double* Center, double* FinalPoint, int Rotation, double Velocity, double EndVelocity, char* Values, char* Variables, int Index, char* Masks, ACSC_WAITBLOCK* Wait); + typedef int (WINAPI *ACSC_SegmentArc2)(HANDLE Handle, int Flags, int* Axes, double* Center, double Angle, double Velocity, double EndVelocity, char* Values, char* Variables, int Index, char* Masks, ACSC_WAITBLOCK* Wait); + typedef int (WINAPI *ACSC_SegmentArc1Ext)(HANDLE Handle, int Flags, int* Axes, double* Center, double* FinalPoint, int Rotation, double Velocity, double EndVelocity, double Time, char* Values, char* Variables, int Index, char* Masks, ACSC_WAITBLOCK* Wait); + typedef int (WINAPI *ACSC_SegmentArc2Ext)(HANDLE Handle, int Flags, int* Axes, double* Center, double Angle, double Velocity, double EndVelocity, double Time, char* Values, char* Variables, int Index, char* Masks, ACSC_WAITBLOCK* Wait); + typedef int (WINAPI *ACSC_ExtendedSegmentArc1)(HANDLE Handle, int Flags, int* Axes, double* Center, double* FinalPoint, int Rotation, double Velocity, double EndVelocity, double Time, char* Values, char* Variables, int Index, char* Masks, ACSC_WAITBLOCK* Wait); + typedef int (WINAPI *ACSC_ExtendedSegmentArc2)(HANDLE Handle, int Flags, int* Axes, double* Center, double Angle, double* FinalPoint, double Velocity, double EndVelocity, double Time, char* Values, char* Variables, int Index, char* Masks, ACSC_WAITBLOCK* Wait); + typedef int (WINAPI *ACSC_BlendedSegmentMotion)(HANDLE Handle, int Flags, int* Axes, double* Point, double SegmentTime, double AccelerationTime, double JerkTime, double DwellTime, ACSC_WAITBLOCK* Wait); + typedef int (WINAPI *ACSC_BlendedLine)(HANDLE Handle, int Flags, int* Axes, double* Point, double SegmentTime, double AccelerationTime, double JerkTime, double DwellTime, ACSC_WAITBLOCK* Wait); + typedef int (WINAPI *ACSC_BlendedArc1)(HANDLE Handle, int Flags, int* Axes, double* Center, double* FinalPoint, int Rotation, double SegmentTime, double AccelerationTime, double JerkTime, double DwellTime, ACSC_WAITBLOCK* Wait); + typedef int (WINAPI *ACSC_BlendedArc2)(HANDLE Handle, int Flags, int* Axes, double* Center, double Angle, double SegmentTime, double AccelerationTime, double JerkTime, double DwellTime, ACSC_WAITBLOCK* Wait); + typedef int (WINAPI *ACSC_GetAnalogInputNT)(HANDLE, int, double*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_GetAnalogOutputNT)(HANDLE, int, double*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_SetAnalogOutputNT)(HANDLE, int, double, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_GetVolatileMemoryUsage)(HANDLE, double*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_GetVolatileMemoryTotal)(HANDLE, double*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_GetVolatileMemoryFree)(HANDLE, double*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_GetNonVolatileMemoryUsage)(HANDLE, double*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_GetNonVolatileMemoryTotal)(HANDLE, double*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_GetNonVolatileMemoryFree)(HANDLE, double*, ACSC_WAITBLOCK*); + typedef int (WINAPI *ACSC_StartSPiiPlusSC)(); + typedef int (WINAPI *ACSC_StopSPiiPlusSC)(); +#if !defined (ACSC_RUNTIME_DYNAMIC_VARIABLES) + ACSC_AddMPoint acsc_AddMPoint; + ACSC_AddMPointM acsc_AddMPointM; + ACSC_AddPoint acsc_AddPoint; + ACSC_AddPointM acsc_AddPointM; + ACSC_AppendBuffer acsc_AppendBuffer; + ACSC_Arc1acsc_Arc1; + ACSC_Arc2acsc_Arc2; + ACSC_Breakacsc_Break; + ACSC_BreakMacsc_BreakM; + ACSC_CancelOperation acsc_CancelOperation; + ACSC_CaptureComm acsc_CaptureComm; + ACSC_ClearBuffer acsc_ClearBuffer; + ACSC_ClearBreakpoints acsc_ClearBreakpoints; + ACSC_ClearVariables acsc_ClearVariables; + ACSC_CloseComm acsc_CloseComm; + ACSC_CloseHistoryBuffer acsc_CloseHistoryBuffer; + ACSC_CloseLogFile acsc_CloseLogFile; + ACSC_CloseSCLogFile acsc_CloseSCLogFile; + ACSC_CloseMessageBuffer acsc_CloseMessageBuffer; + ACSC_Collect acsc_Collect; + ACSC_Command acsc_Command; + ACSC_Commutacsc_Commut; + ACSC_CommutExt acsc_CommutExt; + ACSC_CompileBuffer acsc_CompileBuffer; + ACSC_DeclareVariable acsc_DeclareVariable; + ACSC_Disable acsc_Disable; + ACSC_DisableAll acsc_DisableAll; + ACSC_DisableFault acsc_DisableFault; + ACSC_DisableM acsc_DisableM; + ACSC_DisableResponse acsc_DisableResponse; + ACSC_DownloadBuffer acsc_DownloadBuffer; + ACSC_Enableacsc_Enable; + ACSC_EnableFault acsc_EnableFault; + ACSC_EnableM acsc_EnableM; + ACSC_EnableResponse acsc_EnableResponse; + ACSC_EndSequence acsc_EndSequence; + ACSC_EndSequenceM acsc_EndSequenceM; + ACSC_ExtAddPoint acsc_ExtAddPoint; + ACSC_ExtAddPointM acsc_ExtAddPointM; + ACSC_ExtArc1 acsc_ExtArc1; + ACSC_ExtArc2 acsc_ExtArc2; + ACSC_ExtLine acsc_ExtLine; + ACSC_ExtToPoint acsc_ExtToPoint; + ACSC_ExtToPointM acsc_ExtToPointM; + ACSC_FlushLogFile acsc_FlushLogFile; + ACSC_FlushSCLogFile acsc_FlushSCLogFile; + ACSC_GetAcceleration acsc_GetAcceleration; + ACSC_GetAnalogInput acsc_GetAnalogInput; + ACSC_GetAnalogOutput acsc_GetAnalogOutput; + ACSC_GetAxisState acsc_GetAxisState; + ACSC_GetBreakpointsList acsc_GetBreakpointsList; + ACSC_GetCommOptions acsc_GetCommOptions; + ACSC_GetDeceleration acsc_GetDeceleration; + ACSC_GetDefaultTimeout acsc_GetDefaultTimeout; + ACSC_GetErrorString acsc_GetErrorString; + ACSC_GetExtInput acsc_GetExtInput; + ACSC_GetExtInputPort acsc_GetExtInputPort; + ACSC_GetExtOutput acsc_GetExtOutput; + ACSC_GetExtOutputPort acsc_GetExtOutputPort; + ACSC_GetFPosition acsc_GetFPosition; + ACSC_GetFVelocity acsc_GetFVelocity; + ACSC_GetFault acsc_GetFault; + ACSC_GetFaultMask acsc_GetFaultMask; + ACSC_GetFirmwareVersion acsc_GetFirmwareVersion; + ACSC_GetHistory acsc_GetHistory; + ACSC_GetIndexState acsc_GetIndexState; + ACSC_GetInput acsc_GetInput; + ACSC_GetInputPort acsc_GetInputPort; + ACSC_GetInterruptMask acsc_GetInterruptMask; + ACSC_GetCallbackMask acsc_GetCallbackMask; + ACSC_GetJerk acsc_GetJerk; + ACSC_GetKillDeceleration acsc_GetKillDeceleration; + ACSC_GetLastError acsc_GetLastError; + ACSC_GetLibraryVersion acsc_GetLibraryVersion; + ACSC_GetMessage acsc_GetMessage; + ACSC_GetMotionError acsc_GetMotionError; + ACSC_GetMotorError acsc_GetMotorError; + ACSC_GetMotorState acsc_GetMotorState; + ACSC_GetOutput acsc_GetOutput; + ACSC_GetOutputPort acsc_GetOutputPort; + ACSC_GetPCICards acsc_GetPCICards; + ACSC_GetEthernetCards acsc_GetEthernetCards; + ACSC_GetEthernetCardsExt acsc_GetEthernetCardsExt; + ACSC_GetProgramError acsc_GetProgramError; + ACSC_GetProgramState acsc_GetProgramState; + ACSC_GetRPosition acsc_GetRPosition; + ACSC_GetRVelocity acsc_GetRVelocity; + ACSC_GetResponseMask acsc_GetResponseMask; + ACSC_GetSafetyInput acsc_GetSafetyInput; + ACSC_GetSafetyInputPort acsc_GetSafetyInputPort; + ACSC_GetSafetyInputPortInv acsc_GetSafetyInputPortInv; + ACSC_GetSerialNumber acsc_GetSerialNumber; + ACSC_GetTimeout acsc_GetTimeout; + ACSC_GetVelocity acsc_GetVelocity; + ACSC_Go acsc_Go; + ACSC_GoMacsc_GoM; + ACSC_Groupacsc_Group; + ACSC_Haltacsc_Halt; + ACSC_HaltMacsc_HaltM; + ACSC_Jogacsc_Jog; + ACSC_JogMacsc_JogM; + ACSC_Killacsc_Kill; + ACSC_KillExt acsc_KillExt; + ACSC_DisableExt acsc_DisableExt; + ACSC_KillAll acsc_KillAll; + ACSC_KillMacsc_KillM; + ACSC_Lineacsc_Line; + ACSC_LoadBuffer acsc_LoadBuffer; + ACSC_MultiPoint acsc_MultiPoint; + ACSC_MultiPointM acsc_MultiPointM; +#if defined(WIN32) && !defined(UNDER_RTSS) + ACSC_OpenCommDirect acsc_OpenCommDirect; + ACSC_CloseSimulator acsc_CloseSimulator; + ACSC_OpenCommSimulator acsc_OpenCommSimulator; + ACSC_OpenCommEthernet acsc_OpenCommEthernet; + ACSC_OpenCommEthernetUDP acsc_OpenCommEthernetUDP; + ACSC_OpenCommEthernetTCP acsc_OpenCommEthernetTCP; + ACSC_OpenCommSerial acsc_OpenCommSerial; +#endif + ACSC_OpenCommPCI acsc_OpenCommPCI; + ACSC_OpenHistoryBuffer acsc_OpenHistoryBuffer; + ACSC_OpenLogFile acsc_OpenLogFile; + ACSC_OpenSCLogFile acsc_OpenSCLogFile; + ACSC_OpenMessageBuffer acsc_OpenMessageBuffer; + ACSC_Projection acsc_Projection; + ACSC_ReadDPRAMInteger acsc_ReadDPRAMInteger; + ACSC_ReadDPRAMReal acsc_ReadDPRAMReal; + ACSC_ReadInteger acsc_ReadInteger; + ACSC_ReadReal acsc_ReadReal; + ACSC_Receive acsc_Receive; + ACSC_ReleaseComm acsc_ReleaseComm; + ACSC_ResetIndexState acsc_ResetIndexState; + ACSC_RunBuffer acsc_RunBuffer; + ACSC_Segment acsc_Segment; + ACSC_Sendacsc_Send; + ACSC_SetAcceleration acsc_SetAcceleration; + ACSC_SetAccelerationImm acsc_SetAccelerationImm; + ACSC_SetAnalogOutput acsc_SetAnalogOutput; + ACSC_SetBreakpoint acsc_SetBreakpoint; + ACSC_SetCallback acsc_SetCallback; + ACSC_SetCallbackPriority acsc_SetCallbackPriority; + ACSC_SetCommOptions acsc_SetCommOptions; + ACSC_SetDeceleration acsc_SetDeceleration; + ACSC_SetDecelerationImm acsc_SetDecelerationImm; + ACSC_SetExtOutput acsc_SetExtOutput; + ACSC_SetExtOutputPort acsc_SetExtOutputPort; + ACSC_SetFPosition acsc_SetFPosition; + ACSC_SetFaultMask acsc_SetFaultMask; + ACSC_SetInterruptMask acsc_SetInterruptMask; + ACSC_SetCallbackMask acsc_SetCallbackMask; + ACSC_SetIterations acsc_SetIterations; + ACSC_SetJerk acsc_SetJerk; + ACSC_SetJerkImm acsc_SetJerkImm; + ACSC_SetKillDeceleration acsc_SetKillDeceleration; + ACSC_SetKillDecelerationImm acsc_SetKillDecelerationImm; + ACSC_SetMaster acsc_SetMaster; + ACSC_SetOutput acsc_SetOutput; + ACSC_SetOutputPort acsc_SetOutputPort; + ACSC_SetRPosition acsc_SetRPosition; + ACSC_SetResponseMask acsc_SetResponseMask; + ACSC_SetSafetyInputPortInv acsc_SetSafetyInputPortInv; + ACSC_SetTimeout acsc_SetTimeout; + ACSC_SetVelocity acsc_SetVelocity; + ACSC_SetVelocityImm acsc_SetVelocityImm; + ACSC_Slaveacsc_Slave; + ACSC_SlaveStalled acsc_SlaveStalled; + ACSC_Splineacsc_Spline; + ACSC_SplineM acsc_SplineM; + ACSC_Splitacsc_Split; + ACSC_SplitAll acsc_SplitAll; + ACSC_StopBuffer acsc_StopBuffer; + ACSC_StopCollect acsc_StopCollect; + ACSC_Stopper acsc_Stopper; + ACSC_SuspendBuffer acsc_SuspendBuffer; + ACSC_ToPoint acsc_ToPoint; + ACSC_ToPointM acsc_ToPointM; + ACSC_Transaction acsc_Transaction; + ACSC_UploadBuffer acsc_UploadBuffer; + ACSC_WaitCollectEnd acsc_WaitCollectEnd; + ACSC_WaitCollectEndExt acsc_WaitCollectEndExt; + ACSC_WaitForAsyncCall acsc_WaitForAsyncCall; + ACSC_WaitInput acsc_WaitInput; + ACSC_WaitLogicalMotionEnd acsc_WaitLogicalMotionEnd; + ACSC_WaitMotionEnd acsc_WaitMotionEnd; + ACSC_WaitMotorEnabled acsc_WaitMotorEnabled; + ACSC_WaitMotorCommutated acsc_WaitMotorCommutated; + ACSC_WaitProgramEnd acsc_WaitProgramEnd; + ACSC_WaitUserCondition acsc_WaitUserCondition; + ACSC_WriteDPRAMInteger acsc_WriteDPRAMInteger; + ACSC_WriteDPRAMReal acsc_WriteDPRAMReal; + ACSC_WriteInteger acsc_WriteInteger; + ACSC_WriteLogFile acsc_WriteLogFile; + ACSC_WriteSCLogFile acsc_WriteSCLogFile; + ACSC_WriteReal acsc_WriteReal; + ACSC_LoadBufferIgnoreServiceLines acsc_LoadBufferIgnoreServiceLines; + ACSC_LoadBuffersFromFile acsc_LoadBuffersFromFile; + ACSC_PegIacsc_PegI; + ACSC_PegRacsc_PegR; + ACSC_PegIncacsc_PegInc; + ACSC_PegRandom acsc_PegRandom; + ACSC_AssignPins acsc_AssignPins; + ACSC_StopPeg acsc_StopPeg; + ACSC_AssignPegNT acsc_AssignPegNT; + ACSC_AssignPegOutputsNT acsc_AssignPegOutputsNT; + ACSC_AssignFastInputsNT acsc_AssignFastInputsNT; + ACSC_PegIncNT acsc_PegIncNT; + ACSC_PegRandomNT acsc_PegRandomNT; + ACSC_WaitPegReadyNT acsc_WaitPegReadyNT; + ACSC_StartPegNT acsc_StartPegNT; + ACSC_StopPegNT acsc_StopPegNT; + ACSC_CollectB acsc_CollectB; + ACSC_DataCollection acsc_DataCollection; + ACSC_DataCollectionExt acsc_DataCollectionExt; + ACSC_AddPVPoint acsc_AddPVPoint; + ACSC_AddPVPointM acsc_AddPVPointM; + ACSC_AddPVTPoint acsc_AddPVTPoint; + ACSC_AddPVTPointM acsc_AddPVTPointM; + ACSC_LoadFileToRealVariable acsc_LoadFileToRealVariable; + ACSC_LoadFileToIntegerVariable acsc_LoadFileToIntegerVariable; + ACSC_LoadDataToController acsc_LoadDataToController; + ACSC_UploadDataFromController acsc_UploadDataFromController; + ACSC_SetQueueOverflowTimeout acsc_SetQueueOverflowTimeout; + ACSC_GetQueueOverflowTimeout acsc_GetQueueOverflowTimeout; + ACSC_SetTargetPosition acsc_SetTargetPosition; + ACSC_GetTargetPosition acsc_GetTargetPosition; + ACSC_SetTargetPositionM acsc_SetTargetPositionM; + ACSC_Trackacsc_Track; + ACSC_TrackMacsc_TrackM; + ACSC_FaultClearM acsc_FaultClearM; + ACSC_FaultClear acsc_FaultClear; + ACSC_Getconf acsc_Getconf; + ACSC_Setconf acsc_Setconf; + ACSC_GetConf acsc_GetConf; + ACSC_SetConf acsc_SetConf; + ACSC_SysInfo acsc_SysInfo; + ACSC_GetAxesCount acsc_GetAxesCount; + ACSC_GetBuffersCount acsc_GetBuffersCount; + ACSC_GetDBufferIndex acsc_GetDBufferIndex; + ACSC_SetCallbackExt acsc_SetCallbackExt; + ACSC_InstallCallback acsc_InstallCallback; + ACSC_DownloadBinVariableToFile acsc_DownloadBinVariableToFile; + ACSC_SetLogFileOptions acsc_SetLogFileOptions; + ACSC_SetServer acsc_SetServer; + ACSC_SetServerExt acsc_SetServerExt; + ACSC_SetServerExtLogin acsc_SetServerExtLogin; + ACSC_GetSingleMessage acsc_GetSingleMessage; + ACSC_GetConnectionsList acsc_GetConnectionsList; + ACSC_GetConnectionInfo acsc_GetConnectionInfo; + ACSC_TerminateConnection acsc_TerminateConnection; + ACSC_GetLogData acsc_GetLogData; + ACSC_RegisterEmergencyStop acsc_RegisterEmergencyStop; + ACSC_UnregisterEmergencyStop acsc_UnregisterEmergencyStop; + ACSC_GetUMDVersion acsc_GetUMDVersion; + ACSC_AnalyzeApplication acsc_AnalyzeApplication; + ACSC_FreeApplication acsc_FreeApplication; + ACSC_SaveApplication acsc_SaveApplication; + ACSC_LoadApplication acsc_LoadApplication; + ACSC_FFT acsc_FFT; + ACSC_FRF_Measure acsc_FRF_Measure; + ACSC_FRF_Stop acsc_FRF_Stop; + ACSC_FRF_CalculateMeasurementDuration acsc_FRF_CalculateMeasurementDuration; + ACSC_FRF_InitInput acsc_FRF_InitInput; + ACSC_FRF_FreeOutput acsc_FRF_FreeOutput; + ACSC_FRF_ReadServoParameters acsc_FRF_ReadServoParameters; + ACSC_FRF_CalculateControllerFRD acsc_FRF_CalculateControllerFRD; + ACSC_FRF_CalculateOpenLoopFRD acsc_FRF_CalculateOpenLoopFRD; + ACSC_FRF_CalculateClosedLoopFRD acsc_FRF_CalculateClosedLoopFRD; + ACSC_FRF_CalculateStabilityMargins acsc_FRF_CalculateStabilityMargins; + ACSC_FRF_FreeFRD acsc_FRF_FreeFRD; + ACSC_FRF_FreeStabilityMargins acsc_FRF_FreeStabilityMargins; + ACSC_JitterAnalysis acsc_JitterAnalysis; + ACSC_JitterAnalysis_FreeOutput acsc_JitterAnalysis_FreeOutput; + ACSC_ControllerReboot acsc_ControllerReboot; + ACSC_ControllerFactoryDefault acsc_ControllerFactoryDefault; + ACSC_ControllerSaveToFlash acsc_ControllerSaveToFlash; + ACSC_GetSharedMemoryAddress acsc_GetSharedMemoryAddress; + ACSC_ReadSharedMemoryReal acsc_ReadSharedMemoryReal; + ACSC_ReadSharedMemoryInteger acsc_ReadSharedMemoryInteger; + ACSC_WriteSharedMemoryReal acsc_WriteSharedMemoryReal; + ACSC_WriteSharedMemoryInteger acsc_WriteSharedMemoryInteger; + ACSC_GetEtherCATState acsc_GetEtherCATState; + ACSC_GetEtherCATError acsc_GetEtherCATError; + ACSC_MapEtherCATInput acsc_MapEtherCATInput; + ACSC_MapEtherCATOutput acsc_MapEtherCATOutput; + ACSC_UnmapEtherCATInputsOutputs acsc_UnmapEtherCATInputsOutputs; + ACSC_GetEtherCATSlaveIndex acsc_GetEtherCATSlaveIndex; + ACSC_GetEtherCATSlaveOffset acsc_GetEtherCATSlaveOffset; + ACSC_GetEtherCATSlaveVendorID acsc_GetEtherCATSlaveVendorID; + ACSC_GetEtherCATSlaveProductID acsc_GetEtherCATSlaveProductID; + ACSC_GetEtherCATSlaveRevision acsc_GetEtherCATSlaveRevision; + ACSC_GetEtherCATSlaveType acsc_GetEtherCATSlaveType; + ACSC_GetEtherCATSlaveState acsc_GetEtherCATSlaveState; + ACSC_DownloadFileOverEtherCAT acsc_DownloadFileOverEtherCAT; + ACSC_ReadSDOValueOverEtherCAT acsc_ReadSDOValueOverEtherCAT; + ACSC_WriteSDOValueOverEtherCAT acsc_WriteSDOValueOverEtherCAT; + ACSC_CopyFileToController acsc_CopyFileToController; + ACSC_DeleteFileFromController acsc_DeleteFileFromController; + ACSC_SegmentedMotion acsc_SegmentedMotion; + ACSC_ExtendedSegmentedMotion acsc_ExtendedSegmentedMotion; + ACSC_ExtendedSegmentedMotionExt acsc_ExtendedSegmentedMotionExt; + ACSC_SegmentLine acsc_SegmentLine; + ACSC_SegmentLineExt acsc_SegmentLineExt; + ACSC_SegmentArc1 acsc_SegmentArc1; + ACSC_SegmentArc1Ext acsc_SegmentArc1Ext; + ACSC_SegmentArc2 acsc_SegmentArc2; + ACSC_SegmentArc2Ext acsc_SegmentArc2Ext; + ACSC_ExtendedSegmentArc1 acsc_ExtendedSegmentArc1; + ACSC_ExtendedSegmentArc2 acsc_ExtendedSegmentArc2; + ACSC_BlendedSegmentMotion acsc_BlendedSegmentMotion; + ACSC_BlendedLine acsc_BlendedLine; + ACSC_BlendedArc1 acsc_BlendedArc1; + ACSC_BlendedArc2 acsc_BlendedArc2; + ACSC_GetAnalogInputNT acsc_GetAnalogInputNT; + ACSC_GetAnalogOutputNT acsc_GetAnalogOutputNT; + ACSC_SetAnalogOutputNT acsc_SetAnalogOutputNT; + ACSC_GetVolatileMemoryUsage acsc_GetVolatileMemoryUsage; + ACSC_GetVolatileMemoryTotal acsc_GetVolatileMemoryTotal; + ACSC_GetVolatileMemoryFree acsc_GetVolatileMemoryFree; + ACSC_GetNonVolatileMemoryUsage acsc_GetNonVolatileMemoryUsage; + ACSC_GetNonVolatileMemoryTotal acsc_GetNonVolatileMemoryTotal; + ACSC_GetNonVolatileMemoryFree acsc_GetNonVolatileMemoryFree; + ACSC_StartSPiiPlusSC acsc_StartSPiiPlusSC; + ACSC_StopSPiiPlusSC acsc_StopSPiiPlusSC; + static HMODULE hACSCLibraryModule; + ////////////////////////////////////////////////////////////////////////////////////////////////// + // The function loads ACSCL_x86.DLL and obtains addresses for all exported functions. + // Call this function before any using of ACSC API. + // Check return value for success. + ////////////////////////////////////////////////////////////////////////////////////////////////// + static int InitACSCLibrary() + { + hACSCLibraryModule = LoadLibrary("ACSCL_x86.dll"); + if (hACSCLibraryModule == NULL) + return 0; + acsc_AddMPoint = (ACSC_AddMPoint)GetProcAddress(hACSCLibraryModule, "_acsc_AddMPoint@20"); // 2 + acsc_AddMPointM = (ACSC_AddMPointM)GetProcAddress(hACSCLibraryModule, "_acsc_AddMPointM@20"); // 3 + acsc_AddPoint = (ACSC_AddPoint)GetProcAddress(hACSCLibraryModule, "_acsc_AddPoint@20"); // 4 + acsc_AddPointM = (ACSC_AddPointM)GetProcAddress(hACSCLibraryModule, "_acsc_AddPointM@16"); // 5 + acsc_AppendBuffer = (ACSC_AppendBuffer)GetProcAddress(hACSCLibraryModule, "_acsc_AppendBuffer@20"); // 6 + acsc_Arc1 = (ACSC_Arc1)GetProcAddress(hACSCLibraryModule, "_acsc_Arc1@24"); // 7 + acsc_Arc2 = (ACSC_Arc2)GetProcAddress(hACSCLibraryModule, "_acsc_Arc2@24"); // 8 + acsc_Break = (ACSC_Break)GetProcAddress(hACSCLibraryModule, "_acsc_Break@12"); // 9 + acsc_BreakM = (ACSC_BreakM)GetProcAddress(hACSCLibraryModule, "_acsc_BreakM@12"); // 10 + acsc_CancelOperation = (ACSC_CancelOperation)GetProcAddress(hACSCLibraryModule, "_acsc_CancelOperation@8"); // 11 + acsc_CaptureComm = (ACSC_CaptureComm)GetProcAddress(hACSCLibraryModule, "_acsc_CaptureComm@4"); // 12 + acsc_ClearBuffer = (ACSC_ClearBuffer)GetProcAddress(hACSCLibraryModule, "_acsc_ClearBuffer@20"); // 13 + acsc_ClearVariables = (ACSC_ClearVariables)GetProcAddress(hACSCLibraryModule, "_acsc_ClearVariables@8"); // 14 + acsc_CloseComm = (ACSC_CloseComm)GetProcAddress(hACSCLibraryModule, "_acsc_CloseComm@4"); // 15 + acsc_CloseHistoryBuffer = (ACSC_CloseHistoryBuffer)GetProcAddress(hACSCLibraryModule, "_acsc_CloseHistoryBuffer@4"); // 16 + acsc_CloseLogFile = (ACSC_CloseLogFile)GetProcAddress(hACSCLibraryModule, "_acsc_CloseLogFile@4"); // 17 + acsc_CloseMessageBuffer = (ACSC_CloseMessageBuffer)GetProcAddress(hACSCLibraryModule, "_acsc_CloseMessageBuffer@4"); // 18 + acsc_Collect = (ACSC_Collect)GetProcAddress(hACSCLibraryModule, "_acsc_Collect@28"); // 19 + acsc_Command = (ACSC_Command)GetProcAddress(hACSCLibraryModule, "_acsc_Command@16"); // 20 + acsc_CompileBuffer = (ACSC_CompileBuffer)GetProcAddress(hACSCLibraryModule, "_acsc_CompileBuffer@12");// 21 + acsc_DeclareVariable = (ACSC_DeclareVariable)GetProcAddress(hACSCLibraryModule, "_acsc_DeclareVariable@16"); // 22 + acsc_Disable = (ACSC_Disable)GetProcAddress(hACSCLibraryModule, "_acsc_Disable@12"); // 23 + acsc_DisableAll = (ACSC_DisableAll)GetProcAddress(hACSCLibraryModule, "_acsc_DisableAll@8"); // 24 + acsc_DisableFault = (ACSC_DisableFault)GetProcAddress(hACSCLibraryModule, "_acsc_DisableFault@16"); // 25 + acsc_DisableM = (ACSC_DisableM)GetProcAddress(hACSCLibraryModule, "_acsc_DisableM@12"); // 26 + acsc_DisableResponse = (ACSC_DisableResponse)GetProcAddress(hACSCLibraryModule, "_acsc_DisableResponse@16"); // 27 + acsc_DownloadBuffer = (ACSC_DownloadBuffer)GetProcAddress(hACSCLibraryModule, "_acsc_DownloadBuffer@20"); // 28 + acsc_Enable = (ACSC_Enable)GetProcAddress(hACSCLibraryModule, "_acsc_Enable@12"); // 29 + acsc_EnableFault = (ACSC_EnableFault)GetProcAddress(hACSCLibraryModule, "_acsc_EnableFault@16"); // 30 + acsc_EnableM = (ACSC_EnableM)GetProcAddress(hACSCLibraryModule, "_acsc_EnableM@12"); // 31 + acsc_EnableResponse = (ACSC_EnableResponse)GetProcAddress(hACSCLibraryModule, "_acsc_EnableResponse@16"); // 32 + acsc_EndSequence = (ACSC_EndSequence)GetProcAddress(hACSCLibraryModule, "_acsc_EndSequence@12"); // 33 + acsc_EndSequenceM = (ACSC_EndSequenceM)GetProcAddress(hACSCLibraryModule, "_acsc_EndSequenceM@12"); // 34 + acsc_ExtAddPoint = (ACSC_ExtAddPoint)GetProcAddress(hACSCLibraryModule, "_acsc_ExtAddPoint@28"); // 35 + acsc_ExtAddPointM = (ACSC_ExtAddPointM)GetProcAddress(hACSCLibraryModule, "_acsc_ExtAddPointM@24"); // 36 + acsc_ExtArc1 = (ACSC_ExtArc1)GetProcAddress(hACSCLibraryModule, "_acsc_ExtArc1@32"); // 37 + acsc_ExtArc2 = (ACSC_ExtArc2)GetProcAddress(hACSCLibraryModule, "_acsc_ExtArc2@32"); // 38 + acsc_ExtLine = (ACSC_ExtLine)GetProcAddress(hACSCLibraryModule, "_acsc_ExtLine@24"); // 39 + acsc_ExtToPoint = (ACSC_ExtToPoint)GetProcAddress(hACSCLibraryModule, "_acsc_ExtToPoint@40"); // 40 + acsc_ExtToPointM = (ACSC_ExtToPointM)GetProcAddress(hACSCLibraryModule, "_acsc_ExtToPointM@36"); // 41 + acsc_GetAcceleration = (ACSC_GetAcceleration)GetProcAddress(hACSCLibraryModule, "_acsc_GetAcceleration@16"); // 42 + acsc_GetAnalogInput = (ACSC_GetAnalogInput)GetProcAddress(hACSCLibraryModule, "_acsc_GetAnalogInput@16"); // 43 + acsc_GetAnalogOutput = (ACSC_GetAnalogOutput)GetProcAddress(hACSCLibraryModule, "_acsc_GetAnalogOutput@16"); // 44 + acsc_GetAxisState = (ACSC_GetAxisState)GetProcAddress(hACSCLibraryModule, "_acsc_GetAxisState@16"); // 45 + acsc_GetCommOptions = (ACSC_GetCommOptions)GetProcAddress(hACSCLibraryModule, "_acsc_GetCommOptions@8"); // 46 + acsc_GetDeceleration = (ACSC_GetDeceleration)GetProcAddress(hACSCLibraryModule, "_acsc_GetDeceleration@16"); // 47 + acsc_GetDefaultTimeout = (ACSC_GetDefaultTimeout)GetProcAddress(hACSCLibraryModule, "_acsc_GetDefaultTimeout@4");// 48 + acsc_GetErrorString = (ACSC_GetErrorString)GetProcAddress(hACSCLibraryModule, "_acsc_GetErrorString@20"); // 49 + acsc_GetExtInput = (ACSC_GetExtInput)GetProcAddress(hACSCLibraryModule, "_acsc_GetExtInput@20"); // 50 + acsc_GetExtInputPort = (ACSC_GetExtInputPort)GetProcAddress(hACSCLibraryModule, "_acsc_GetExtInputPort@16"); // 51 + acsc_GetExtOutput = (ACSC_GetExtOutput)GetProcAddress(hACSCLibraryModule, "_acsc_GetExtOutput@20"); // 52 + acsc_GetExtOutputPort = (ACSC_GetExtOutputPort)GetProcAddress(hACSCLibraryModule, "_acsc_GetExtOutputPort@16"); // 53 + acsc_GetFPosition = (ACSC_GetFPosition)GetProcAddress(hACSCLibraryModule, "_acsc_GetFPosition@16"); // 54 + acsc_GetFVelocity = (ACSC_GetFVelocity)GetProcAddress(hACSCLibraryModule, "_acsc_GetFVelocity@16"); // 55 + acsc_GetFault = (ACSC_GetFault)GetProcAddress(hACSCLibraryModule, "_acsc_GetFault@16"); // 56 + acsc_GetFaultMask = (ACSC_GetFaultMask)GetProcAddress(hACSCLibraryModule, "_acsc_GetFaultMask@16"); // 57 + acsc_GetFirmwareVersion = (ACSC_GetFirmwareVersion)GetProcAddress(hACSCLibraryModule, "_acsc_GetFirmwareVersion@20"); // 58 + acsc_GetHistory = (ACSC_GetHistory)GetProcAddress(hACSCLibraryModule, "_acsc_GetHistory@20"); // 59 + acsc_GetIndexState = (ACSC_GetIndexState)GetProcAddress(hACSCLibraryModule, "_acsc_GetIndexState@16");// 60 + acsc_GetInput = (ACSC_GetInput)GetProcAddress(hACSCLibraryModule, "_acsc_GetInput@20"); // 61 + acsc_GetInputPort = (ACSC_GetInputPort)GetProcAddress(hACSCLibraryModule, "_acsc_GetInputPort@16"); // 62 + acsc_GetInterruptMask = (ACSC_GetInterruptMask)GetProcAddress(hACSCLibraryModule, "_acsc_GetInterruptMask@12"); // 63 + acsc_GetJerk = (ACSC_GetJerk)GetProcAddress(hACSCLibraryModule, "_acsc_GetJerk@16"); // 64 + acsc_GetKillDeceleration = (ACSC_GetKillDeceleration)GetProcAddress(hACSCLibraryModule, "_acsc_GetKillDeceleration@16");// 65 + acsc_GetLastError = (ACSC_GetLastError)GetProcAddress(hACSCLibraryModule, "_acsc_GetLastError@0"); // 66 + acsc_GetLibraryVersion = (ACSC_GetLibraryVersion)GetProcAddress(hACSCLibraryModule, "_acsc_GetLibraryVersion@0");// 67 + acsc_GetMessage = (ACSC_GetMessage)GetProcAddress(hACSCLibraryModule, "_acsc_GetMessage@20"); // 68 + acsc_GetMotionError = (ACSC_GetMotionError)GetProcAddress(hACSCLibraryModule, "_acsc_GetMotionError@16"); // 69 + acsc_GetMotorError = (ACSC_GetMotorError)GetProcAddress(hACSCLibraryModule, "_acsc_GetMotorError@16");// 70 + acsc_GetMotorState = (ACSC_GetMotorState)GetProcAddress(hACSCLibraryModule, "_acsc_GetMotorState@16");// 71 + acsc_GetOutput = (ACSC_GetOutput)GetProcAddress(hACSCLibraryModule, "_acsc_GetOutput@20"); // 72 + acsc_GetOutputPort = (ACSC_GetOutputPort)GetProcAddress(hACSCLibraryModule, "_acsc_GetOutputPort@16");// 73 + acsc_GetPCICards = (ACSC_GetPCICards)GetProcAddress(hACSCLibraryModule, "_acsc_GetPCICards@12"); // 74 + acsc_GetProgramError = (ACSC_GetProgramError)GetProcAddress(hACSCLibraryModule, "_acsc_GetProgramError@16"); // 75 + acsc_GetProgramState = (ACSC_GetProgramState)GetProcAddress(hACSCLibraryModule, "_acsc_GetProgramState@16"); // 76 + acsc_GetRPosition = (ACSC_GetRPosition)GetProcAddress(hACSCLibraryModule, "_acsc_GetRPosition@16"); // 77 + acsc_GetRVelocity = (ACSC_GetRVelocity)GetProcAddress(hACSCLibraryModule, "_acsc_GetRVelocity@16"); // 78 + acsc_GetResponseMask = (ACSC_GetResponseMask)GetProcAddress(hACSCLibraryModule, "_acsc_GetResponseMask@16"); // 79 + acsc_GetSafetyInput = (ACSC_GetSafetyInput)GetProcAddress(hACSCLibraryModule, "_acsc_GetSafetyInput@20"); // 80 + acsc_GetSafetyInputPort = (ACSC_GetSafetyInputPort)GetProcAddress(hACSCLibraryModule, "_acsc_GetSafetyInputPort@16"); // 81 + acsc_GetSafetyInputPortInv = (ACSC_GetSafetyInputPortInv)GetProcAddress(hACSCLibraryModule, "_acsc_GetSafetyInputPortInv@16");// 82 + acsc_GetSerialNumber = (ACSC_GetSerialNumber)GetProcAddress(hACSCLibraryModule, "_acsc_GetSerialNumber@20"); // 83 + acsc_GetTimeout = (ACSC_GetTimeout)GetProcAddress(hACSCLibraryModule, "_acsc_GetTimeout@4"); // 84 + acsc_GetVelocity = (ACSC_GetVelocity)GetProcAddress(hACSCLibraryModule, "_acsc_GetVelocity@16"); // 85 + acsc_Go = (ACSC_Go)GetProcAddress(hACSCLibraryModule, "_acsc_Go@12");// 86 + acsc_GoM = (ACSC_GoM)GetProcAddress(hACSCLibraryModule, "_acsc_GoM@12"); // 87 + acsc_Group = (ACSC_Group)GetProcAddress(hACSCLibraryModule, "_acsc_Group@12"); // 88 + acsc_Halt = (ACSC_Halt)GetProcAddress(hACSCLibraryModule, "_acsc_Halt@12"); // 89 + acsc_HaltM = (ACSC_HaltM)GetProcAddress(hACSCLibraryModule, "_acsc_HaltM@12"); // 90 + acsc_Jog = (ACSC_Jog)GetProcAddress(hACSCLibraryModule, "_acsc_Jog@24"); // 91 + acsc_JogM = (ACSC_JogM)GetProcAddress(hACSCLibraryModule, "_acsc_JogM@28"); // 92 + acsc_Kill = (ACSC_Kill)GetProcAddress(hACSCLibraryModule, "_acsc_Kill@12"); // 93 + acsc_KillAll = (ACSC_KillAll)GetProcAddress(hACSCLibraryModule, "_acsc_KillAll@8"); // 94 + acsc_KillM = (ACSC_KillM)GetProcAddress(hACSCLibraryModule, "_acsc_KillM@12"); // 95 + acsc_Line = (ACSC_Line)GetProcAddress(hACSCLibraryModule, "_acsc_Line@16"); // 96 + acsc_LoadBuffer = (ACSC_LoadBuffer)GetProcAddress(hACSCLibraryModule, "_acsc_LoadBuffer@20"); // 97 + acsc_MultiPoint = (ACSC_MultiPoint)GetProcAddress(hACSCLibraryModule, "_acsc_MultiPoint@24"); // 98 + acsc_MultiPointM = (ACSC_MultiPointM)GetProcAddress(hACSCLibraryModule, "_acsc_MultiPointM@24"); // 99 +#if defined(WIN32) && !defined(UNDER_RTSS) + acsc_OpenCommDirect = (ACSC_OpenCommDirect)GetProcAddress(hACSCLibraryModule, "_acsc_OpenCommDirect@0"); // 100 + acsc_OpenCommEthernet = (ACSC_OpenCommEthernet)GetProcAddress(hACSCLibraryModule, "_acsc_OpenCommEthernet@8"); // 101 + acsc_OpenCommPCI = (ACSC_OpenCommPCI)GetProcAddress(hACSCLibraryModule, "_acsc_OpenCommPCI@4"); // 102 + acsc_OpenCommSerial = (ACSC_OpenCommSerial)GetProcAddress(hACSCLibraryModule, "_acsc_OpenCommSerial@8"); // 103 +#endif + acsc_OpenHistoryBuffer = (ACSC_OpenHistoryBuffer)GetProcAddress(hACSCLibraryModule, "_acsc_OpenHistoryBuffer@8");// 104 + acsc_OpenLogFile = (ACSC_OpenLogFile)GetProcAddress(hACSCLibraryModule, "_acsc_OpenLogFile@8"); // 105 + acsc_OpenMessageBuffer = (ACSC_OpenMessageBuffer)GetProcAddress(hACSCLibraryModule, "_acsc_OpenMessageBuffer@8");// 106 + acsc_Projection = (ACSC_Projection)GetProcAddress(hACSCLibraryModule, "_acsc_Projection@16"); // 107 + acsc_ReadDPRAMInteger = (ACSC_ReadDPRAMInteger)GetProcAddress(hACSCLibraryModule, "_acsc_ReadDPRAMInteger@12"); // 108 + acsc_ReadDPRAMReal = (ACSC_ReadDPRAMReal)GetProcAddress(hACSCLibraryModule, "_acsc_ReadDPRAMReal@12");// 109 + acsc_ReadInteger = (ACSC_ReadInteger)GetProcAddress(hACSCLibraryModule, "_acsc_ReadInteger@36"); // 110 + acsc_ReadReal = (ACSC_ReadReal)GetProcAddress(hACSCLibraryModule, "_acsc_ReadReal@36"); // 111 + acsc_Receive = (ACSC_Receive)GetProcAddress(hACSCLibraryModule, "_acsc_Receive@20"); // 112 + acsc_ReleaseComm = (ACSC_ReleaseComm)GetProcAddress(hACSCLibraryModule, "_acsc_ReleaseComm@4"); // 113 + acsc_ResetIndexState = (ACSC_ResetIndexState)GetProcAddress(hACSCLibraryModule, "_acsc_ResetIndexState@16"); // 114 + acsc_RunBuffer = (ACSC_RunBuffer)GetProcAddress(hACSCLibraryModule, "_acsc_RunBuffer@16"); // 115 + acsc_Segment = (ACSC_Segment)GetProcAddress(hACSCLibraryModule, "_acsc_Segment@20"); // 116 + acsc_Send = (ACSC_Send)GetProcAddress(hACSCLibraryModule, "_acsc_Send@16"); // 117 + acsc_SetAcceleration = (ACSC_SetAcceleration)GetProcAddress(hACSCLibraryModule, "_acsc_SetAcceleration@20"); // 118 + acsc_SetAccelerationImm = (ACSC_SetAccelerationImm)GetProcAddress(hACSCLibraryModule, "_acsc_SetAccelerationImm@20"); // 119 + acsc_SetAnalogOutput = (ACSC_SetAnalogOutput)GetProcAddress(hACSCLibraryModule, "_acsc_SetAnalogOutput@16"); // 120 + acsc_SetCallback = (ACSC_SetCallback)GetProcAddress(hACSCLibraryModule, "_acsc_SetCallback@12"); // 121 + acsc_SetCallbackPriority = (ACSC_SetCallbackPriority)GetProcAddress(hACSCLibraryModule, "_acsc_SetCallbackPriority@8"); // 122 + acsc_SetCommOptions = (ACSC_SetCommOptions)GetProcAddress(hACSCLibraryModule, "_acsc_SetCommOptions@8"); // 123 + acsc_SetDeceleration = (ACSC_SetDeceleration)GetProcAddress(hACSCLibraryModule, "_acsc_SetDeceleration@20"); // 124 + acsc_SetDecelerationImm = (ACSC_SetDecelerationImm)GetProcAddress(hACSCLibraryModule, "_acsc_SetDecelerationImm@20"); // 125 + acsc_SetExtOutput = (ACSC_SetExtOutput)GetProcAddress(hACSCLibraryModule, "_acsc_SetExtOutput@20"); // 126 + acsc_SetExtOutputPort = (ACSC_SetExtOutputPort)GetProcAddress(hACSCLibraryModule, "_acsc_SetExtOutputPort@16"); // 127 + acsc_SetFPosition = (ACSC_SetFPosition)GetProcAddress(hACSCLibraryModule, "_acsc_SetFPosition@20"); // 128 + acsc_SetFaultMask = (ACSC_SetFaultMask)GetProcAddress(hACSCLibraryModule, "_acsc_SetFaultMask@16"); // 129 + acsc_SetInterruptMask = (ACSC_SetInterruptMask)GetProcAddress(hACSCLibraryModule, "_acsc_SetInterruptMask@12"); // 130 + acsc_SetIterations = (ACSC_SetIterations)GetProcAddress(hACSCLibraryModule, "_acsc_SetIterations@8");// 131 + acsc_SetJerk = (ACSC_SetJerk)GetProcAddress(hACSCLibraryModule, "_acsc_SetJerk@20"); // 132 + acsc_SetJerkImm = (ACSC_SetJerkImm)GetProcAddress(hACSCLibraryModule, "_acsc_SetJerkImm@20"); // 133 + acsc_SetKillDeceleration = (ACSC_SetKillDeceleration)GetProcAddress(hACSCLibraryModule, "_acsc_SetKillDeceleration@20");// 134 + acsc_SetKillDecelerationImm = (ACSC_SetKillDecelerationImm)GetProcAddress(hACSCLibraryModule, "_acsc_SetKillDecelerationImm@20"); // 135 + acsc_SetMaster = (ACSC_SetMaster)GetProcAddress(hACSCLibraryModule, "_acsc_SetMaster@16"); // 136 + acsc_SetOutput = (ACSC_SetOutput)GetProcAddress(hACSCLibraryModule, "_acsc_SetOutput@20"); // 137 + acsc_SetOutputPort = (ACSC_SetOutputPort)GetProcAddress(hACSCLibraryModule, "_acsc_SetOutputPort@16");// 138 + acsc_SetRPosition = (ACSC_SetRPosition)GetProcAddress(hACSCLibraryModule, "_acsc_SetRPosition@20"); // 139 + acsc_SetResponseMask = (ACSC_SetResponseMask)GetProcAddress(hACSCLibraryModule, "_acsc_SetResponseMask@16"); // 140 + acsc_SetSafetyInputPortInv = (ACSC_SetSafetyInputPortInv)GetProcAddress(hACSCLibraryModule, "_acsc_SetSafetyInputPortInv@16"); // 141 + acsc_SetTimeout = (ACSC_SetTimeout)GetProcAddress(hACSCLibraryModule, "_acsc_SetTimeout@8"); // 142 + acsc_SetVelocity = (ACSC_SetVelocity)GetProcAddress(hACSCLibraryModule, "_acsc_SetVelocity@20"); // 143 + acsc_SetVelocityImm = (ACSC_SetVelocityImm)GetProcAddress(hACSCLibraryModule, "_acsc_SetVelocityImm@20"); // 144 + acsc_Slave = (ACSC_Slave)GetProcAddress(hACSCLibraryModule, "_acsc_Slave@16"); // 145 + acsc_SlaveStalled = (ACSC_SlaveStalled)GetProcAddress(hACSCLibraryModule, "_acsc_SlaveStalled@32"); // 146 + acsc_Spline = (ACSC_Spline)GetProcAddress(hACSCLibraryModule, "_acsc_Spline@24"); // 147 + acsc_SplineM = (ACSC_SplineM)GetProcAddress(hACSCLibraryModule, "_acsc_SplineM@24"); // 148 + acsc_Split = (ACSC_Split)GetProcAddress(hACSCLibraryModule, "_acsc_Split@12"); // 149 + acsc_SplitAll = (ACSC_SplitAll)GetProcAddress(hACSCLibraryModule, "_acsc_SplitAll@8"); // 150 + acsc_StopBuffer = (ACSC_StopBuffer)GetProcAddress(hACSCLibraryModule, "_acsc_StopBuffer@12"); // 151 + acsc_StopCollect = (ACSC_StopCollect)GetProcAddress(hACSCLibraryModule, "_acsc_StopCollect@8"); // 152 + acsc_Stopper = (ACSC_Stopper)GetProcAddress(hACSCLibraryModule, "_acsc_Stopper@12"); // 153 + acsc_SuspendBuffer = (ACSC_SuspendBuffer)GetProcAddress(hACSCLibraryModule, "_acsc_SuspendBuffer@12");// 154 + acsc_ToPoint = (ACSC_ToPoint)GetProcAddress(hACSCLibraryModule, "_acsc_ToPoint@24"); // 155 + acsc_ToPointM = (ACSC_ToPointM)GetProcAddress(hACSCLibraryModule, "_acsc_ToPointM@20"); // 156 + acsc_Transaction = (ACSC_Transaction)GetProcAddress(hACSCLibraryModule, "_acsc_Transaction@28"); // 157 + acsc_UploadBuffer = (ACSC_UploadBuffer)GetProcAddress(hACSCLibraryModule, "_acsc_UploadBuffer@28"); // 158 + acsc_WaitCollectEnd = (ACSC_WaitCollectEnd)GetProcAddress(hACSCLibraryModule, "_acsc_WaitCollectEnd@8"); // 159 + acsc_WaitForAsyncCall = (ACSC_WaitForAsyncCall)GetProcAddress(hACSCLibraryModule, "_acsc_WaitForAsyncCall@20"); // 160 + acsc_WaitInput = (ACSC_WaitInput)GetProcAddress(hACSCLibraryModule, "_acsc_WaitInput@20"); // 161 + acsc_WaitLogicalMotionEnd = (ACSC_WaitLogicalMotionEnd)GetProcAddress(hACSCLibraryModule, "_acsc_WaitLogicalMotionEnd@12");// 162 + acsc_WaitMotionEnd = (ACSC_WaitMotionEnd)GetProcAddress(hACSCLibraryModule, "_acsc_WaitMotionEnd@12");// 163 + acsc_WaitMotorEnabled = (ACSC_WaitMotorEnabled)GetProcAddress(hACSCLibraryModule, "_acsc_WaitMotorEnabled@16"); // 164 + acsc_WaitProgramEnd = (ACSC_WaitProgramEnd)GetProcAddress(hACSCLibraryModule, "_acsc_WaitProgramEnd@12"); // 165 + acsc_WaitUserCondition = (ACSC_WaitUserCondition)GetProcAddress(hACSCLibraryModule, "_acsc_WaitUserCondition@12");// 166 + acsc_WriteDPRAMInteger = (ACSC_WriteDPRAMInteger)GetProcAddress(hACSCLibraryModule, "_acsc_WriteDPRAMInteger@12");// 167 + acsc_WriteDPRAMReal = (ACSC_WriteDPRAMReal)GetProcAddress(hACSCLibraryModule, "_acsc_WriteDPRAMReal@16"); // 168 + acsc_WriteInteger = (ACSC_WriteInteger)GetProcAddress(hACSCLibraryModule, "_acsc_WriteInteger@36"); // 169 + acsc_WriteLogFile = (ACSC_WriteLogFile)GetProcAddress(hACSCLibraryModule, "_acsc_WriteLogFile@12"); // 170 + acsc_WriteReal = (ACSC_WriteReal)GetProcAddress(hACSCLibraryModule, "_acsc_WriteReal@36"); // 171 + acsc_LoadBufferIgnoreServiceLines = (ACSC_LoadBufferIgnoreServiceLines)GetProcAddress(hACSCLibraryModule, "_acsc_LoadBufferIgnoreServiceLines@20"); // 196 + acsc_PegI = (ACSC_PegI)GetProcAddress(hACSCLibraryModule, "_acsc_PegI@48"); // 197 + acsc_PegR = (ACSC_PegR)GetProcAddress(hACSCLibraryModule, "_acsc_PegR@44"); // 198 + acsc_AssignPins = (ACSC_AssignPins)GetProcAddress(hACSCLibraryModule, "_acsc_AssignPins@16"); // 199 + acsc_StopPeg = (ACSC_StopPeg)GetProcAddress(hACSCLibraryModule, "_acsc_StopPeg@12"); // 200 + acsc_CollectB = (ACSC_CollectB)GetProcAddress(hACSCLibraryModule, "_acsc_CollectB@28"); // 201 + acsc_AddPVPoint = (ACSC_AddPVPoint)GetProcAddress(hACSCLibraryModule, "_acsc_AddPVPoint@28"); // 202 + acsc_AddPVPointM = (ACSC_AddPVPointM)GetProcAddress(hACSCLibraryModule, "_acsc_AddPVPointM@20"); // 203 + acsc_AddPVTPoint = (ACSC_AddPVTPoint)GetProcAddress(hACSCLibraryModule, "_acsc_AddPVTPoint@36"); // 204 + acsc_AddPVTPointM = (ACSC_AddPVTPointM)GetProcAddress(hACSCLibraryModule, "_acsc_AddPVTPointM@28"); // 205 + acsc_LoadFileToRealVariable = (ACSC_LoadFileToRealVariable)GetProcAddress(hACSCLibraryModule, "_acsc_LoadFileToRealVariable@36"); // 206 + acsc_LoadFileToIntegerVariable = (ACSC_LoadFileToIntegerVariable)GetProcAddress(hACSCLibraryModule, "_acsc_LoadFileToIntegerVariable@36"); // 207 + acsc_SetQueueOverflowTimeout = (ACSC_SetQueueOverflowTimeout)GetProcAddress(hACSCLibraryModule, "_acsc_SetQueueOverflowTimeout@8"); // 208 + acsc_GetQueueOverflowTimeout = (ACSC_GetQueueOverflowTimeout)GetProcAddress(hACSCLibraryModule, "_acsc_GetQueueOverflowTimeout@4"); // 209 + acsc_LoadBuffersFromFile = (ACSC_LoadBuffersFromFile)GetProcAddress(hACSCLibraryModule, "_acsc_LoadBuffersFromFile@12");// 210 + acsc_SetTargetPosition = (ACSC_SetTargetPosition)GetProcAddress(hACSCLibraryModule, "_acsc_SetTargetPosition@20");// 211 + acsc_GetTargetPosition = (ACSC_GetTargetPosition)GetProcAddress(hACSCLibraryModule, "_acsc_GetTargetPosition@16");// 212 + acsc_SetTargetPositionM = (ACSC_SetTargetPositionM)GetProcAddress(hACSCLibraryModule, "_acsc_SetTargetPositionM@16"); // 213 + acsc_Track = (ACSC_Track)GetProcAddress(hACSCLibraryModule, "_acsc_Track@16"); // 214 + acsc_TrackM = (ACSC_TrackM)GetProcAddress(hACSCLibraryModule, "_acsc_TrackM@16"); // 215 + acsc_FaultClearM = (ACSC_FaultClearM)GetProcAddress(hACSCLibraryModule, "_acsc_FaultClearM@12"); // 216 + acsc_FaultClear = (ACSC_FaultClear)GetProcAddress(hACSCLibraryModule, "_acsc_FaultClear@12"); // 217 + acsc_Getconf = (ACSC_Getconf)GetProcAddress(hACSCLibraryModule, "_acsc_Getconf@20"); // 218 + acsc_Setconf = (ACSC_Setconf)GetProcAddress(hACSCLibraryModule, "_acsc_Setconf@20"); // 219 + acsc_SetCallbackExt = (ACSC_SetCallbackExt)GetProcAddress(hACSCLibraryModule, "_acsc_SetCallbackExt@16"); // 222 + acsc_DownloadBinVariableToFile = (ACSC_DownloadBinVariableToFile)GetProcAddress(hACSCLibraryModule, "_acsc_DownloadBinVariableToFile@44"); // 223 + acsc_SetLogFileOptions = (ACSC_SetLogFileOptions)GetProcAddress(hACSCLibraryModule, "_acsc_SetLogFileOptions@12");// 224 + acsc_KillExt = (ACSC_KillExt)GetProcAddress(hACSCLibraryModule, "_acsc_KillExt@16"); // 225 + acsc_DisableExt = (ACSC_DisableExt)GetProcAddress(hACSCLibraryModule, "_acsc_DisableExt@16"); // 226 + acsc_GetConf = (ACSC_GetConf)GetProcAddress(hACSCLibraryModule, "_acsc_GetConf@20"); // 228 + acsc_SetConf = (ACSC_SetConf)GetProcAddress(hACSCLibraryModule, "_acsc_SetConf@24"); // 229 + acsc_SetServer = (ACSC_SetServer)GetProcAddress(hACSCLibraryModule, "_acsc_SetServer@4"); // 230 + acsc_GetSingleMessage = (ACSC_GetSingleMessage)GetProcAddress(hACSCLibraryModule, "_acsc_GetSingleMessage@20"); // 231 + acsc_GetCallbackMask = (ACSC_GetCallbackMask)GetProcAddress(hACSCLibraryModule, "_acsc_GetCallbackMask@12"); // 232 + acsc_SetCallbackMask = (ACSC_SetCallbackMask)GetProcAddress(hACSCLibraryModule, "_acsc_SetCallbackMask@16"); // 233 + acsc_InstallCallback = (ACSC_InstallCallback)GetProcAddress(hACSCLibraryModule, "_acsc_InstallCallback@16"); // 234 + acsc_PegInc = (ACSC_PegInc)GetProcAddress(hACSCLibraryModule, "_acsc_PegInc@60"); // 235 + acsc_PegRandom = (ACSC_PegRandom)GetProcAddress(hACSCLibraryModule, "_acsc_PegRandom@44"); // 236 + acsc_Commut = (ACSC_Commut)GetProcAddress(hACSCLibraryModule, "_acsc_Commut@12"); // 237 + acsc_WaitMotorCommutated = (ACSC_WaitMotorCommutated)GetProcAddress(hACSCLibraryModule, "_acsc_WaitMotorCommutated@16");// 238 + acsc_GetConnectionsList = (ACSC_GetConnectionsList)GetProcAddress(hACSCLibraryModule, "_acsc_GetConnectionsList@12"); // 245 + acsc_TerminateConnection = (ACSC_TerminateConnection)GetProcAddress(hACSCLibraryModule, "_acsc_TerminateConnection@4"); // 246 + acsc_SetServerExt = (ACSC_SetServerExt)GetProcAddress(hACSCLibraryModule, "_acsc_SetServerExt@8"); // 247 + acsc_SetServerExtLogin = (ACSC_SetServerExtLogin)GetProcAddress(hACSCLibraryModule, "_acsc_SetServerExtLogin@20");// 248 + acsc_DataCollection = (ACSC_DataCollection)GetProcAddress(hACSCLibraryModule, "_acsc_DataCollection@32"); // 249 + acsc_LoadDataToController = (ACSC_LoadDataToController)GetProcAddress(hACSCLibraryModule, "_acsc_LoadDataToController@44");// 250 + acsc_RegisterEmergencyStop = (ACSC_RegisterEmergencyStop)GetProcAddress(hACSCLibraryModule, "_acsc_RegisterEmergencyStop@0"); // 251 + acsc_UnregisterEmergencyStop = (ACSC_UnregisterEmergencyStop)GetProcAddress(hACSCLibraryModule, "_acsc_UnregisterEmergencyStop@0"); // 252 + acsc_UploadDataFromController = (ACSC_UploadDataFromController)GetProcAddress(hACSCLibraryModule, "_acsc_UploadDataFromController@48"); // 253 + acsc_AnalyzeApplication = (ACSC_AnalyzeApplication)GetProcAddress(hACSCLibraryModule, "_acsc_AnalyzeApplication@16"); // 254 + acsc_FreeApplication = (ACSC_FreeApplication)GetProcAddress(hACSCLibraryModule, "_acsc_FreeApplication@4"); // 255 + acsc_SaveApplication = (ACSC_SaveApplication)GetProcAddress(hACSCLibraryModule, "_acsc_SaveApplication@16"); // 256 + acsc_LoadApplication = (ACSC_LoadApplication)GetProcAddress(hACSCLibraryModule, "_acsc_LoadApplication@16"); // 257 + acsc_GetUMDVersion = (ACSC_GetUMDVersion)GetProcAddress(hACSCLibraryModule, "_acsc_GetUMDVersion@0");// 258 + acsc_OpenCommEthernetTCP = (ACSC_OpenCommEthernetTCP)GetProcAddress(hACSCLibraryModule, "_acsc_OpenCommEthernetTCP@8"); // 259 + acsc_OpenCommEthernetUDP = (ACSC_OpenCommEthernetUDP)GetProcAddress(hACSCLibraryModule, "_acsc_OpenCommEthernetUDP@8"); // 260 + acsc_ControllerReboot = (ACSC_ControllerReboot)GetProcAddress(hACSCLibraryModule, "_acsc_ControllerReboot@8"); // 262 + acsc_ControllerFactoryDefault = (ACSC_ControllerFactoryDefault)GetProcAddress(hACSCLibraryModule, "_acsc_ControllerFactoryDefault@8"); // 263 + acsc_GetSharedMemoryAddress = (ACSC_GetSharedMemoryAddress)GetProcAddress(hACSCLibraryModule, "_acsc_GetSharedMemoryAddress@20"); // 264 + acsc_ReadSharedMemoryReal = (ACSC_ReadSharedMemoryReal)GetProcAddress(hACSCLibraryModule, "_acsc_ReadSharedMemoryReal@28");// 265 + acsc_ReadSharedMemoryInteger = (ACSC_ReadSharedMemoryInteger)GetProcAddress(hACSCLibraryModule, "_acsc_ReadSharedMemoryInteger@28"); // 266 + acsc_WriteSharedMemoryReal = (ACSC_WriteSharedMemoryReal)GetProcAddress(hACSCLibraryModule, "_acsc_WriteSharedMemoryReal@28"); // 267 + acsc_WriteSharedMemoryInteger = (ACSC_WriteSharedMemoryInteger)GetProcAddress(hACSCLibraryModule, "_acsc_WriteSharedMemoryInteger@28"); // 268 + acsc_SysInfo = (ACSC_SysInfo)GetProcAddress(hACSCLibraryModule, "_acsc_SysInfo@16"); // 269 + acsc_GetAxesCount = (ACSC_GetAxesCount)GetProcAddress(hACSCLibraryModule, "_acsc_GetAxesCount@12"); // 270 + acsc_GetBuffersCount = (ACSC_GetBuffersCount)GetProcAddress(hACSCLibraryModule, "_acsc_GetBuffersCount@12"); // 271 + acsc_GetDBufferIndex = (ACSC_GetDBufferIndex)GetProcAddress(hACSCLibraryModule, "_acsc_GetDBufferIndex@12"); // 272 + acsc_AssignPegNT = (ACSC_AssignPegNT)GetProcAddress(hACSCLibraryModule, "_acsc_AssignPegNT@20"); // 273 + acsc_AssignPegOutputsNT = (ACSC_AssignPegOutputsNT)GetProcAddress(hACSCLibraryModule, "_acsc_AssignPegOutputsNT@20"); // 274 + acsc_AssignFastInputsNT = (ACSC_AssignFastInputsNT)GetProcAddress(hACSCLibraryModule, "_acsc_AssignFastInputsNT@20"); // 275 + acsc_PegIncNT = (ACSC_PegIncNT)GetProcAddress(hACSCLibraryModule, "_acsc_PegIncNT@60"); // 276 + acsc_PegRandomNT = (ACSC_PegRandomNT)GetProcAddress(hACSCLibraryModule, "_acsc_PegRandomNT@56"); // 277 + acsc_WaitPegReadyNT = (ACSC_WaitPegReadyNT)GetProcAddress(hACSCLibraryModule, "_acsc_WaitPegReadyNT@12"); // 278 + acsc_StartPegNT = (ACSC_StartPegNT)GetProcAddress(hACSCLibraryModule, "_acsc_StartPegNT@12"); // 279 + acsc_StopPegNT = (ACSC_StopPegNT)GetProcAddress(hACSCLibraryModule, "_acsc_StopPegNT@12"); // 280 + acsc_GetEtherCATState = (ACSC_GetEtherCATState)GetProcAddress(hACSCLibraryModule, "_acsc_GetEtherCATState@12"); // 281 + acsc_GetEtherCATError = (ACSC_GetEtherCATError)GetProcAddress(hACSCLibraryModule, "_acsc_GetEtherCATError@12"); // 282 + acsc_MapEtherCATInput = (ACSC_MapEtherCATInput)GetProcAddress(hACSCLibraryModule, "_acsc_MapEtherCATInput@20"); // 283 + acsc_MapEtherCATOutput = (ACSC_MapEtherCATOutput)GetProcAddress(hACSCLibraryModule, "_acsc_MapEtherCATOutput@20");// 284 + acsc_UnmapEtherCATInputsOutputs = (ACSC_UnmapEtherCATInputsOutputs)GetProcAddress(hACSCLibraryModule, "_acsc_UnmapEtherCATInputsOutputs@8"); // 285 + acsc_GetEtherCATSlaveIndex = (ACSC_GetEtherCATSlaveIndex)GetProcAddress(hACSCLibraryModule, "_acsc_GetEtherCATSlaveIndex@24"); // 286 + acsc_GetEtherCATSlaveOffset = (ACSC_GetEtherCATSlaveOffset)GetProcAddress(hACSCLibraryModule, "_acsc_GetEtherCATSlaveOffset@20"); // 287 + acsc_GetEtherCATSlaveVendorID = (ACSC_GetEtherCATSlaveVendorID)GetProcAddress(hACSCLibraryModule, "_acsc_GetEtherCATSlaveVendorID@16"); // 288 + acsc_GetEtherCATSlaveProductID = (ACSC_GetEtherCATSlaveProductID)GetProcAddress(hACSCLibraryModule, "_acsc_GetEtherCATSlaveProductID@16"); // 289 + acsc_GetEtherCATSlaveRevision = (ACSC_GetEtherCATSlaveRevision)GetProcAddress(hACSCLibraryModule, "_acsc_GetEtherCATSlaveRevision@16"); // 290 + acsc_GetEtherCATSlaveType = (ACSC_GetEtherCATSlaveType)GetProcAddress(hACSCLibraryModule, "_acsc_GetEtherCATSlaveType@20");// 291 + acsc_GetEtherCATSlaveState = (ACSC_GetEtherCATSlaveState)GetProcAddress(hACSCLibraryModule, "_acsc_GetEtherCATSlaveState@16"); // 292 + acsc_DownloadFileOverEtherCAT = (ACSC_DownloadFileOverEtherCAT)GetProcAddress(hACSCLibraryModule, "_acsc_DownloadFileOverEtherCAT@20"); // 293 + acsc_ReadSDOValueOverEtherCAT = (ACSC_ReadSDOValueOverEtherCAT)GetProcAddress(hACSCLibraryModule, "_acsc_ReadSDOValueOverEtherCAT@28"); // 294 + acsc_WriteSDOValueOverEtherCAT = (ACSC_WriteSDOValueOverEtherCAT)GetProcAddress(hACSCLibraryModule, "_acsc_WriteSDOValueOverEtherCAT@32"); // 295 + acsc_GetConnectionInfo = (ACSC_GetConnectionInfo)GetProcAddress(hACSCLibraryModule, "_acsc_GetConnectionInfo@8");// 296 + acsc_GetLogData = (ACSC_GetLogData)GetProcAddress(hACSCLibraryModule, "_acsc_GetLogData@20"); // 297 + acsc_OpenSCLogFile = (ACSC_OpenSCLogFile)GetProcAddress(hACSCLibraryModule, "_acsc_OpenSCLogFile@8");// 298 + acsc_CloseSCLogFile = (ACSC_CloseSCLogFile)GetProcAddress(hACSCLibraryModule, "_acsc_CloseSCLogFile@4"); // 299 + acsc_WriteSCLogFile = (ACSC_WriteSCLogFile)GetProcAddress(hACSCLibraryModule, "_acsc_WriteSCLogFile@12"); // 300 + acsc_FlushSCLogFile = (ACSC_FlushSCLogFile)GetProcAddress(hACSCLibraryModule, "_acsc_FlushSCLogFile@8"); // 301 + acsc_FlushLogFile = (ACSC_FlushLogFile)GetProcAddress(hACSCLibraryModule, "_acsc_FlushLogFile@4"); // 302 + acsc_DataCollectionExt = (ACSC_DataCollectionExt)GetProcAddress(hACSCLibraryModule, "_acsc_DataCollectionExt@36");// 303 + acsc_CopyFileToController = (ACSC_CopyFileToController)GetProcAddress(hACSCLibraryModule, "_acsc_CopyFileToController@16");// 304 + acsc_SegmentedMotion = (ACSC_SegmentedMotion)GetProcAddress(hACSCLibraryModule, "_acsc_SegmentedMotion@20"); // 305 + acsc_ExtendedSegmentedMotion = (ACSC_ExtendedSegmentedMotion)GetProcAddress(hACSCLibraryModule, "_acsc_ExtendedSegmentedMotion@64"); // 306 + acsc_SegmentLine = (ACSC_SegmentLine)GetProcAddress(hACSCLibraryModule, "_acsc_SegmentLine@52"); // 307 + acsc_SegmentArc1 = (ACSC_SegmentArc1)GetProcAddress(hACSCLibraryModule, "_acsc_SegmentArc1@60"); // 308 + acsc_SegmentArc2 = (ACSC_SegmentArc2)GetProcAddress(hACSCLibraryModule, "_acsc_SegmentArc2@60"); // 309 + acsc_GetAnalogInputNT = (ACSC_GetAnalogInputNT)GetProcAddress(hACSCLibraryModule, "_acsc_GetAnalogInputNT@16"); // 310 + acsc_GetAnalogOutputNT = (ACSC_GetAnalogOutputNT)GetProcAddress(hACSCLibraryModule, "_acsc_GetAnalogOutputNT@16");// 311 + acsc_SetAnalogOutputNT = (ACSC_SetAnalogOutputNT)GetProcAddress(hACSCLibraryModule, "_acsc_SetAnalogOutputNT@20");// 312 + acsc_GetVolatileMemoryUsage = (ACSC_GetVolatileMemoryUsage)GetProcAddress(hACSCLibraryModule, "_acsc_GetVolatileMemoryUsage@12"); // 313 + acsc_GetVolatileMemoryTotal = (ACSC_GetVolatileMemoryTotal)GetProcAddress(hACSCLibraryModule, "_acsc_GetVolatileMemoryTotal@12"); // 314 + acsc_GetVolatileMemoryFree = (ACSC_GetVolatileMemoryFree)GetProcAddress(hACSCLibraryModule, "_acsc_GetVolatileMemoryFree@12"); // 315 + acsc_GetNonVolatileMemoryUsage = (ACSC_GetNonVolatileMemoryUsage)GetProcAddress(hACSCLibraryModule, "_acsc_GetNonVolatileMemoryUsage@12"); // 316 + acsc_GetNonVolatileMemoryTotal = (ACSC_GetNonVolatileMemoryTotal)GetProcAddress(hACSCLibraryModule, "_acsc_GetNonVolatileMemoryTotal@12"); // 317 + acsc_GetNonVolatileMemoryFree = (ACSC_GetNonVolatileMemoryFree)GetProcAddress(hACSCLibraryModule, "_acsc_GetNonVolatileMemoryFree@12"); // 318 + acsc_DeleteFileFromController = (ACSC_DeleteFileFromController)GetProcAddress(hACSCLibraryModule, "_acsc_DeleteFileFromController@12"); // 319 + acsc_ControllerSaveToFlash = (ACSC_ControllerSaveToFlash)GetProcAddress(hACSCLibraryModule, "_acsc_ControllerSaveToFlash@20"); // 320 + acsc_StartSPiiPlusSC = (ACSC_StartSPiiPlusSC)GetProcAddress(hACSCLibraryModule, "_acsc_StartSPiiPlusSC@0"); // 321 + acsc_StopSPiiPlusSC = (ACSC_StopSPiiPlusSC)GetProcAddress(hACSCLibraryModule, "_acsc_StopSPiiPlusSC@0"); // 322 + acsc_OpenCommSimulator = (ACSC_OpenCommSimulator)GetProcAddress(hACSCLibraryModule, "_acsc_OpenCommSimulator@4");// 323 + acsc_CloseSimulator = (ACSC_CloseSimulator)GetProcAddress(hACSCLibraryModule, "_acsc_CloseSimulator@0"); // 324 + acsc_ClearBreakpoints = (ACSC_ClearBreakpoints)GetProcAddress(hACSCLibraryModule, "_acsc_ClearBreakpoints@16"); // 325 + acsc_SetBreakpoint = (ACSC_SetBreakpoint)GetProcAddress(hACSCLibraryModule, "_acsc_SetBreakpoints@16");// 326 + acsc_GetBreakpointsList = (ACSC_GetBreakpointsList)GetProcAddress(hACSCLibraryModule, "_acsc_GetBreakpointsList@24"); // 327 + acsc_GetEthernetCards = (ACSC_GetEthernetCards)GetProcAddress(hACSCLibraryModule, "_acsc_GetEthernetCards"); // 328 + acsc_WaitCollectEndExt = (ACSC_WaitCollectEndExt)GetProcAddress(hACSCLibraryModule, "_acsc_WaitCollectEndExt@12");// 329 + acsc_CommutExt = (ACSC_CommutExt)GetProcAddress(hACSCLibraryModule, "_acsc_CommutExt@24"); // 330 + acsc_SegmentLineExt = (ACSC_SegmentLineExt)GetProcAddress(hACSCLibraryModule, "_acsc_SegmentLine@52");// 331 + acsc_SegmentArc1Ext = (ACSC_SegmentArc1Ext)GetProcAddress(hACSCLibraryModule, "_acsc_SegmentArc1@60");// 332 + acsc_SegmentArc2Ext = (ACSC_SegmentArc2Ext)GetProcAddress(hACSCLibraryModule, "_acsc_SegmentArc2@60");// 333 + acsc_ExtendedSegmentedMotionExt = (ACSC_ExtendedSegmentedMotionExt)GetProcAddress(hACSCLibraryModule, "_acsc_ExtendedSegmentedMotion@64"); // 334 + acsc_BlendedSegmentMotion = (ACSC_BlendedSegmentMotion)GetProcAddress(hACSCLibraryModule, "_acsc_BlendedSegmentMotion@52");// 335 + acsc_BlendedLine = (ACSC_BlendedLine)GetProcAddress(hACSCLibraryModule, "_acsc_BlendedLine@52"); // 336 + acsc_BlendedArc1 = (ACSC_BlendedArc1)GetProcAddress(hACSCLibraryModule, "_acsc_BlendedArc1@60"); // 337 + acsc_BlendedArc2 = (ACSC_BlendedArc2)GetProcAddress(hACSCLibraryModule, "_acsc_BlendedArc2@60"); // 338 + acsc_ExtendedSegmentArc1 = (ACSC_ExtendedSegmentArc1)GetProcAddress(hACSCLibraryModule, "_acsc_ExtendedSegmentArc1@68");// 339 + acsc_ExtendedSegmentArc2 = (ACSC_ExtendedSegmentArc2)GetProcAddress(hACSCLibraryModule, "_acsc_ExtendedSegmentArc2@72");// 340 + acsc_FFT = (ACSC_FFT)GetProcAddress(hACSCLibraryModule, "_acsc_FFT@20"); // 341 + acsc_FRF_CalculateClosedLoopFRD = (ACSC_FRF_CalculateClosedLoopFRD)GetProcAddress(hACSCLibraryModule, "_acsc_FRF_CalculateClosedLoopFRD@20"); // 342 + acsc_FRF_CalculateControllerFRD = (ACSC_FRF_CalculateControllerFRD)GetProcAddress(hACSCLibraryModule, "_acsc_FRF_CalculateControllerFRD@24"); // 343 + acsc_FRF_CalculateMeasurementDuration = (ACSC_FRF_CalculateMeasurementDuration)GetProcAddress(hACSCLibraryModule, "_acsc_FRF_CalculateMeasurementDuration@12"); // 344! + acsc_FRF_CalculateOpenLoopFRD = (ACSC_FRF_CalculateOpenLoopFRD)GetProcAddress(hACSCLibraryModule, "_acsc_FRF_CalculateOpenLoopFRD@20"); // 345 + acsc_FRF_CalculateStabilityMargins = (ACSC_FRF_CalculateStabilityMargins)GetProcAddress(hACSCLibraryModule, "_acsc_FRF_CalculateStabilityMargins@12"); // 346 + acsc_FRF_FreeFRD = (ACSC_FRF_FreeFRD)GetProcAddress(hACSCLibraryModule, "_acsc_FRF_FreeFRD@8"); // 347 + acsc_FRF_FreeOutput = (ACSC_FRF_FreeOutput)GetProcAddress(hACSCLibraryModule, "_acsc_FRF_FreeOutput@8"); // 348 + acsc_FRF_FreeStabilityMargins = (ACSC_FRF_FreeStabilityMargins)GetProcAddress(hACSCLibraryModule, "_acsc_FRF_FreeStabilityMargins@8"); // 349 + acsc_FRF_InitInput = (ACSC_FRF_InitInput)GetProcAddress(hACSCLibraryModule, "_acsc_FRF_InitInput@8");// 350 + acsc_FRF_Measure = (ACSC_FRF_Measure)GetProcAddress(hACSCLibraryModule, "_acsc_FRF_Measure@16"); // 351 + acsc_FRF_ReadServoParameters = (ACSC_FRF_ReadServoParameters)GetProcAddress(hACSCLibraryModule, "_acsc_FRF_ReadServoParameters@16"); // 352 + acsc_FRF_Stop = (ACSC_FRF_Stop)GetProcAddress(hACSCLibraryModule, "_acsc_FRF_Stop@12"); // 353 + acsc_JitterAnalysis = (ACSC_JitterAnalysis)GetProcAddress(hACSCLibraryModule, "_acsc_JitterAnalysis@12"); // 354 + acsc_JitterAnalysis_FreeOutput = (ACSC_JitterAnalysis_FreeOutput)GetProcAddress(hACSCLibraryModule, "_acsc_JitterAnalysis_FreeOutput@8"); // 355 + acsc_GetEthernetCardsExt = (ACSC_GetEthernetCardsExt)GetProcAddress(hACSCLibraryModule, "_acsc_GetEthernetCardsExt"); // 356 + return 1; + } + ////////////////////////////////////////////////////////////////////////////////////////////////// + // The function unmapps from the address space of the calling process. + ////////////////////////////////////////////////////////////////////////////////////////////////// + static int FreeACSCLibrary() + { + return FreeLibrary(hACSCLibraryModule); + } +#else // defined (ACSC_RUNTIME_DYNAMIC_VARIABLES) + extern ACSC_AddMPoint acsc_AddMPoint; + extern ACSC_AddMPointM acsc_AddMPointM; + extern ACSC_AddPoint acsc_AddPoint; + extern ACSC_AddPointM acsc_AddPointM; + extern ACSC_AppendBuffer acsc_AppendBuffer; + extern ACSC_Arc1 acsc_Arc1; + extern ACSC_Arc2 acsc_Arc2; + extern ACSC_Break acsc_Break; + extern ACSC_BreakM acsc_BreakM; + extern ACSC_CancelOperation acsc_CancelOperation; + extern ACSC_CaptureComm acsc_CaptureComm; + extern ACSC_ClearBuffer acsc_ClearBuffer; + extern ACSC_ClearVariables acsc_ClearVariables; + extern ACSC_CloseComm acsc_CloseComm; + extern ACSC_CloseHistoryBuffer acsc_CloseHistoryBuffer; + extern ACSC_CloseLogFile acsc_CloseLogFile; + extern ACSC_CloseSCLogFile acsc_CloseSCLogFile; + extern ACSC_CloseMessageBuffer acsc_CloseMessageBuffer; + extern ACSC_Collect acsc_Collect; + extern ACSC_Command acsc_Command; + extern ACSC_Commut acsc_Commut; + extern ACSC_CommutExt acsc_CommutExt; + extern ACSC_CompileBuffer acsc_CompileBuffer; + extern ACSC_DeclareVariable acsc_DeclareVariable; + extern ACSC_Disable acsc_Disable; + extern ACSC_DisableAll acsc_DisableAll; + extern ACSC_DisableFault acsc_DisableFault; + extern ACSC_DisableM acsc_DisableM; + extern ACSC_DisableResponse acsc_DisableResponse; + extern ACSC_DownloadBuffer acsc_DownloadBuffer; + extern ACSC_Enable acsc_Enable; + extern ACSC_EnableFault acsc_EnableFault; + extern ACSC_EnableM acsc_EnableM; + extern ACSC_EnableResponse acsc_EnableResponse; + extern ACSC_EndSequence acsc_EndSequence; + extern ACSC_EndSequenceM acsc_EndSequenceM; + extern ACSC_ExtAddPoint acsc_ExtAddPoint; + extern ACSC_ExtAddPointM acsc_ExtAddPointM; + extern ACSC_ExtArc1 acsc_ExtArc1; + extern ACSC_ExtArc2 acsc_ExtArc2; + extern ACSC_ExtLine acsc_ExtLine; + extern ACSC_ExtToPoint acsc_ExtToPoint; + extern ACSC_ExtToPointM acsc_ExtToPointM; + extern ACSC_FlushLogFile acsc_FlushLogFile; + extern ACSC_FlushSCLogFile acsc_FlushSCLogFile; + extern ACSC_GetAcceleration acsc_GetAcceleration; + extern ACSC_GetAnalogInput acsc_GetAnalogInput; + extern ACSC_GetAnalogOutput acsc_GetAnalogOutput; + extern ACSC_GetAxisState acsc_GetAxisState; + extern ACSC_GetCommOptions acsc_GetCommOptions; + extern ACSC_GetDeceleration acsc_GetDeceleration; + extern ACSC_GetDefaultTimeout acsc_GetDefaultTimeout; + extern ACSC_GetErrorString acsc_GetErrorString; + extern ACSC_GetExtInput acsc_GetExtInput; + extern ACSC_GetExtInputPort acsc_GetExtInputPort; + extern ACSC_GetExtOutput acsc_GetExtOutput; + extern ACSC_GetExtOutputPort acsc_GetExtOutputPort; + extern ACSC_GetFPosition acsc_GetFPosition; + extern ACSC_GetFVelocity acsc_GetFVelocity; + extern ACSC_GetFault acsc_GetFault; + extern ACSC_GetFaultMask acsc_GetFaultMask; + extern ACSC_GetFirmwareVersion acsc_GetFirmwareVersion; + extern ACSC_GetHistory acsc_GetHistory; + extern ACSC_GetIndexState acsc_GetIndexState; + extern ACSC_GetInput acsc_GetInput; + extern ACSC_GetInputPort acsc_GetInputPort; + extern ACSC_GetInterruptMask acsc_GetInterruptMask; + extern ACSC_GetCallbackMask acsc_GetCallbackMask; + extern ACSC_GetJerk acsc_GetJerk; + extern ACSC_GetKillDeceleration acsc_GetKillDeceleration; + extern ACSC_GetLastError acsc_GetLastError; + extern ACSC_GetLibraryVersion acsc_GetLibraryVersion; + extern ACSC_GetMessage acsc_GetMessage; + extern ACSC_GetMotionError acsc_GetMotionError; + extern ACSC_GetMotorError acsc_GetMotorError; + extern ACSC_GetMotorState acsc_GetMotorState; + extern ACSC_GetOutput acsc_GetOutput; + extern ACSC_GetOutputPort acsc_GetOutputPort; + extern ACSC_GetPCICards acsc_GetPCICards; + extern ACSC_GetEthernetCards acsc_GetEthernetCards; + extern ACSC_GetEthernetCardsExt acsc_GetEthernetCardsExt; + extern ACSC_GetProgramError acsc_GetProgramError; + extern ACSC_GetProgramState acsc_GetProgramState; + extern ACSC_GetRPosition acsc_GetRPosition; + extern ACSC_GetRVelocity acsc_GetRVelocity; + extern ACSC_GetResponseMask acsc_GetResponseMask; + extern ACSC_GetSafetyInput acsc_GetSafetyInput; + extern ACSC_GetSafetyInputPort acsc_GetSafetyInputPort; + extern ACSC_GetSafetyInputPortInv acsc_GetSafetyInputPortInv; + extern ACSC_GetSerialNumber acsc_GetSerialNumber; + extern ACSC_GetTimeout acsc_GetTimeout; + extern ACSC_GetVelocity acsc_GetVelocity; + extern ACSC_Goacsc_Go; + extern ACSC_GoMacsc_GoM; + extern ACSC_Group acsc_Group; + extern ACSC_Halt acsc_Halt; + extern ACSC_HaltM acsc_HaltM; + extern ACSC_Jogacsc_Jog; + extern ACSC_JogM acsc_JogM; + extern ACSC_Kill acsc_Kill; + extern ACSC_KillExt acsc_KillExt; + extern ACSC_DisableExt acsc_DisableExt; + extern ACSC_KillAll acsc_KillAll; + extern ACSC_KillM acsc_KillM; + extern ACSC_Line acsc_Line; + extern ACSC_LoadBuffer acsc_LoadBuffer; + extern ACSC_MultiPoint acsc_MultiPoint; + extern ACSC_MultiPointM acsc_MultiPointM; +#if defined(WIN32) && !defined(UNDER_RTSS) + extern ACSC_OpenCommDirect acsc_OpenCommDirect; + extern ACSC_OpenCommSimulator acsc_OpenCommSimulator; + extern ACSC_CloseSimulator acsc_CloseSimulator; + extern ACSC_OpenCommEthernet acsc_OpenCommEthernet; + extern ACSC_OpenCommEthernetUDP acsc_OpenCommEthernetUDP; + extern ACSC_OpenCommEthernetTCP acsc_OpenCommEthernetTCP; + extern ACSC_OpenCommSerial acsc_OpenCommSerial; +#endif + extern ACSC_OpenCommPCI acsc_OpenCommPCI; + extern ACSC_OpenHistoryBuffer acsc_OpenHistoryBuffer; + extern ACSC_OpenLogFile acsc_OpenLogFile; + extern ACSC_OpenSCLogFile acsc_OpenSCLogFile; + extern ACSC_OpenMessageBuffer acsc_OpenMessageBuffer; + extern ACSC_Projection acsc_Projection; + extern ACSC_ReadDPRAMInteger acsc_ReadDPRAMInteger; + extern ACSC_ReadDPRAMReal acsc_ReadDPRAMReal; + extern ACSC_ReadInteger acsc_ReadInteger; + extern ACSC_ReadReal acsc_ReadReal; + extern ACSC_Receive acsc_Receive; + extern ACSC_ReleaseComm acsc_ReleaseComm; + extern ACSC_ResetIndexState acsc_ResetIndexState; + extern ACSC_RunBuffer acsc_RunBuffer; + extern ACSC_Segment acsc_Segment; + extern ACSC_Send acsc_Send; + extern ACSC_SetAcceleration acsc_SetAcceleration; + extern ACSC_SetAccelerationImm acsc_SetAccelerationImm; + extern ACSC_SetAnalogOutput acsc_SetAnalogOutput; + extern ACSC_SetCallback acsc_SetCallback; + extern ACSC_SetCallbackPriority acsc_SetCallbackPriority; + extern ACSC_SetCommOptions acsc_SetCommOptions; + extern ACSC_SetDeceleration acsc_SetDeceleration; + extern ACSC_SetDecelerationImm acsc_SetDecelerationImm; + extern ACSC_SetExtOutput acsc_SetExtOutput; + extern ACSC_SetExtOutputPort acsc_SetExtOutputPort; + extern ACSC_SetFPosition acsc_SetFPosition; + extern ACSC_SetFaultMask acsc_SetFaultMask; + extern ACSC_SetInterruptMask acsc_SetInterruptMask; + extern ACSC_SetCallbackMask acsc_SetCallbackMask; + extern ACSC_SetIterations acsc_SetIterations; + extern ACSC_SetJerk acsc_SetJerk; + extern ACSC_SetJerkImm acsc_SetJerkImm; + extern ACSC_SetKillDeceleration acsc_SetKillDeceleration; + extern ACSC_SetKillDecelerationImm acsc_SetKillDecelerationImm; + extern ACSC_SetMaster acsc_SetMaster; + extern ACSC_SetOutput acsc_SetOutput; + extern ACSC_SetOutputPort acsc_SetOutputPort; + extern ACSC_SetRPosition acsc_SetRPosition; + extern ACSC_SetResponseMask acsc_SetResponseMask; + extern ACSC_SetSafetyInputPortInv acsc_SetSafetyInputPortInv; + extern ACSC_SetTimeout acsc_SetTimeout; + extern ACSC_SetVelocity acsc_SetVelocity; + extern ACSC_SetVelocityImm acsc_SetVelocityImm; + extern ACSC_Slave acsc_Slave; + extern ACSC_SlaveStalled acsc_SlaveStalled; + extern ACSC_Spline acsc_Spline; + extern ACSC_SplineM acsc_SplineM; + extern ACSC_Split acsc_Split; + extern ACSC_SplitAll acsc_SplitAll; + extern ACSC_StopBuffer acsc_StopBuffer; + extern ACSC_StopCollect acsc_StopCollect; + extern ACSC_Stopper acsc_Stopper; + extern ACSC_SuspendBuffer acsc_SuspendBuffer; + extern ACSC_ToPoint acsc_ToPoint; + extern ACSC_ToPointM acsc_ToPointM; + extern ACSC_Transaction acsc_Transaction; + extern ACSC_UploadBuffer acsc_UploadBuffer; + extern ACSC_WaitCollectEnd acsc_WaitCollectEnd; + extern ACSC_WaitCollectEndExt acsc_WaitCollectEndExt; + extern ACSC_WaitForAsyncCall acsc_WaitForAsyncCall; + extern ACSC_WaitInput acsc_WaitInput; + extern ACSC_WaitLogicalMotionEnd acsc_WaitLogicalMotionEnd; + extern ACSC_WaitMotionEnd acsc_WaitMotionEnd; + extern ACSC_WaitMotorEnabled acsc_WaitMotorEnabled; + extern ACSC_WaitMotorCommutated acsc_WaitMotorCommutated; + extern ACSC_WaitProgramEnd acsc_WaitProgramEnd; + extern ACSC_WaitUserCondition acsc_WaitUserCondition; + extern ACSC_WriteDPRAMInteger acsc_WriteDPRAMInteger; + extern ACSC_WriteDPRAMReal acsc_WriteDPRAMReal; + extern ACSC_WriteInteger acsc_WriteInteger; + extern ACSC_WriteLogFile acsc_WriteLogFile; + extern ACSC_WriteSCLogFile acsc_WriteSCLogFile; + extern ACSC_WriteReal acsc_WriteReal; + extern ACSC_LoadBufferIgnoreServiceLines acsc_LoadBufferIgnoreServiceLines; + extern ACSC_LoadBuffersFromFile acsc_LoadBuffersFromFile; + extern ACSC_PegI acsc_PegI; + extern ACSC_PegR acsc_PegR; + extern ACSC_PegInc acsc_PegInc; + extern ACSC_PegRandom acsc_PegRandom; + extern ACSC_AssignPins acsc_AssignPins; + extern ACSC_StopPeg acsc_StopPeg; + extern ACSC_AssignPegNT acsc_AssignPegNT; + extern ACSC_AssignPegOutputsNT acsc_AssignPegOutputsNT; + extern ACSC_AssignFastInputsNT acsc_AssignFastInputsNT; + extern ACSC_PegIncNT acsc_PegIncNT; + extern ACSC_PegRandomNT acsc_PegRandomNT; + extern ACSC_WaitPegReadyNT acsc_WaitPegReadyNT; + extern ACSC_StartPegNT acsc_StartPegNT; + extern ACSC_StopPegNT acsc_StopPegNT; + extern ACSC_CollectB acsc_CollectB; + extern ACSC_DataCollection acsc_DataCollection; + extern ACSC_DataCollectionExt acsc_DataCollectionExt; + extern ACSC_AddPVPoint acsc_AddPVPoint; + extern ACSC_AddPVPointM acsc_AddPVPointM; + extern ACSC_AddPVTPoint acsc_AddPVTPoint; + extern ACSC_AddPVTPointM acsc_AddPVTPointM; + extern ACSC_LoadFileToRealVariable acsc_LoadFileToRealVariable; + extern ACSC_LoadFileToIntegerVariable acsc_LoadFileToIntegerVariable; + extern ACSC_LoadDataToController acsc_LoadDataToController; + extern ACSC_UploadDataFromController acsc_UploadDataFromController; + extern ACSC_SetQueueOverflowTimeout acsc_SetQueueOverflowTimeout; + extern ACSC_GetQueueOverflowTimeout acsc_GetQueueOverflowTimeout; + extern ACSC_SetTargetPosition acsc_SetTargetPosition; + extern ACSC_GetTargetPosition acsc_GetTargetPosition; + extern ACSC_SetTargetPositionM acsc_SetTargetPositionM; + extern ACSC_Track acsc_Track; + extern ACSC_TrackM acsc_TrackM; + extern ACSC_FaultClearM acsc_FaultClearM; + extern ACSC_FaultClear acsc_FaultClear; + extern ACSC_Getconf acsc_Getconf; + extern ACSC_Setconf acsc_Setconf; + extern ACSC_GetConf acsc_GetConf; + extern ACSC_SetConf acsc_SetConf; + extern ACSC_SysInfo acsc_SysInfo; + extern ACSC_GetAxesCount acsc_GetAxesCount; + extern ACSC_GetBuffersCount acsc_GetBuffersCount; + extern ACSC_GetDBufferIndex acsc_GetDBufferIndex; + extern ACSC_SetCallbackExt acsc_SetCallbackExt; + extern ACSC_InstallCallback acsc_InstallCallback; + extern ACSC_DownloadBinVariableToFile acsc_DownloadBinVariableToFile; + extern ACSC_SetLogFileOptions acsc_SetLogFileOptions; + extern ACSC_SetServer acsc_SetServer; + extern ACSC_SetServerExt acsc_SetServerExt; + extern ACSC_SetServerExtLogin acsc_SetServerExtLogin; + extern ACSC_GetSingleMessage acsc_GetSingleMessage; + extern ACSC_GetConnectionsList acsc_GetConnectionsList; + extern ACSC_GetConnectionInfo acsc_GetConnectionInfo; + extern ACSC_TerminateConnection acsc_TerminateConnection; + extern ACSC_GetLogData acsc_GetLogData; + extern ACSC_RegisterEmergencyStop acsc_RegisterEmergencyStop; + extern ACSC_UnregisterEmergencyStop acsc_UnregisterEmergencyStop; + extern ACSC_GetUMDVersion acsc_GetUMDVersion; + extern ACSC_AnalyzeApplication acsc_AnalyzeApplication; + extern ACSC_FreeApplication acsc_FreeApplication; + extern ACSC_SaveApplication acsc_SaveApplication; + extern ACSC_LoadApplication acsc_LoadApplication; + extern ACSC_FFTacsc_FFT; + extern ACSC_FRF_Measure acsc_FRF_Measure; + extern ACSC_FRF_Stop acsc_FRF_Stop; + extern ACSC_FRF_CalculateMeasurementDuration acsc_FRF_CalculateMeasurementDuration; + extern ACSC_FRF_InitInput acsc_FRF_InitInput; + extern ACSC_FRF_FreeOutput acsc_FRF_FreeOutput; + extern ACSC_FRF_ReadServoParameters acsc_FRF_ReadServoParameters; + extern ACSC_FRF_CalculateControllerFRD acsc_FRF_CalculateControllerFRD; + extern ACSC_FRF_CalculateOpenLoopFRD acsc_FRF_CalculateOpenLoopFRD; + extern ACSC_FRF_CalculateClosedLoopFRD acsc_FRF_CalculateClosedLoopFRD; + extern ACSC_FRF_CalculateStabilityMargins acsc_FRF_CalculateStabilityMargins; + extern ACSC_FRF_FreeFRD acsc_FRF_FreeFRD; + extern ACSC_FRF_FreeStabilityMargins acsc_FRF_FreeStabilityMargins; + extern ACSC_JitterAnalysis acsc_JitterAnalysis; + extern ACSC_JitterAnalysis_FreeOutput acsc_JitterAnalysis_FreeOutput; + extern ACSC_ControllerReboot acsc_ControllerReboot; + extern ACSC_ControllerFactoryDefault acsc_ControllerFactoryDefault; + extern ACSC_ControllerSaveToFlash acsc_ControllerSaveToFlash; + extern ACSC_GetSharedMemoryAddress acsc_GetSharedMemoryAddress; + extern ACSC_ReadSharedMemoryReal acsc_ReadSharedMemoryReal; + extern ACSC_ReadSharedMemoryInteger acsc_ReadSharedMemoryInteger; + extern ACSC_WriteSharedMemoryReal acsc_WriteSharedMemoryReal; + extern ACSC_WriteSharedMemoryInteger acsc_WriteSharedMemoryInteger; + extern ACSC_GetEtherCATState acsc_GetEtherCATState; + extern ACSC_GetEtherCATError acsc_GetEtherCATError; + extern ACSC_MapEtherCATInput acsc_MapEtherCATInput; + extern ACSC_MapEtherCATOutput acsc_MapEtherCATOutput; + extern ACSC_UnmapEtherCATInputsOutputs acsc_UnmapEtherCATInputsOutputs; + extern ACSC_GetEtherCATSlaveIndex acsc_GetEtherCATSlaveIndex; + extern ACSC_GetEtherCATSlaveOffset acsc_GetEtherCATSlaveOffset; + extern ACSC_GetEtherCATSlaveVendorID acsc_GetEtherCATSlaveVendorID; + extern ACSC_GetEtherCATSlaveProductID acsc_GetEtherCATSlaveProductID; + extern ACSC_GetEtherCATSlaveRevision acsc_GetEtherCATSlaveRevision; + extern ACSC_GetEtherCATSlaveType acsc_GetEtherCATSlaveType; + extern ACSC_GetEtherCATSlaveState acsc_GetEtherCATSlaveState; + extern ACSC_DownloadFileOverEtherCAT acsc_DownloadFileOverEtherCAT; + extern ACSC_ReadSDOValueOverEtherCAT acsc_ReadSDOValueOverEtherCAT; + extern ACSC_WriteSDOValueOverEtherCAT acsc_WriteSDOValueOverEtherCAT; + extern ACSC_CopyFileToController acsc_CopyFileToController; + extern ACSC_DeleteFileFromController acsc_DeleteFileFromController; + extern ACSC_SegmentedMotion acsc_SegmentedMotion; + extern ACSC_ExtendedSegmentedMotion acsc_ExtendedSegmentedMotion; + extern ACSC_ExtendedSegmentedMotionExt acsc_ExtendedSegmentedMotionExt; + extern ACSC_SegmentLine acsc_SegmentLine; + extern ACSC_SegmentLineExt acsc_SegmentLineExt; + extern ACSC_SegmentArc1 acsc_SegmentArc1; + extern ACSC_SegmentArc2 acsc_SegmentArc2; + extern ACSC_SegmentArc1Ext acsc_SegmentArc1Ext; + extern ACSC_SegmentArc2Ext acsc_SegmentArc2Ext; + extern ACSC_ExtendedSegmentArc1 acsc_ExtendedSegmentArc1; + extern ACSC_ExtendedSegmentArc2 acsc_ExtendedSegmentArc2; + extern ACSC_BlendedSegmentMotion acsc_BlendedSegmentMotion; + extern ACSC_BlendedLine acsc_BlendedLine; + extern ACSC_BlendedArc1 acsc_BlendedArc1; + extern ACSC_BlendedArc2 acsc_BlendedArc2; + extern ACSC_ClearBreakpoints acsc_ClearBreakpoints; + extern ACSC_SetBreakpoint acsc_SetBreakpoint; + extern ACSC_GetBreakpointsList acsc_GetBreakpointsList; + extern ACSC_GetAnalogInputNT acsc_GetAnalogInputNT; + extern ACSC_GetAnalogOutputNT acsc_GetAnalogOutputNT; + extern ACSC_SetAnalogOutputNT acsc_SetAnalogOutputNT; + extern ACSC_GetVolatileMemoryUsage acsc_GetVolatileMemoryUsage; + extern ACSC_GetVolatileMemoryTotal acsc_GetVolatileMemoryTotal; + extern ACSC_GetVolatileMemoryFree acsc_GetVolatileMemoryFree; + extern ACSC_GetNonVolatileMemoryUsage acsc_GetNonVolatileMemoryUsage; + extern ACSC_GetNonVolatileMemoryTotal acsc_GetNonVolatileMemoryTotal; + extern ACSC_GetNonVolatileMemoryFree acsc_GetNonVolatileMemoryFree; + extern ACSC_StartSPiiPlusSC acsc_StartSPiiPlusSC; + extern ACSC_StopSPiiPlusSC acsc_StopSPiiPlusSC; + extern HMODULE hACSCLibraryModule; + ////////////////////////////////////////////////////////////////////////////////////////////////// + // The function loads ACSC.DLL and obtains addresses for all exported functions. + // Call this function before any using of ACSC API. + // Check return value for success. + ////////////////////////////////////////////////////////////////////////////////////////////////// + extern int InitACSCLibrary(); + ////////////////////////////////////////////////////////////////////////////////////////////////// + // The function unmapps from the address space of the calling process. + ////////////////////////////////////////////////////////////////////////////////////////////////// + extern int FreeACSCLibrary(); +#endif +#endif +#ifdef __cplusplus +} +#endif +////////////////////////////////////////////////////////////////////////////////////////////////// +// Internal functions that save and read a global errors +////////////////////////////////////////////////////////////////////////////////////////////////// +// Save last global error +void SetGlobalError(DWORD dwError); +// Read last global error +DWORD GetGlobalError(); +#endif diff --git a/HSI_HexagonMI_EF3/HSI.cpp b/HSI_HexagonMI_EF3/HSI.cpp index b5c6dd1..d248fd7 100644 --- a/HSI_HexagonMI_EF3/HSI.cpp +++ b/HSI_HexagonMI_EF3/HSI.cpp @@ -2,7 +2,7 @@ #include "HSI.h" #include "HSI_Motion.h" #include "HSI_Sevenocean_EF3.h" -#include "SevenOcean\CMMIO_SERIAL.h" +#include "SevenOcean/CMMIO_SERIAL.h" //#include "HSI_Illumination.h" //#include "HSI_Function.h" //#include "HSI_JoyStick.h" @@ -14,102 +14,128 @@ static HWND g_hWnd = nullptr; static bool g_bOfflineOnly = false; +//////////////////////////////////////////////////////////////////////////////////////////////////// +// ˵ +// V0.1 2022/10/10 +//--------------------------------------- +//1 Metus躯14Ƿؼң˶ʼ汾JOG˶˶ָλõȣdll +// +// +// +// +// +// +// +// +// +// +// +// +// +//////////////////////////////////////////////////////////////////////////////////////////////////// + + #pragma region interface //=========================================================================== -HSI_API HSI_STATUS WINAPI HSI_GET_INTERFACE_VERSION(UINT &APIVersionMajor, UINT &APIVersionMinor) +HSI_API HSI_STATUS WINAPI HSI_GET_INTERFACE_VERSION(UINT& APIVersionMajor, UINT& APIVersionMinor) { - APIVersionMajor = HSI_APIVersionMajor; - APIVersionMinor = HSI_APIVersionMinor; - return HSI_STATUS_NORMAL; + APIVersionMajor = HSI_APIVersionMajor; //HSI.dll 汾 + APIVersionMinor = HSI_APIVersionMinor; //HSI.dll С汾 + return HSI_STATUS_NORMAL; } + //=========================================================================== HSI_API HSI_STATUS WINAPI HSI_STARTUP(HWND _hWnd, bool _bOfflineOnly) { - auto rStatus = HSI_STATUS_NORMAL; - if (!g_pHSI_Sevenocean_EF3) - { - g_pHSI_Sevenocean_EF3 = new HSI_Sevenocean_EF3(); - } - if (g_pHSI_Sevenocean_EF3) - { - g_pHSI_Sevenocean_EF3->Startup(_hWnd, _bOfflineOnly); - } - else - { - rStatus = HSI_STATUS_FAILED; - } - g_hWnd = _hWnd; - g_bOfflineOnly = _bOfflineOnly; - return rStatus; + auto rStatus = HSI_STATUS_NORMAL; + if (!g_pHSI_Sevenocean_EF3) + { + g_pHSI_Sevenocean_EF3 = new HSI_Sevenocean_EF3(); + } + if (g_pHSI_Sevenocean_EF3) + { + g_pHSI_Sevenocean_EF3->Startup(_hWnd, _bOfflineOnly); //ʼEF3 + } + else + { + rStatus = HSI_STATUS_FAILED; + } + g_hWnd = _hWnd; + g_bOfflineOnly = _bOfflineOnly; + return rStatus; } + //==========================ȡϢ3EF3================================================= -HSI_API HSI_STATUS WINAPI HSI_GET_MACHINE_INFO(int &_NumMachineTypes) +HSI_API HSI_STATUS WINAPI HSI_GET_MACHINE_INFO(int& _NumMachineTypes) { - auto rStatus = HSI_STATUS_NORMAL; - if (g_pHSI_Sevenocean_EF3) - { - rStatus = g_pHSI_Sevenocean_EF3->GetMachineInfo(_NumMachineTypes); - } - else - { - rStatus = HSI_STATUS_FAILED; - } - return rStatus; + auto rStatus = HSI_STATUS_NORMAL; + if (g_pHSI_Sevenocean_EF3) + { + rStatus = g_pHSI_Sevenocean_EF3->GetMachineInfo(_NumMachineTypes); + } + else + { + rStatus = HSI_STATUS_FAILED; + } + return rStatus; } + //=========================================================================== HSI_API HSI_STATUS WINAPI HSI_SET_EVENT_CALLBACK(pEventCallback _pCallback) { - auto rStatus = HSI_STATUS_NORMAL; - if (g_pHSI_Sevenocean_EF3) - { - rStatus = g_pHSI_Sevenocean_EF3->SetEventCallback(_pCallback); //¼ - } - else - { - rStatus = HSI_STATUS_FAILED; - } - return rStatus; + auto rStatus = HSI_STATUS_NORMAL; + if (g_pHSI_Sevenocean_EF3) + { + rStatus = g_pHSI_Sevenocean_EF3->SetEventCallback(_pCallback); //¼ + } + else + { + rStatus = HSI_STATUS_FAILED; + } + return rStatus; } + //=========================================================================== HSI_API HSI_STATUS WINAPI HSI_SHUTDOWM() { - auto rStatus = HSI_STATUS_NORMAL; - if (g_pLogger) - { - delete g_pLogger; - g_pLogger = NULL; - } - if (g_pLogger2) - { - delete g_pLogger2; - g_pLogger2 = NULL; - } - //if (g_pHSI_Illumination) - //{ - // rStatus = g_pHSI_Illumination->Shutdown(); - // delete g_pHSI_Illumination; - // g_pHSI_Illumination = nullptr; - //} - if (g_pHSI_Motion) - { - rStatus = g_pHSI_Motion->Shutdown(); - delete g_pHSI_Motion; - g_pHSI_Motion = nullptr; - } - //if (g_pHSI_JoyStick) + auto rStatus = HSI_STATUS_NORMAL; + if (g_pLogger) + { + delete g_pLogger; + g_pLogger = nullptr; + } + if (g_pLogger2) + { + delete g_pLogger2; + g_pLogger2 = nullptr; + } + //if (g_pHSI_Illumination) //ι + //{ + // rStatus = g_pHSI_Illumination->Shutdown(); + // delete g_pHSI_Illumination; + // g_pHSI_Illumination = nullptr; + //} + if (g_pHSI_Motion) + { + rStatus = g_pHSI_Motion->Shutdown(); //˶ֹ + delete g_pHSI_Motion; + g_pHSI_Motion = nullptr; + } + //if (g_pHSI_JoyStick) //ҡ //{ // g_pHSI_JoyStick->SuspendJoyStickThread(); // delete g_pHSI_JoyStick; // g_pHSI_JoyStick = nullptr; //} if (g_pHSI_Sevenocean_EF3) - { - g_pHSI_Sevenocean_EF3->Shutdown(); - delete g_pHSI_Sevenocean_EF3; - g_pHSI_Sevenocean_EF3 = nullptr; - } - return rStatus; + { + g_pHSI_Sevenocean_EF3->Shutdown(); //EF3ɾ + delete g_pHSI_Sevenocean_EF3; + g_pHSI_Sevenocean_EF3 = nullptr; + } + return rStatus; } + //=========================================================================== #pragma endregion @@ -159,8 +185,9 @@ HSI_API HSI_STATUS WINAPI HSI_MOTION_STARTUP(bool bHome) } return rStatus; } + //=========================================================================== -HSI_API HSI_STATUS WINAPI HSI_MOTION_GET_FIREWAREVERION(byte *verion) +HSI_API HSI_STATUS WINAPI HSI_MOTION_GET_FIREWAREVERION(byte* verion) { auto rStatus = HSI_STATUS_NORMAL; if (g_pHSI_Motion) @@ -173,6 +200,7 @@ HSI_API HSI_STATUS WINAPI HSI_MOTION_GET_FIREWAREVERION(byte *verion) } return rStatus; } + //=========================================================================== HSI_API HSI_STATUS WINAPI HSI_MOTION_SHUTDOWN() { @@ -189,6 +217,7 @@ HSI_API HSI_STATUS WINAPI HSI_MOTION_SHUTDOWN() } return rStatus; } + //=========================================================================== HSI_API HSI_STATUS WINAPI HSI_MOTION_JOG(UINT AxisTypes, double Speed) { @@ -203,6 +232,7 @@ HSI_API HSI_STATUS WINAPI HSI_MOTION_JOG(UINT AxisTypes, double Speed) } return rStatus; } + //=========================================================================== HSI_API HSI_STATUS WINAPI HSI_MOTION_STOP_JOG() { @@ -217,8 +247,10 @@ HSI_API HSI_STATUS WINAPI HSI_MOTION_STOP_JOG() } return rStatus; } + //=========================================================================== -HSI_API HSI_STATUS WINAPI HSI_MOTION_GET_POSITION_XYZ(UINT AxisTypes, double &PositionX, double &PositionY, double &PositionZ, double &Time) +HSI_API HSI_STATUS WINAPI HSI_MOTION_GET_POSITION_XYZ(UINT AxisTypes, double& PositionX, double& PositionY, + double& PositionZ, double& Time) { auto rStatus = HSI_STATUS_NORMAL; if (g_pHSI_Motion) @@ -231,8 +263,10 @@ HSI_API HSI_STATUS WINAPI HSI_MOTION_GET_POSITION_XYZ(UINT AxisTypes, double &Po } return rStatus; } + //=========================================================================== -HSI_API HSI_STATUS WINAPI HSI_MOTION_SET_POSITION_XYZ(UINT AxisTypes, double PositionX, double PositionY, double PositionZ, HSI_MOTION_MOVE_TYPE eType, double dSpeedGear) +HSI_API HSI_STATUS WINAPI HSI_MOTION_SET_POSITION_XYZ(UINT AxisTypes, double PositionX, double PositionY, + double PositionZ, HSI_MOTION_MOVE_TYPE eType, double dSpeedGear) { auto rStatus = HSI_STATUS_NORMAL; if (g_pHSI_Motion) @@ -245,6 +279,7 @@ HSI_API HSI_STATUS WINAPI HSI_MOTION_SET_POSITION_XYZ(UINT AxisTypes, double Po } return rStatus; } + //=========================================================================== HSI_API HSI_STATUS WINAPI HSI_MOTION_ABORT_MOTION() { @@ -259,8 +294,9 @@ HSI_API HSI_STATUS WINAPI HSI_MOTION_ABORT_MOTION() } return rStatus; } + //=========================================================================== -HSI_API HSI_STATUS WINAPI HSI_MOTION_IS_HOMED(bool &bHomed) +HSI_API HSI_STATUS WINAPI HSI_MOTION_IS_HOMED(bool& bHomed) { auto rStatus = HSI_STATUS_NORMAL; if (g_pHSI_Motion) @@ -1183,7 +1219,6 @@ HSI_API HSI_STATUS WINAPI HSI_ILLUMINATION_TESTLIGHT(bool flag) #endif // USE_ILLUMINATION_API - /////////////////////////////////////////////////////////////////////////////// // Probe API ̽ /////////////////////////////////////////////////////////////////////////////// @@ -1383,4 +1418,3 @@ HSI_API HSI_STATUS WINAPI HSI_TP_SHUTDOWN() /////////////////////////////////////////////////////////////////////////////// // Թ /////////////////////////////////////////////////////////////////////////////// - diff --git a/HSI_HexagonMI_EF3/HSI.h b/HSI_HexagonMI_EF3/HSI.h index 57308af..c20cb8f 100644 --- a/HSI_HexagonMI_EF3/HSI.h +++ b/HSI_HexagonMI_EF3/HSI.h @@ -1,4 +1,3 @@ - #ifndef HSI_H_INCLUDED_ #define HSI_H_INCLUDED_ @@ -24,62 +23,63 @@ const int HSI_APIVersionMajor = 0; const int HSI_APIVersionMinor = 1; -const int HSI_MaxStringLength = 255; // Maximum string length (buffer size - 1) +const int HSI_MaxStringLength = 255; // Maximum string length (buffer size - 1) /////////////////////////////////////////////////////////////////////////////// // Interface API /////////////////////////////////////////////////////////////////////////////// enum HSI_STATUS { - HSI_STATUS_NOT_SUPPORTED = -1, - HSI_STATUS_NORMAL = 0, - HSI_STATUS_FAILED, - HSI_FAILED_DLL_LOAD, + HSI_STATUS_NOT_SUPPORTED = -1, + HSI_STATUS_NORMAL = 0, + HSI_STATUS_FAILED, + HSI_FAILED_DLL_LOAD, - HSI_STATUS_PORTLOCK_HSI_MISMATCH, + HSI_STATUS_PORTLOCK_HSI_MISMATCH, - HSI_STATUS_FILE_NOT_FOUND, - HSI_STATUS_HARDWARE_NOT_FOUND, - HSI_STATUS_INVALID_PARAMETERS, - HSI_STATUS_INVALID_POINTS, - HSI_STATUS_PART_NOT_DETECTED, - HSI_STATUS_MEASURE_ERROR, - HSI_STATUS_TEMPERATURE_ERROR, + HSI_STATUS_FILE_NOT_FOUND, + HSI_STATUS_HARDWARE_NOT_FOUND, + HSI_STATUS_INVALID_PARAMETERS, + HSI_STATUS_INVALID_POINTS, + HSI_STATUS_PART_NOT_DETECTED, + HSI_STATUS_MEASURE_ERROR, + HSI_STATUS_TEMPERATURE_ERROR, - HSI_STATUS_ILLUMINATION_COMM = 50, + HSI_STATUS_ILLUMINATION_COMM = 50, - HSI_STATUS_OPTICS_COMM = 100, - HSI_STATUS_OPTICS_HOMING, - HSI_STATUS_OPTICS_TIMEOUT, - HSI_STATUS_OPTICS_CALIBRATIONDATA, - HSI_STATUS_OPTICS_CALIBRATIONDATADEFAULT, - HSI_STATUS_OPTICS_CALFILEDATACOUNTMISMATCH, + HSI_STATUS_OPTICS_COMM = 100, + HSI_STATUS_OPTICS_HOMING, + HSI_STATUS_OPTICS_TIMEOUT, + HSI_STATUS_OPTICS_CALIBRATIONDATA, + HSI_STATUS_OPTICS_CALIBRATIONDATADEFAULT, + HSI_STATUS_OPTICS_CALFILEDATACOUNTMISMATCH, - HSI_STATUS_MOTION_COMM = 150, - HSI_STATUS_MOTION_HOMING, - HSI_STATUS_MOTION_TIMEOUT, - HSI_STATUS_MOTION_EMERGENCY_STOP, - HSI_STATUS_MOTION_EXCEED_LIMIT, - HSI_STATUS_MOTION_UNKNOWN_ERROR, - HSI_STATUS_MOTION_EXCEED_SW_LIMIT, - HSI_STATUS_MOTION_POSITION_ERROR, - HSI_STATUS_MOTION_MOVING, + HSI_STATUS_MOTION_COMM = 150, + HSI_STATUS_MOTION_HOMING, + HSI_STATUS_MOTION_TIMEOUT, + HSI_STATUS_MOTION_EMERGENCY_STOP, + HSI_STATUS_MOTION_EXCEED_LIMIT, + HSI_STATUS_MOTION_UNKNOWN_ERROR, + HSI_STATUS_MOTION_EXCEED_SW_LIMIT, + HSI_STATUS_MOTION_POSITION_ERROR, + HSI_STATUS_MOTION_MOVING, - HSI_STATUS_TP_UNEXPECTED_HIT = 200, - HSI_STATUS_TP_TIMEOUT = 201, - HSI_STATUS_TP_APPROACH_TIMEOUT = 202, - HSI_STATUS_TP_WRIST_ERROR, + HSI_STATUS_TP_UNEXPECTED_HIT = 200, + HSI_STATUS_TP_TIMEOUT = 201, + HSI_STATUS_TP_APPROACH_TIMEOUT = 202, + HSI_STATUS_TP_WRIST_ERROR, - HSI_STATUS_FG_COMM = 250, - HSI_STATUS_FG_TIMEOUT, - HSI_STATUS_FG_DIRECTX, - HSI_STATUS_FG_COLORDEPTH, + HSI_STATUS_FG_COMM = 250, + HSI_STATUS_FG_TIMEOUT, + HSI_STATUS_FG_DIRECTX, + HSI_STATUS_FG_COLORDEPTH, - HSI_STATUS_LP_TIMEOUT = 300, - HSI_STATUS_LP_EXCEED_LIMIT = 301, + HSI_STATUS_LP_TIMEOUT = 300, + HSI_STATUS_LP_EXCEED_LIMIT = 301, - HSI_STATUS_VP_TIMEOUT = 350, - HSI_STATUS_VP_IMAGEPROCESS_FAIL + HSI_STATUS_VP_TIMEOUT = 350, + HSI_STATUS_VP_IMAGEPROCESS_FAIL }; + enum HSI_MACHINE_TYPE { HSI_MACHINE_UNKNOWN = 0, @@ -89,120 +89,174 @@ enum HSI_MACHINE_TYPE HSI_MACHINE_GOOGOL = 4, HSI_MACHINE_TYPE_TOTAL, }; + enum HSI_EVENT_TYPE { - HSI_EVENT_NONE = 0, - HSI_EVENT_ERROR = 1, - HSI_EVENT_FUNCTION = 2, - HSI_EVENT_NOTIFY = 3, - HSI_EVENT_SAFETY = 4, - HSI_EVENT_SAFETY_KEEP = 5 + HSI_EVENT_NONE = 0, + HSI_EVENT_ERROR = 1, + HSI_EVENT_FUNCTION = 2, + HSI_EVENT_NOTIFY = 3, + HSI_EVENT_SAFETY = 4, + HSI_EVENT_SAFETY_KEEP = 5 }; -enum HSI_EVENT_FUNCTION_ID // EventData -{ // Send Receive - // V4.2 & V4.3 + - HSI_EVENT_DONE = 0, // N/A N/A - HSI_EVENT_TAKE_HIT = 1, // N/A N/A - HSI_EVENT_ERASE_HIT = 2, // N/A N/A - HSI_EVENT_TIME_CRITICAL = 3, // "ON", or "OFF" N/A - HSI_EVENT_ZOOM_IN = 4, // "MAX", "COARSE", or "FINE" N/A - HSI_EVENT_ZOOM_OUT = 5, // "MAX", "COARSE", or "FINE" N/A - HSI_EVENT_REFRESH_LIVE_VIEW = 6, // N/A N/A - HSI_EVENT_UPDATE_READOUTS = 7, // "AxisFlags,%lf{x},%lf{y},%lf{z},%lf{r}" N/A - HSI_EVENT_READ_MC_POSITION = 8, // "AxisFlags" "AxisFlags,%lf{x},%lf{y},%lf{z},%lf{r}" - HSI_EVENT_MOVE_MC_POSITION = 9, // "AxisFlags,%lf{x},%lf{y},%lf{z},%lf{r},%lf{speed},%1d{bWait}" N/A - HSI_EVENT_CONVERT_MC_TO_GLOBAL = 10, // "%lf{x},%lf{y},%lf{z}" "%lf{x},%lf{y},%lf{z}" - HSI_EVENT_UPDATE_STATUS_MESSAGE = 11, // N/A N/A - HSI_EVENT_OPENFILE_DLG = 12, // N/A "FileName" - HSI_EVENT_DISPLAY_YESNO_MESSAGE = 13, // N/A N/A - HSI_EVENT_DISPLAY_OKCANCEL_MESSAGE = 14, // N/A N/A - HSI_EVENT_DISPLAY_OK_MESSAGE = 15, // N/A N/A - // V4.3 + Only - HSI_EVENT_DEBUG_LOG = 20, // "%s" N/A - HSI_EVENT_MOVE_MC_POSITION_AND_SETTLE = 21, // "AxisFlags,%lf{x},%lf{y},%lf{z},%lf{r},%lf{speed}" N/A - HSI_EVENT_CONVERT_GLOBAL_TO_MM = 22, // "%lf{x},%lf{y},%lf{z}" "%lf{x},%lf{y},%lf{z}" - HSI_EVENT_CONVERT_ROT_TO_TABLE_POINT = 23, // "%lf{x},%lf{y},%lf{z}" "%lf{x},%lf{y},%lf{z}" - HSI_EVENT_CONVERT_ROT_OUT_TABLE_POINT = 24, // "%lf{x},%lf{y},%lf{z}" "%lf{x},%lf{y},%lf{z}" - HSI_EVENT_CONVERT_ROT_TO_TABLE_VECTOR = 25, // "%lf{x},%lf{y},%lf{z}" "%lf{x},%lf{y},%lf{z}" - HSI_EVENT_CONVERT_ROT_OUT_TABLE_VECTOR = 26, // "%lf{x},%lf{y},%lf{z}" "%lf{x},%lf{y},%lf{z}" - HSI_EVENT_ILLUMINATION_REFRESH = 27, - HSI_EVENT_ILLUMINATION_LOCK = 28, - HSI_EVENT_ILLUMINATION_STORE_SET = 29, - HSI_EVENT_ILLUMINATION_RESTORE_SET = 30, - HSI_EVENT_ILLUMINATION_DECREASE_ACTIVE = 31, // "%d" - HSI_EVENT_ILLUMINATION_INCREASE_ACTIVE = 32, // "%d" - HSI_EVENT_ILLUMINATION_DECREASE_ALL = 33, // "%d" - HSI_EVENT_ILLUMINATION_INCREASE_ALL = 34, // "%d" - HSI_EVENT_ILLUMINATION_SELECT_LAMP = 35, // "%d" - HSI_EVENT_ILLUMINATION_SET_LAMP_INTENSITY = 36, // "%d" - HSI_EVENT_ILLUMINATION_GET_LAMP_INTENSITY = 37, // "%d" - HSI_EVENT_ILLUMINATION_SET_LAMP_CALIBRATION_OVERRIDE = 38, // "%d" - HSI_EVENT_ILLUMINATION_NEXT_RING = 39, - HSI_EVENT_ILLUMINATION_PREV_RING = 40, - HSI_EVENT_ILLUMINATION_NEXT_SECTOR = 41, - HSI_EVENT_ILLUMINATION_PREV_SECTOR = 42, - HSI_EVENT_ILLUMINATION_NUM_LAMPS_INSTALLED = 43, - HSI_EVENT_ILLUMINATION_IS_LAMP_INSTALLED = 44, - HSI_EVENT_ILLUMINATION_APPLY = 45, - HSI_EVENT_ILLUMINATION_ALLOFF = 46, - HSI_EVENT_ILLUMINATION_ALLON = 47, - HSI_EVENT_ILLUMINATION_UNLOCK = 48, - HSI_EVENT_IS_PROGRAMMING_MODE = 49, // 1/0 - HSI_EVENT_IS_PORTLOCK_DCC = 50, // 1/0 - HSI_EVENT_IS_ROTAB_ENABLED = 51, // 1/0 - HSI_EVENT_IS_TIME_CRITICAL = 52, // 1/0 - HSI_EVENT_CONVERT_MM_TO_GLOBAL = 53, - HSI_EVENT_CONVERT_GLOBAL_TO_MC = 54, - HSI_EVENT_LASER_FOCUS_ENABLE = 55, // "%d" 0 = not available, 1 = available - HSI_EVENT_MOVE_POINT = 56, // N/A N/A - HSI_EVENT_MAG_CHANGED = 57, - HSI_EVENT_ILLUMINATION_SET_LAMP_INTENSITY_IN_MACHINE_LEVELx100 = 58, // "%d" //PR251359-- Instructed to "Please focus on slide" but it's rather unhelpfully turned the lights off for us. - HSI_EVENT_DCC_SCAN_POINTS_AVAILABLE = 59, // "%d" = more to come, 1 = last set N/A - HSI_EVENT_ILLUMINATION_IS_ALL_OFF = 60, // 1/0 //PR253777-- Sensilight does not work if the target has 'ALL OFF' for illum setting--4/16/2008 - HSI_EVENT_ILLUMINATION_DECREASE_ALL_NONZERO = 61, // Sensilight command that wont change a lamp currently set to zero - HSI_EVENT_ILLUMINATION_INCREASE_ALL_NONZERO = 62, // Sensilight command that wont change a lamp currently set to zero22 +enum HSI_EVENT_FUNCTION_ID // EventData +{ + // Send Receive + // V4.2 & V4.3 + + HSI_EVENT_DONE = 0, + // N/A N/A + HSI_EVENT_TAKE_HIT = 1, + // N/A N/A + HSI_EVENT_ERASE_HIT = 2, + // N/A N/A + HSI_EVENT_TIME_CRITICAL = 3, + // "ON", or "OFF" N/A + HSI_EVENT_ZOOM_IN = 4, + // "MAX", "COARSE", or "FINE" N/A + HSI_EVENT_ZOOM_OUT = 5, + // "MAX", "COARSE", or "FINE" N/A + HSI_EVENT_REFRESH_LIVE_VIEW = 6, + // N/A N/A + HSI_EVENT_UPDATE_READOUTS = 7, + // "AxisFlags,%lf{x},%lf{y},%lf{z},%lf{r}" N/A + HSI_EVENT_READ_MC_POSITION = 8, + // "AxisFlags" "AxisFlags,%lf{x},%lf{y},%lf{z},%lf{r}" + HSI_EVENT_MOVE_MC_POSITION = 9, + // "AxisFlags,%lf{x},%lf{y},%lf{z},%lf{r},%lf{speed},%1d{bWait}" N/A + HSI_EVENT_CONVERT_MC_TO_GLOBAL = 10, + // "%lf{x},%lf{y},%lf{z}" "%lf{x},%lf{y},%lf{z}" + HSI_EVENT_UPDATE_STATUS_MESSAGE = 11, + // N/A N/A + HSI_EVENT_OPENFILE_DLG = 12, + // N/A "FileName" + HSI_EVENT_DISPLAY_YESNO_MESSAGE = 13, + // N/A N/A + HSI_EVENT_DISPLAY_OKCANCEL_MESSAGE = 14, + // N/A N/A + HSI_EVENT_DISPLAY_OK_MESSAGE = 15, + // N/A N/A - HSI_EVENT_LP_QUALITY = 63, // "%d" 0-100% - HSI_EVENT_TP_QUALITY = 64, // "%d" 0-100% - HSI_EVENT_VP_QUALITY = 65, // "%d" 0-100% + // V4.3 + Only + HSI_EVENT_DEBUG_LOG = 20, + // "%s" N/A + HSI_EVENT_MOVE_MC_POSITION_AND_SETTLE = 21, + // "AxisFlags,%lf{x},%lf{y},%lf{z},%lf{r},%lf{speed}" N/A + HSI_EVENT_CONVERT_GLOBAL_TO_MM = 22, + // "%lf{x},%lf{y},%lf{z}" "%lf{x},%lf{y},%lf{z}" + HSI_EVENT_CONVERT_ROT_TO_TABLE_POINT = 23, + // "%lf{x},%lf{y},%lf{z}" "%lf{x},%lf{y},%lf{z}" + HSI_EVENT_CONVERT_ROT_OUT_TABLE_POINT = 24, + // "%lf{x},%lf{y},%lf{z}" "%lf{x},%lf{y},%lf{z}" + HSI_EVENT_CONVERT_ROT_TO_TABLE_VECTOR = 25, + // "%lf{x},%lf{y},%lf{z}" "%lf{x},%lf{y},%lf{z}" + HSI_EVENT_CONVERT_ROT_OUT_TABLE_VECTOR = 26, + // "%lf{x},%lf{y},%lf{z}" "%lf{x},%lf{y},%lf{z}" + HSI_EVENT_ILLUMINATION_REFRESH = 27, + HSI_EVENT_ILLUMINATION_LOCK = 28, + HSI_EVENT_ILLUMINATION_STORE_SET = 29, + HSI_EVENT_ILLUMINATION_RESTORE_SET = 30, + HSI_EVENT_ILLUMINATION_DECREASE_ACTIVE = 31, + // "%d" + HSI_EVENT_ILLUMINATION_INCREASE_ACTIVE = 32, + // "%d" + HSI_EVENT_ILLUMINATION_DECREASE_ALL = 33, + // "%d" + HSI_EVENT_ILLUMINATION_INCREASE_ALL = 34, + // "%d" + HSI_EVENT_ILLUMINATION_SELECT_LAMP = 35, + // "%d" + HSI_EVENT_ILLUMINATION_SET_LAMP_INTENSITY = 36, + // "%d" + HSI_EVENT_ILLUMINATION_GET_LAMP_INTENSITY = 37, + // "%d" + HSI_EVENT_ILLUMINATION_SET_LAMP_CALIBRATION_OVERRIDE = 38, + // "%d" + HSI_EVENT_ILLUMINATION_NEXT_RING = 39, + HSI_EVENT_ILLUMINATION_PREV_RING = 40, + HSI_EVENT_ILLUMINATION_NEXT_SECTOR = 41, + HSI_EVENT_ILLUMINATION_PREV_SECTOR = 42, + HSI_EVENT_ILLUMINATION_NUM_LAMPS_INSTALLED = 43, + HSI_EVENT_ILLUMINATION_IS_LAMP_INSTALLED = 44, + HSI_EVENT_ILLUMINATION_APPLY = 45, + HSI_EVENT_ILLUMINATION_ALLOFF = 46, + HSI_EVENT_ILLUMINATION_ALLON = 47, + HSI_EVENT_ILLUMINATION_UNLOCK = 48, + HSI_EVENT_IS_PROGRAMMING_MODE = 49, + // 1/0 + HSI_EVENT_IS_PORTLOCK_DCC = 50, + // 1/0 + HSI_EVENT_IS_ROTAB_ENABLED = 51, + // 1/0 + HSI_EVENT_IS_TIME_CRITICAL = 52, + // 1/0 + HSI_EVENT_CONVERT_MM_TO_GLOBAL = 53, + HSI_EVENT_CONVERT_GLOBAL_TO_MC = 54, + HSI_EVENT_LASER_FOCUS_ENABLE = 55, + // "%d" 0 = not available, 1 = available + HSI_EVENT_MOVE_POINT = 56, + // N/A N/A + HSI_EVENT_MAG_CHANGED = 57, + HSI_EVENT_ILLUMINATION_SET_LAMP_INTENSITY_IN_MACHINE_LEVELx100 = 58, + // "%d" //PR251359-- Instructed to "Please focus on slide" but it's rather unhelpfully turned the lights off for us. + HSI_EVENT_DCC_SCAN_POINTS_AVAILABLE = 59, + // "%d" = more to come, 1 = last set N/A + HSI_EVENT_ILLUMINATION_IS_ALL_OFF = 60, + // 1/0 //PR253777-- Sensilight does not work if the target has 'ALL OFF' for illum setting--4/16/2008 + HSI_EVENT_ILLUMINATION_DECREASE_ALL_NONZERO = 61, + // Sensilight command that wont change a lamp currently set to zero + HSI_EVENT_ILLUMINATION_INCREASE_ALL_NONZERO = 62, + // Sensilight command that wont change a lamp currently set to zero22 - HSI_EVENT_FLYMODE_MOVE_COMPLETE = 66, // A queued flymode move has completed - HSI_EVENT_PENDANT_SPEED_PERCENT = 67, // 108336 HMV : Add calls to HSI.H for Speed - HSI_EVENT_PENDANT_AXES_SELECTED = 68, // 108335 HMV : Need to add calls to the HSI.H for Stacked Rotary - - HSI_EVENT_MOTION = 500, - HSI_EVENT_MOTION_DCC_HOME = 501, - HSI_EVENT_MOTION_FOCUS_HOME = 502, - HSI_EVENT_MOTION_EMERGENT_STOP = 503, - HSI_EVENT_SHUTDOWN_ = 999, // N/A N/A - HSI_EVENT_MOTION_DRIVER_ALARM = 1000, - HSI_EVENT_MOTION_PROBE = 1001, + HSI_EVENT_LP_QUALITY = 63, + // "%d" 0-100% + HSI_EVENT_TP_QUALITY = 64, + // "%d" 0-100% + HSI_EVENT_VP_QUALITY = 65, + // "%d" 0-100% + + HSI_EVENT_FLYMODE_MOVE_COMPLETE = 66, + // A queued flymode move has completed + HSI_EVENT_PENDANT_SPEED_PERCENT = 67, + // 108336 HMV : Add calls to HSI.H for Speed + HSI_EVENT_PENDANT_AXES_SELECTED = 68, + // 108335 HMV : Need to add calls to the HSI.H for Stacked Rotary + + HSI_EVENT_MOTION = 500, + HSI_EVENT_MOTION_DCC_HOME = 501, + HSI_EVENT_MOTION_FOCUS_HOME = 502, + HSI_EVENT_MOTION_EMERGENT_STOP = 503, + HSI_EVENT_SHUTDOWN_ = 999, + // N/A N/A + HSI_EVENT_MOTION_DRIVER_ALARM = 1000, + HSI_EVENT_MOTION_PROBE = 1001, HSI_EVENT_MOTION_DISPENSER = 1002 }; + enum HSI_NOTIFY_TYPE { - HSI_NOTIFY_PROGRAM_EXECUTION_START = 0, - HSI_NOTIFY_PROGRAM_EXECUTION_STOP = 1, + HSI_NOTIFY_PROGRAM_EXECUTION_START = 0, + HSI_NOTIFY_PROGRAM_EXECUTION_STOP = 1, - HSI_NOTIFY_TIME_CRITICAL_EVENT_START = 2, - HSI_NOTIFY_TIME_CRITICAL_EVENT_STOP = 3, - HSI_NOTIFY_PROGRAM_OPEN = 4, - HSI_NOTIFY_PROGRAM_CLOSE = 5, - HSI_NOTIFY_PCDMIS_SHUTDOWN = 6, - HSI_NOTIFY_CLEAR_ITERATIONS = 7, + HSI_NOTIFY_TIME_CRITICAL_EVENT_START = 2, + HSI_NOTIFY_TIME_CRITICAL_EVENT_STOP = 3, + HSI_NOTIFY_PROGRAM_OPEN = 4, + HSI_NOTIFY_PROGRAM_CLOSE = 5, + HSI_NOTIFY_PCDMIS_SHUTDOWN = 6, + HSI_NOTIFY_CLEAR_ITERATIONS = 7, HSI_NOTIFY_EMERGENCY_STATE = 9 }; + enum HSI_EVENT_RESPONSE_TYPE { - HSI_EVENT_CALLBACK = 0, - HSI_EVENT_RESPONSE_OK = 1, - HSI_EVENT_RESPONSE_RETRY = 2, - HSI_EVENT_RESPONSE_CANCEL = 3, - HSI_EVENT_RESPONSE_YES = 4, - HSI_EVENT_RESPONSE_NO = 5, - HSI_EVENT_FUNCTION_OK = 6, - HSI_EVENT_FUNCTION_FAILED = 7 + HSI_EVENT_CALLBACK = 0, + HSI_EVENT_RESPONSE_OK = 1, + HSI_EVENT_RESPONSE_RETRY = 2, + HSI_EVENT_RESPONSE_CANCEL = 3, + HSI_EVENT_RESPONSE_YES = 4, + HSI_EVENT_RESPONSE_NO = 5, + HSI_EVENT_FUNCTION_OK = 6, + HSI_EVENT_FUNCTION_FAILED = 7 }; const int HSI_THREAD_EXIT = -1; @@ -211,32 +265,34 @@ const int HSI_THREAD_PAUSED = 1; struct sHSIEventProperties { - UINT EventID; - UINT EventCallbackID; - HSI_EVENT_TYPE EventType; - HSI_EVENT_RESPONSE_TYPE EventResponse; - char EventData[HSI_MaxStringLength + 1]; - void Init() - { - EventID = 0; - EventCallbackID = 0; - EventType = HSI_EVENT_NONE; - EventResponse = HSI_EVENT_CALLBACK; - memset(EventData, 0, (HSI_MaxStringLength + 1)*sizeof(char)); - }; - sHSIEventProperties() - { - Init(); - } + UINT EventID; + UINT EventCallbackID; + HSI_EVENT_TYPE EventType; + HSI_EVENT_RESPONSE_TYPE EventResponse; + char EventData[HSI_MaxStringLength + 1]; + + void Init() + { + EventID = 0; + EventCallbackID = 0; + EventType = HSI_EVENT_NONE; + EventResponse = HSI_EVENT_CALLBACK; + memset(EventData, 0, (HSI_MaxStringLength + 1) * sizeof(char)); + }; + + sHSIEventProperties() + { + Init(); + } }; - // >>>> In Interfaces -typedef VOID(WINAPI *pEventCallback)(HSI_EVENT_TYPE EventType, HSI_EVENT_RESPONSE_TYPE ResponseType, UINT EventID, char EventData[HSI_MaxStringLength + 1], UINT &EventCallbackID); +using pEventCallback = VOID(WINAPI *)(HSI_EVENT_TYPE EventType, HSI_EVENT_RESPONSE_TYPE ResponseType, UINT EventID, + char EventData[HSI_MaxStringLength + 1], UINT& EventCallbackID); HSI_API HSI_STATUS WINAPI HSI_STARTUP(HWND _hWnd, bool _bOfflineOnly); -HSI_API HSI_STATUS WINAPI HSI_GET_INTERFACE_VERSION(UINT &APIVersionMajor, UINT &APIVersionMinor); -HSI_API HSI_STATUS WINAPI HSI_GET_MACHINE_INFO(int &_NumMachineTypes); +HSI_API HSI_STATUS WINAPI HSI_GET_INTERFACE_VERSION(UINT& APIVersionMajor, UINT& APIVersionMinor); +HSI_API HSI_STATUS WINAPI HSI_GET_MACHINE_INFO(int& _NumMachineTypes); HSI_API HSI_STATUS WINAPI HSI_SET_EVENT_CALLBACK(pEventCallback _pCallback); HSI_API HSI_STATUS WINAPI HSI_SHUTDOWM(); @@ -249,120 +305,145 @@ HSI_API HSI_STATUS WINAPI HSI_SHUTDOWM(); enum HSI_MOTION_TYPE { - HSI_MOTION_SUPPORTS_DCC_CONTROL = 0x0001, - HSI_MOTION_SUPPORTS_MANUAL_CONTROL = 0x0002, - HSI_MOTION_SUPPORTS_HOMING = 0x0004, - HSI_MOTION_SUPPORTS_CIRCULAR_MOVES = 0x0008, - HSI_MOTION_SUPPORTS_CMM_WRIST = 0x0010, - HSI_MOTION_SUPPORTS_BUFFERED_MOVES = 0x0020, - HSI_MOTION_SUPPORTS_FLY_MOVES = 0x0040, - HSI_MOTION_SUPPORTS_SCAN = 0x0080, - HSI_MOTION_SUPPORTS_ALL_AXIS_MOVE = 0x0100, - HSI_MOTION_SUPPORTS_MEASPOINT_VW = 0x0200 + HSI_MOTION_SUPPORTS_DCC_CONTROL = 0x0001, + HSI_MOTION_SUPPORTS_MANUAL_CONTROL = 0x0002, + HSI_MOTION_SUPPORTS_HOMING = 0x0004, + HSI_MOTION_SUPPORTS_CIRCULAR_MOVES = 0x0008, + HSI_MOTION_SUPPORTS_CMM_WRIST = 0x0010, + HSI_MOTION_SUPPORTS_BUFFERED_MOVES = 0x0020, + HSI_MOTION_SUPPORTS_FLY_MOVES = 0x0040, + HSI_MOTION_SUPPORTS_SCAN = 0x0080, + HSI_MOTION_SUPPORTS_ALL_AXIS_MOVE = 0x0100, + HSI_MOTION_SUPPORTS_MEASPOINT_VW = 0x0200 }; enum HSI_MOTION_AXIS_TYPE { - HSI_MOTION_AXIS_X = 0x0001, // This is the default "Sensor level" X Axis - use on single X axis machines - HSI_MOTION_AXIS_Y = 0x0002, // This is the default "Sensor level" Y Axis - use on single Y axis machines - HSI_MOTION_AXIS_Z = 0x0004, // This is the default "Sensor level" Z Axis - use on single Z axis machines - HSI_MOTION_AXIS_R = 0x0008, // This is the default "Sensor level" R Axis - use on single R axis machines - HSI_MOTION_AXIS_X1 = 0x0010, // This is the 1st X Axis - use on multiple axis machines when specific axis needed - HSI_MOTION_AXIS_Y1 = 0x0020, // This is the 1st Y Axis - use on multiple axis machines when specific axis needed - HSI_MOTION_AXIS_Z1 = 0x0040, // This is the 1st Z Axis - use on multiple axis machines when specific axis needed - HSI_MOTION_AXIS_R1 = 0x0080, // This is the 1st R Axis - use on multiple axis machines when specific axis needed - HSI_MOTION_AXIS_X2 = 0x0100, // This is the 2nd X Axis - use on multiple axis machines when specific axis needed - HSI_MOTION_AXIS_Y2 = 0x0200, // This is the 2nd Y Axis - use on multiple axis machines when specific axis needed - HSI_MOTION_AXIS_Z2 = 0x0400, // This is the 2nd Z Axis - use on multiple axis machines when specific axis needed - HSI_MOTION_AXIS_R2 = 0x0800, // This is the 2nd R Axis - use on multiple axis machines when specific axis needed - HSI_MOTION_AXIS_X3 = 0x1000, // This is the 3rd X Axis - use on multiple axis machines when specific axis needed - HSI_MOTION_AXIS_Y3 = 0x2000, // This is the 3rd Y Axis - use on multiple axis machines when specific axis needed - HSI_MOTION_AXIS_Z3 = 0x4000, // This is the 3rd Z Axis - use on multiple axis machines when specific axis needed - HSI_MOTION_AXIS_R3 = 0x8000 // This is the 3rd R Axis - use on multiple axis machines when specific axis needed + HSI_MOTION_AXIS_X = 0x0001, + // This is the default "Sensor level" X Axis - use on single X axis machines + HSI_MOTION_AXIS_Y = 0x0002, + // This is the default "Sensor level" Y Axis - use on single Y axis machines + HSI_MOTION_AXIS_Z = 0x0004, + // This is the default "Sensor level" Z Axis - use on single Z axis machines + HSI_MOTION_AXIS_R = 0x0008, + // This is the default "Sensor level" R Axis - use on single R axis machines + HSI_MOTION_AXIS_X1 = 0x0010, + // This is the 1st X Axis - use on multiple axis machines when specific axis needed + HSI_MOTION_AXIS_Y1 = 0x0020, + // This is the 1st Y Axis - use on multiple axis machines when specific axis needed + HSI_MOTION_AXIS_Z1 = 0x0040, + // This is the 1st Z Axis - use on multiple axis machines when specific axis needed + HSI_MOTION_AXIS_R1 = 0x0080, + // This is the 1st R Axis - use on multiple axis machines when specific axis needed + HSI_MOTION_AXIS_X2 = 0x0100, + // This is the 2nd X Axis - use on multiple axis machines when specific axis needed + HSI_MOTION_AXIS_Y2 = 0x0200, + // This is the 2nd Y Axis - use on multiple axis machines when specific axis needed + HSI_MOTION_AXIS_Z2 = 0x0400, + // This is the 2nd Z Axis - use on multiple axis machines when specific axis needed + HSI_MOTION_AXIS_R2 = 0x0800, + // This is the 2nd R Axis - use on multiple axis machines when specific axis needed + HSI_MOTION_AXIS_X3 = 0x1000, + // This is the 3rd X Axis - use on multiple axis machines when specific axis needed + HSI_MOTION_AXIS_Y3 = 0x2000, + // This is the 3rd Y Axis - use on multiple axis machines when specific axis needed + HSI_MOTION_AXIS_Z3 = 0x4000, + // This is the 3rd Z Axis - use on multiple axis machines when specific axis needed + HSI_MOTION_AXIS_R3 = 0x8000 // This is the 3rd R Axis - use on multiple axis machines when specific axis needed }; + enum HSI_MOTION_IO_TYPE { - HSI_MOTION_INPUT = 0x0001, - HSI_MOTION_INPUT_LIMIT_SWITCH, - HSI_MOTION_INPUT_CH1,//̸ߡΪˡEF1 - HSI_MOTION_INPUT_CH2, - HSI_MOTION_INPUT_CH3,//ڿ - HSI_MOTION_INPUT_CH4,//Ϊ˶ƿ - HSI_MOTION_INPUT_ALARM,// + HSI_MOTION_INPUT = 0x0001, + HSI_MOTION_INPUT_LIMIT_SWITCH, + HSI_MOTION_INPUT_CH1, + //̸ߡΪˡEF1 + HSI_MOTION_INPUT_CH2, + HSI_MOTION_INPUT_CH3, + //ڿ + HSI_MOTION_INPUT_CH4, + //Ϊ˶ƿ + HSI_MOTION_INPUT_ALARM, + // - HSI_MOTION_OUTPUT = 0x0100, - HSI_MOTION_OUTPUT_LASER_PEN, - HSI_MOTION_OUTPUT_CH1,//̸ߡΪˡEF1 - HSI_MOTION_OUTPUT_CH2, - HSI_MOTION_OUTPUT_CH3,//ڿ - HSI_MOTION_OUTPUT_CH4//Ϊ˶ƿ + HSI_MOTION_OUTPUT = 0x0100, + HSI_MOTION_OUTPUT_LASER_PEN, + HSI_MOTION_OUTPUT_CH1, + //̸ߡΪˡEF1 + HSI_MOTION_OUTPUT_CH2, + HSI_MOTION_OUTPUT_CH3, + //ڿ + HSI_MOTION_OUTPUT_CH4 //Ϊ˶ƿ }; const UINT HSI_MOTION_AXIS_ALL = HSI_MOTION_AXIS_X | HSI_MOTION_AXIS_Y | HSI_MOTION_AXIS_Z; enum HSI_MOTION_MOVE_TYPE { - HSI_MOTION_MOVE_WAIT = 1, - HSI_MOTION_MOVE_NOWAIT = 2, - HSI_MOTION_MOVE_INTERMEDIATE_POSITION = 3, - HSI_MOTION_MOVE_FINAL_POSITION = 4, - HSI_MOTION_IN_POSITION_EVENT = 5, - HSI_MOTION_MOVE_FLYMODE = 6, - HSI_MOTION_MOVE_START_POSITION = 7, - HSI_MOTION_MOVE_START_FINAL_POSITION = 8 + HSI_MOTION_MOVE_WAIT = 1, + HSI_MOTION_MOVE_NOWAIT = 2, + HSI_MOTION_MOVE_INTERMEDIATE_POSITION = 3, + HSI_MOTION_MOVE_FINAL_POSITION = 4, + HSI_MOTION_IN_POSITION_EVENT = 5, + HSI_MOTION_MOVE_FLYMODE = 6, + HSI_MOTION_MOVE_START_POSITION = 7, + HSI_MOTION_MOVE_START_FINAL_POSITION = 8 }; enum HSI_MOTION_AXIS_R_MOVE_TYPE { - HSI_MOTION_AXIS_R_CLOCKWISE = 1, - HSI_MOTION_AXIS_R_ANTICLOCKWISE = 2, - HSI_MOTION_AXIS_R_FASTEST = 3 + HSI_MOTION_AXIS_R_CLOCKWISE = 1, + HSI_MOTION_AXIS_R_ANTICLOCKWISE = 2, + HSI_MOTION_AXIS_R_FASTEST = 3 }; + enum HSI_SCAN_MOTION_TYPE { - HSI_SCAN_MOTION_LINEAR = 1, - HSI_SCAN_MOTION_CIRCULAR, + HSI_SCAN_MOTION_LINEAR = 1, + HSI_SCAN_MOTION_CIRCULAR, - HSI_SCAN_MOTION_SPEC_LOCA = 100,//EF1 - HSI_SCAN_MOTION_EQ_DIS, - HSI_SCAN_MOTION_EQ_DIS_II, - HSI_SCAN_MOTION_LINEAR_TEST,//ʹ - HSI_SCAN_MOTION_EQ_TEST,//ʹ - HSI_SCAN_MOTION_MANUAL_TEST//ʹ + HSI_SCAN_MOTION_SPEC_LOCA = 100, + //EF1 + HSI_SCAN_MOTION_EQ_DIS, + HSI_SCAN_MOTION_EQ_DIS_II, + HSI_SCAN_MOTION_LINEAR_TEST, + //ʹ + HSI_SCAN_MOTION_EQ_TEST, + //ʹ + HSI_SCAN_MOTION_MANUAL_TEST //ʹ }; enum HSI_ZOOM_TYPE { - HSI_ZOOM_MANUAL = 0, - HSI_ZOOM_NAVITAR=3 + HSI_ZOOM_MANUAL = 0, + HSI_ZOOM_NAVITAR=3 }; -typedef struct +using Point = struct { - double x; - double y; - double z; -}Point; + double x; + double y; + double z; +}; const int HSI_MAX_POSITIONS_STORED = 500; // >>>> In Interfaces // һ׶ҪдAPI HSI_API HSI_STATUS WINAPI HSI_MOTION_STARTUP(bool bHome); -HSI_API HSI_STATUS WINAPI HSI_MOTION_GET_FIREWAREVERION(byte *verion); +HSI_API HSI_STATUS WINAPI HSI_MOTION_GET_FIREWAREVERION(byte* verion); HSI_API HSI_STATUS WINAPI HSI_MOTION_SHUTDOWN(); -HSI_API HSI_STATUS WINAPI HSI_EF3MOTION_GET_SPEED_XYZ(int axis, double &Speed); -HSI_API HSI_STATUS WINAPI HSI_MOTION_SET_SPEED_EX(UINT AxisTypes, double Speed); +HSI_API HSI_STATUS WINAPI HSI_EF3MOTION_GET_SPEED_XYZ(int axis, double& Speed); +HSI_API HSI_STATUS WINAPI HSI_MOTION_SET_SPEED_EX(UINT AxisTypes, double Speed); HSI_API HSI_STATUS WINAPI HSI_MOTION_JOG(UINT AxisTypes, double Speed); HSI_API HSI_STATUS WINAPI HSI_MOTION_STOP_JOG(); -HSI_API HSI_STATUS WINAPI HSI_MOTION_GET_POSITION_XYZ(UINT AxisTypes, double &PositionX, double &PositionY, double &PositionZ, double &Time); -HSI_API HSI_STATUS WINAPI HSI_MOTION_SET_POSITION_XYZ(UINT AxisTypes, double PositionX, double PositionY, double PositionZ, HSI_MOTION_MOVE_TYPE eType, double dSpeedGear); +HSI_API HSI_STATUS WINAPI HSI_MOTION_GET_POSITION_XYZ(UINT AxisTypes, double& PositionX, double& PositionY, + double& PositionZ, double& Time); +HSI_API HSI_STATUS WINAPI HSI_MOTION_SET_POSITION_XYZ(UINT AxisTypes, double PositionX, double PositionY, + double PositionZ, HSI_MOTION_MOVE_TYPE eType, double dSpeedGear); HSI_API HSI_STATUS WINAPI HSI_MOTION_ABORT_MOTION(); -HSI_API HSI_STATUS WINAPI HSI_MOTION_IS_HOMED(bool &bHomed); - - - +HSI_API HSI_STATUS WINAPI HSI_MOTION_IS_HOMED(bool& bHomed); //HSI_API HSI_STATUS WINAPI HSI_MOTION_IS_SUPPORTED(UINT &Types); @@ -391,7 +472,6 @@ HSI_API HSI_STATUS WINAPI HSI_MOTION_IS_HOMED(bool &bHomed); //HSI_API HSI_STATUS WINAPI HSI_MOTION_DCC_SCAN_STOP(); - //HSI_API HSI_STATUS WINAPI HSI_MOTION_IS_SUPPORTED_EX(UINT AxisTypes, UINT &Types); //HSI_API HSI_STATUS WINAPI HSI_MOTION_STARTUP_EX(UINT AxisTypes, bool bHome); //HSI_API HSI_STATUS WINAPI HSI_MOTION_GET_SCALE_RESOLUTION_EX(UINT AxisTypes, double &Scale); @@ -420,7 +500,6 @@ HSI_API HSI_STATUS WINAPI HSI_MOTION_IS_HOMED(bool &bHomed); #ifdef USE_Illumination_API - /////////////////////////////////////////////////////////////////////////////// // Illumination API /////////////////////////////////////////////////////////////////////////////// @@ -505,19 +584,34 @@ HSI_API HSI_STATUS WINAPI HSI_ILLUMINATION_SHUTDOWN(); #endif // !USE_Illumination_API - class HSI { public: - HSI() : hWnd(nullptr), bOfflineOnly(false){} - virtual ~HSI(){} - virtual HSI_STATUS IsSupported(UINT &Types){ Types = 0; return HSI_STATUS_NORMAL; } - virtual HSI_STATUS Startup(HWND _hWnd, bool _bOfflineOnly){ hWnd = _hWnd; bOfflineOnly = _bOfflineOnly; return HSI_STATUS_NORMAL; } - virtual HSI_STATUS Shutdown(){ return HSI_STATUS_NORMAL; } -protected: - HWND hWnd; - bool bOfflineOnly; - sHSIEventProperties sEvenProp; + HSI() : hWnd(nullptr), bOfflineOnly(false) + { + } + virtual ~HSI() + { + } + + virtual HSI_STATUS IsSupported(UINT& Types) + { + Types = 0; + return HSI_STATUS_NORMAL; + } + + virtual HSI_STATUS Startup(HWND _hWnd, bool _bOfflineOnly) + { + hWnd = _hWnd; + bOfflineOnly = _bOfflineOnly; + return HSI_STATUS_NORMAL; + } + + virtual HSI_STATUS Shutdown() { return HSI_STATUS_NORMAL; } +protected: + HWND hWnd; + bool bOfflineOnly; + sHSIEventProperties sEvenProp; }; -#endif \ No newline at end of file +#endif diff --git a/HSI_HexagonMI_EF3/HSI_HexagonMI_EF3.vcxproj b/HSI_HexagonMI_EF3/HSI_HexagonMI_EF3.vcxproj index b72e4c8..eb90254 100644 --- a/HSI_HexagonMI_EF3/HSI_HexagonMI_EF3.vcxproj +++ b/HSI_HexagonMI_EF3/HSI_HexagonMI_EF3.vcxproj @@ -76,6 +76,7 @@ true \DirectXLib\Include;$(IncludePath) $(MSBuildProjectDirectory)\$(Platform)\$(Configuration)\ + $(MSBuildProjectDirectory)\obj true @@ -171,6 +172,7 @@ xcopy "$(OutDir)\$(ProjectName).pdb" ..\HSI_GOOGOL_GTS800_WPFTest\bin\Debug\HSI. + @@ -196,6 +198,9 @@ xcopy "$(OutDir)\$(ProjectName).pdb" ..\HSI_GOOGOL_GTS800_WPFTest\bin\Debug\HSI. Create + + + diff --git a/HSI_HexagonMI_EF3/HSI_HexagonMI_EF3.vcxproj.filters b/HSI_HexagonMI_EF3/HSI_HexagonMI_EF3.vcxproj.filters index 5ad887a..059d84c 100644 --- a/HSI_HexagonMI_EF3/HSI_HexagonMI_EF3.vcxproj.filters +++ b/HSI_HexagonMI_EF3/HSI_HexagonMI_EF3.vcxproj.filters @@ -20,5 +20,9 @@ + + + + \ No newline at end of file diff --git a/HSI_HexagonMI_EF3/HSI_Motion.cpp b/HSI_HexagonMI_EF3/HSI_Motion.cpp index 283652b..6456909 100644 --- a/HSI_HexagonMI_EF3/HSI_Motion.cpp +++ b/HSI_HexagonMI_EF3/HSI_Motion.cpp @@ -4,20 +4,25 @@ #include "HSI_Sevenocean_EF3.h" #include "HSI_Motion.h" #include "logger.h" -#include "SevenOcean\CMMIO_SERIAL.h" +#include "SevenOcean/CMMIO_SERIAL.h" #include "version.h" #include #include #include +#include +#include +#include "windows.h" +#include "ACS/ACSC.h" //ACS˶ƿͷļ using namespace std; #ifdef _DEBUG #define new DEBUG_NEW #endif //=========================================================================== -HSI_Motion *g_pHSI_Motion = nullptr; -CLogger extern *g_pLogger = nullptr; -HANDLE hCom;//ھ +HSI_Motion* g_pHSI_Motion = nullptr; +CLogger extern* g_pLogger = nullptr; +HANDLE hCom; //ھ +HANDLE handleACS; // ˶ƾ const int WSA_MAJOR_VERSION = 2; const int WSA_MINOR_VERSION = 2; @@ -25,38 +30,40 @@ const int WSA_MINOR_VERSION = 2; #define SOCKADDR_LEN sizeof(SOCKADDR_IN) //=========================================================================== -HANDLE HSI_Motion::m_Thread_Id = NULL; -HANDLE HSI_Motion::m_Thread_Mutex = NULL; -HANDLE HSI_Motion::g_RW_Data_Mutex = NULL; -HANDLE HSI_Motion::g_WR_ToMove_Mutex = NULL; -HANDLE HSI_Motion::g_Lock_JogAndTrigger = NULL; +HANDLE HSI_Motion::m_Thread_Id = nullptr; +HANDLE HSI_Motion::m_Thread_Mutex = nullptr; +HANDLE HSI_Motion::g_RW_Data_Mutex = nullptr; +HANDLE HSI_Motion::g_WR_ToMove_Mutex = nullptr; +HANDLE HSI_Motion::g_Lock_JogAndTrigger = nullptr; HANDLE HSI_Motion::m_hTriggerEvent; -HANDLE HSI_Motion::m_Thread_IdIO = NULL; -HANDLE HSI_Motion::m_Thread_MutexIO = NULL; +HANDLE HSI_Motion::m_Thread_IdIO = nullptr; +HANDLE HSI_Motion::m_Thread_MutexIO = nullptr; HANDLE HSI_Motion::m_hTriggerEventIO; -HANDLE HSI_Motion::m_Thread_IdData = NULL; -HANDLE HSI_Motion::m_Thread_MutexData = NULL; +HANDLE HSI_Motion::m_Thread_IdData = nullptr; +HANDLE HSI_Motion::m_Thread_MutexData = nullptr; HANDLE HSI_Motion::m_hTriggerEventData; -HANDLE HSI_Motion::m_Thread_IdProbe = NULL; -HANDLE HSI_Motion::m_Thread_MutexProbe = NULL; +HANDLE HSI_Motion::m_Thread_IdProbe = nullptr; +HANDLE HSI_Motion::m_Thread_MutexProbe = nullptr; HANDLE HSI_Motion::m_hTriggerEventProbe; -HANDLE HSI_Motion::m_Thread_IdJOGStop = NULL; -HANDLE HSI_Motion::m_Thread_MutexJOGStop = NULL; +HANDLE HSI_Motion::m_Thread_IdJOGStop = nullptr; +HANDLE HSI_Motion::m_Thread_MutexJOGStop = nullptr; HANDLE HSI_Motion::m_hTriggerEventJOGStop; -int HSI_Motion::m_Thread_StateJOGStop = THREAD_PAUSED; +int HSI_Motion::m_Thread_StateJOGStop = THREAD_PAUSED; -int HSI_Motion::m_Thread_State = THREAD_PAUSED; -int HSI_Motion::m_Thread_StateIO = THREAD_PAUSED; -int HSI_Motion::m_Thread_StateData = THREAD_PAUSED; -int HSI_Motion::m_Thread_StateProbe = THREAD_PAUSED; -int HSI_Motion::bRunGlueDispenser = THREAD_PAUSED; +int HSI_Motion::m_Thread_State = THREAD_PAUSED; +int HSI_Motion::m_Thread_StateIO = THREAD_PAUSED; +int HSI_Motion::m_Thread_StateData = THREAD_PAUSED; +int HSI_Motion::m_Thread_StateProbe = THREAD_PAUSED; +int HSI_Motion::bRunGlueDispenser = THREAD_PAUSED; //=========================================================================== -HANDLE HSI_Motion::m_ThreadTCP_Id = NULL; -int HSI_Motion::m_ThreadTCP_State = TCPIP_THREAD_PAUSED; -SOCKET m_socket[4] = { 0 }; +HANDLE HSI_Motion::m_ThreadTCP_Id = nullptr; +int HSI_Motion::m_ThreadTCP_State = TCPIP_THREAD_PAUSED; +SOCKET m_socket[4] = {0}; //=========================================================================== +//˶๹캯漰 ˶Ʋ岹ؼҡҡˡ־Ϣļ + HSI_Motion::HSI_Motion() { TRACE0("HSI_Motion Constructor!\n"); @@ -65,146 +72,147 @@ HSI_Motion::HSI_Motion() sEvenProp.EventResponse = HSI_EVENT_FUNCTION_OK; CurrentMotionState = E_SO7_MOTION_NONE; CurrentReadDataType = E_DATA_TYPE_NONE; + GluerunCount = 0; - m_IsExMotion = 2; - g_IsClose = false; + m_IsExMotion = 2; //0xyzõģ1ǵõģ2 + g_IsClose = false; //DoEvents()˳쳣 setLightFlag = false; - m_bISUseMoreLights = 0; - m_Jog_Auto_Focus = 1; - m_StartInputPort = 1; + m_bISUseMoreLights = 0; //ƹ + m_Jog_Auto_Focus = 1; //佹ʹõٶ + m_StartInputPort = 1; //ⲿ밴ť iaxisNum = 0; iScanMotionType = 0; iTriggleNum = 0; iMotionDirection = 1; m_InputStatus = 0; m_ForStatus = 0; - m_setPositionDelay = 0; - m_setPositionPrecision = 0; - m_IsUse_HSICompensation = 0; - m_Compensation_Pluse = 20; - m_IsHardLimit = 7; - m_IsEnableAxis = 7; - m_IsHavePattern = 15; - m_IsUseExternalTrigger = 1; - m_IsUseSixRingEightArea = 0; - m_IsUseTwentySixLight = 0; - m_IsUseEF3 = 0; - m_IsUseRocker = 0; + m_setPositionDelay = 0; //öλʱ + m_setPositionPrecision = 0; //öλ + m_IsUse_HSICompensation = 0; //ǷHSIжλ 0Ϊ 1Ϊ ĬΪ0 + m_Compensation_Pluse = 20; // + m_IsHardLimit = 7; //豸Ӳλ Ϊ0ʾᶼΪλ 1ΪXΪӲλ 2ΪY 3ΪXY 4ΪZ 7ΪXYZ ĬΪ7 + m_IsEnableAxis = 7; //豸 Ϊ0ʾ᲻ 1ΪX 2ΪY 3ΪXY 4ΪZ 7ΪXYZ ĬΪ7 + m_IsHavePattern = 15; //Ƿйդ + m_IsUseExternalTrigger = 1; //Ƿⴥ 0Ϊ 1Ϊ ĬΪ1 + m_IsUseSixRingEightArea = 0; //Ƿƹ 0Ϊ 1Ϊ 2Ϊ ĬΪ0 + m_IsUseTwentySixLight = 0; //Ƿ26·ƹ 0Ϊ 1λ ĬΪ0 + m_IsUseEF3 = 0; //ǷEF3 + m_IsUseRocker = 0; //Ƿҡ 0Ϊ 1Ϊþҡˣ2Ϊҡˣ ĬΪ0 m_IsCloseRocker = 0; - m_DeviceType = 0; - m_iJoyStick = 0; + m_DeviceType = 0; //豸ͣ0Ϊͨ豸1Ϊ, 2ΪҰ3Ϊת豸 ĬΪ0 + m_iJoyStick = 0; //ҡͣ0 1ʽҡ m_IsProbe = 0; - m_ProbeAllAxis = 3; - m_ProbeReturnPos = 10.0; - m_ProbeReturnSpeed = 40; - m_IsHomeEncPos = 0; - m_IsHomePrfPos = 1; - m_IsIOFuntion = 0; - m_IsStartInput = 0; + m_ProbeAllAxis = 3; //̽봥ʱţĬ3ʾXYZ3ᣬ4ʾXYZA4 + m_ProbeReturnPos = 10.0; //̽봥ʱʱصľmmťʱ,Ĭ10.0mm + m_ProbeReturnSpeed = 40; //̽봥Ļٶ + m_IsHomeEncPos = 0; //ǷʵλжǷؼңĬ01ã0ر + m_IsHomePrfPos = 1; //Ƿ滮λжǷؼңĬ11ã0ر + m_IsIOFuntion = 0; //ǷIOܣ1Ϊ򿪣0Ϊر + m_IsStartInput = 0; //Ƿý̤عܣ1Ϊã0ΪرգĬ0 m_IsUsePPS = false; - m_MSTRunFlag = false; - m_SendDataLength = 64; + m_MSTRunFlag = false; //MSTб־trueMSTѾfalseMSTֹͣ + m_SendDataLength = 16; // ڷݳ m_LightType = 1; m_IsUseFourthSpeed = 0; - m_ETIPort = 1; + m_ETIPort = 1; //ⲿ˿ں m_EF3LightType = 1; - m_IbinCount = 0; - m_IsUseJerk = 0; - t_start = 0; - t_end = 0; - m_isOKGlint = 0; + m_IbinCount = 0; //¼ȡķbin + m_IsUseJerk = 0; //Ƿüͣ 0Ϊ 1Ϊ + t_start = 0; //ȡjogеĿʼʱ + t_end = 0; //ȡjogеĽʱ + m_isOKGlint = 0; //Ƿok/ng ˸ m_selectedIndex = 0; m_setPositionNum = 5; - m_axisStatus = 0; - m_axisAlarmStatus = 0; - m_EF3COMPort = 2; - m_AxisHomeDirection = 15; - m_PositionA = 0.0; - m_ForSoft = 0; - m_SaveAxisNum = 0; - m_SaveAxisSpeed = 0; + m_axisStatus = 0; //˶״̬ + m_axisAlarmStatus = 0; //ᱨ״̬ + m_EF3COMPort = 2; //EF3comڣĬΪ2 + m_AxisHomeDirection = 15; //ؼʱķ + m_PositionA = 0.0; //ĵλλ + m_ForSoft = 0; //ʹ 0ΪMST 1ΪMetus + m_SaveAxisNum = 0; // + m_SaveAxisSpeed = 0; //ٶ bSaveSpeedFlag = false; - m_IsUseManualRunin = 0; + m_IsUseManualRunin = 0; //Ƿֶ岹ֻԲ fourthAxisFlag = false; - bCircleRun = false;//Բ岹 - m_UseAxisNum = 1; - jogAxisNum = 0; + bCircleRun = false; //Բ岹 + m_UseAxisNum = 1; //ת豸ʹ + jogAxisNum = 0; //jog˶ jogDirFlag = false; jogMoving = false; jogspeed = 0; - set_start = 0; - set_end = 0; + set_start = 0; //ȡλпʼʱ + set_end = 0; //ȡλнʱ m_iSpeedType = 0; - m_axisDirX = 0;//̽˶ʱX˶ - m_axisDirY = 0;//̽˶ʱY˶ - m_axisDirZ = 0;//̽˶ʱZ˶ + m_axisDirX = 0; //̽˶ʱX˶ + m_axisDirY = 0; //̽˶ʱY˶ + m_axisDirZ = 0; //̽˶ʱZ˶ m_probeSeekSpeed = 0; - bUseGlueDispenser = false; + bUseGlueDispenser = false; //Ƿ㽺 m_iGlueStartSpeed = 1; m_iGlueDriveSpeed = 1; m_iGlueAccSpeed = 1; - GlueDispenserindexNum = 0; + GlueDispenserindexNum = 0; //㽺 - m_isUseAport = 0;//A + m_isUseAport = 0; //A m_portAnum = 0; - m_isUseBport = 0;//B + m_isUseBport = 0; //B m_portBnum = 0; - m_bEmergencyState = false; + m_bEmergencyState = false; SpCompleteTStart = 0; SpCompleteTEnd = 0; SpTimeCount = 0; SetPotionRunEnd = false; PntToPntDistance = 0.0; - m_IsLightDebug = 0; + m_IsLightDebug = 0; //Ƿ񲻻ؼҲܵԵƹ 0Ϊ 1Ϊ ĬΪ0 for (int i = 0; i < 4; i++) { - m_IsOpenTCPIP[i] = ""; + m_IsOpenTCPIP[i] = ""; //ṩtcpͨŵip m_tcpCntFlag[i] = false; - m_Led8MotionFlag[i] = false; + m_Led8MotionFlag[i] = false; //ǷΪ8·Դ } for (int i = 0; i < 4; i++) { - m_rockerHStartSpeed[i] = 5; - m_rockerHDriveSpeed[i] = 20; - m_rockerLStartSpeed[i] = 2; - m_rockerLDriveSpeed[i] = 10; - m_rockerDSpeed[i] = 100; - m_rockerASpeed[i] = 100; - begin_position[i] = 0; + m_rockerHStartSpeed[i] = 5; //ҡXYZ߳ʼٶ + m_rockerHDriveSpeed[i] = 20; //ҡXYZٶ + m_rockerLStartSpeed[i] = 2; //ҡXYZͳʼٶ + m_rockerLDriveSpeed[i] = 10; //ҡXYZٶ + m_rockerDSpeed[i] = 100; //XYZӼ2 + m_rockerASpeed[i] = 100; //XYZӼ1 + begin_position[i] = 0; //ⴥʼҪ͵ } for (size_t i = 0; i < 8; i++) { - m_SixEightSubArea[i] = 0; + m_SixEightSubArea[i] = 0; // } CTime tm = CTime::GetCurrentTime(); - CString csTime = tm.Format("%Y-%m-%d");//ʾ - CString dir = L"\\Log\\" + csTime += L".SO7_EF3.Log"; + CString csTime = tm.Format("%Y-%m-%d_%H-%M-%S"); //ʱַ + CString dir = L"\\Log\\" + csTime += L"_EF3.Log"; g_pLogger = new CLogger(dir); g_pLogger2 = new CLogger(L"\\Log\\EF3_SumTime.Log"); for (int i = 0; i < 5; i++) { for (int j = 0; j < 5; j++) { - m_JogDriveSpeed[j][i] = 10; //ʾ5λ + m_JogDriveSpeed[j][i] = 10; //ʾ5λ ,1ʼ5λ m_JogStartSpeed[j][i] = 10; m_JogAccLine[j][i] = 5; m_JogAccCurve[j][i] = 0; m_JogDecLine[j][i] = 5; m_JogDecCurve[j][i] = 0; } - m_Home_Machine_Axis[i] = 1; - m_Home_Pos_Axis[i] = 0; + m_Home_Machine_Axis[i] = 1; //ʱҪԭѡ + m_Home_Pos_Axis[i] = 0; //סرյԴʱλãжǷҪԭ } - m_Home_Machine_Axis[4] = 0; + m_Home_Machine_Axis[4] = 0; //ʱҪԭѡ for (int i = 0; i < 5; i++) { - m_N_Work_Limit[i] = -40; - m_P_Work_Limit[i] = 160; - m_Resolution[i] = 0.0004; + m_N_Work_Limit[i] = -40; //λ + m_P_Work_Limit[i] = 160; //λ + m_Resolution[i] = 0.0004; //1ʼ,0 m_Home_AddJogGears[i] = 4; m_Home_DecJogGears[i] = 3; m_SetPotion_StartSpeed[i] = 20; @@ -219,25 +227,25 @@ HSI_Motion::HSI_Motion() m_precisionTime[i] = 350; m_Home_Time[i] = 1500; m_SetPotion_Count[i] = 200; - m_PosThread[i] = 0; - m_PosNow[i] = 0; - m_LogIsOpen[i] = 0; - m_StopJogMode[i] = 0; + m_PosThread[i] = 0; //SetpositionXyzĿλ + m_PosNow[i] = 0; //SetpositionXyzʱȡǰλ + m_LogIsOpen[i] = 0; //Ƿ򿪼¼0Ϊ򿪣0Ϊر + m_StopJogMode[i] = 0; //JOGģʽüͣƽֹͣ m_LockPos[i] = 0.0; m_EncPos[i] = 0; m_PrfPos[i] = 0; - m_PosForAllAxis[i] = 0.0; + m_PosForAllAxis[i] = 0.0; //¼4λ targetpos_n[i] = 0; targetpos_l[i] = 0; - m_ProbeCapturePos[i] = 0; - iCircleRunPnt[i] = 0; + m_ProbeCapturePos[i] = 0; //λ + iCircleRunPnt[i] = 0; //Բ岹ʱԲλ m_ijk[i] = 0; } GetAppPath(m_AppPath); m_LogIsOpen[0] = GetPrivateProfileInt(L"LOG", L"LOG_IS_OPEN_0", 0, m_AppPath + _T("\\Config\\EF3_Motion.ini")); g_pLogger->IsEnabledLog = m_LogIsOpen[0] == 1 ? true : false; - m_Set_XYZA_Reserve = 0; - m_motorType = 0; + m_Set_XYZA_Reserve = 0; //XYZA᷽ + m_motorType = 0; // 1Ϊŷ 0Ϊ m_AxisHex[0] = 0; m_direct_pos = 0; m_AxisHex[1] = AXIS_X; @@ -273,31 +281,32 @@ HSI_Motion::HSI_Motion() IOCheck[1] = 0x04; memset(tReciveData, 0x00, TCPIP_MAX_DAT_SIZE); - g_RW_Data_Mutex = CreateMutex(NULL, FALSE, NULL); - g_WR_ToMove_Mutex = CreateMutex(NULL, FALSE, NULL); - g_Lock_JogAndTrigger = CreateMutex(NULL, FALSE, NULL); - + g_RW_Data_Mutex = CreateMutex(nullptr, FALSE, nullptr); + g_WR_ToMove_Mutex = CreateMutex(nullptr, FALSE, nullptr); + g_Lock_JogAndTrigger = CreateMutex(nullptr, FALSE, nullptr); } + //=========================================================================== HSI_Motion::~HSI_Motion() { TRACE0("HSI_Motion Destructor!\n"); } + //=========================================================================== bool HSI_Motion::PortInit(int iSerialComPort, int iBuadRate) { - if (hCom == NULL) + if (hCom == nullptr) { - char buf[10]; + char buf[10]; sprintf_s(buf, "COM%d", iSerialComPort); CString comName(buf); hCom = CreateFile(comName, - GENERIC_READ | GENERIC_WRITE, //д - 0, //ռʽ,ڱΪ0 - NULL, - OPEN_EXISTING, //򿪶ǴڱΪ - 0, //ͬʽ,ִͬʱֱɺŷ - NULL);//ڱΪNULL + GENERIC_READ | GENERIC_WRITE, //д + 0, //ռʽ,ڱΪ0 + nullptr, + OPEN_EXISTING, //򿪶ǴڱΪ + 0, //ͬʽ,ִͬʱֱɺŷ + nullptr); //ڱΪNULL if (hCom != (HANDLE)-1) { PurgeComm(hCom, PURGE_TXCLEAR | PURGE_RXCLEAR); @@ -311,7 +320,7 @@ bool HSI_Motion::PortInit(int iSerialComPort, int iBuadRate) if (!SetCommState(hCom, &dcb)) { - return false;//Setting Error!!!! + return false; //Setting Error!!!! } //öдʱʱ @@ -325,13 +334,15 @@ bool HSI_Motion::PortInit(int iSerialComPort, int iBuadRate) } return true; } + //=========================================================================== -HSI_STATUS HSI_Motion::IsSupported(UINT &Types) +HSI_STATUS HSI_Motion::IsSupported(UINT& Types) { auto rStatus = HSI_STATUS_NORMAL; Types = 1; return rStatus; } + //=========================================================================== HSI_STATUS HSI_Motion::Startup(HWND _hWnd, bool _bOfflineOnly) { @@ -346,24 +357,26 @@ HSI_STATUS HSI_Motion::Startup(HWND _hWnd, bool _bOfflineOnly) { g_pHSI_Motion = new HSI_Motion(); } - if (CurrentHomeMachineState == E_EF3_HOME_ING) + if (CurrentHomeMachineState == E_EF3_HOME_ING) //ڻؼ { g_pLogger->SendAndFlushWithTime(L"[Startup] Going Home\n"); return HSI_STATUS_NORMAL; } g_pLogger->SendAndFlushWithTime(L"[Startup] In\n"); - g_pLogger->SendAndFlushWithTime(L"[Startup] EF3 HSI.dll version = %s, date = %s\n", HSI_VERSION_CSTRING, HSI_FILE_CSDESCRIPTION); + g_pLogger->SendAndFlushWithTime(L"[Startup] HMQ HSI.dll version = %s, date = %s\n", HSI_VERSION_CSTRING, + HSI_FILE_CSDESCRIPTION); //HSI.dll 汾 GoogolMotionConfigFile = m_AppPath + _T("\\Config\\EF3_Config.ini"); - Load_EF3_Config_Inifile(GoogolMotionConfigFile); + Load_EF3_Config_Inifile(GoogolMotionConfigFile); // EF3_Config.ini GoogolMotionConfigFile = m_AppPath + _T("\\Config\\EF3_Motion.ini"); - Load_EF3_Motion_Inifile(GoogolMotionConfigFile); - if (m_IsUseEF3 == 1) + Load_EF3_Motion_Inifile(GoogolMotionConfigFile); // EF3_Motion.ini + if (m_IsUseEF3 == 1) //ʹ EF3 { if (!m_bConnected) { - m_SO7_Serial.SetPort(m_EF3COMPort, 115200, 0, 8, 1, 0); - if (!m_SO7_Serial.Open()) + //ֱߵƽ̨ôͨţ8λ1ֹͣλżУ飬256000 + m_SO7_Serial.SetPort(m_EF3COMPort, 256000, 0, 8, 1, 0); //򿪴 + if (!m_SO7_Serial.Open()) //ڴʧ { g_pLogger->SendAndFlushWithTime(L"[Startup] m_SO7_Serial.Open is false,connected failed\n"); sEvenProp.Init(); @@ -382,6 +395,30 @@ HSI_STATUS HSI_Motion::Startup(HWND _hWnd, bool _bOfflineOnly) g_pLogger->SendAndFlushWithTime(L"[Startup] Serial is opened\n"); } } + // 04 05 0F 4A 04 00 04 00 00 00 00 00 00 00 00 00 + // + //01 01 0F 04 00 00 00 00 00 00 00 00 00 00 00 00 + //01 01 0F 04 00 00 00 00 00 00 00 00 00 00 00 00 + // + //01 01 01 07 02 01 01 00 00 00 00 00 00 00 00 00 + //01 09 01 01 01 07 07 00 00 00 07 04 00 00 00 00 + // + //01 01 01 05 01 07 07 00 00 00 07 04 00 00 00 00 + //01 01 02 05 01 07 07 00 00 00 07 04 00 00 00 00 + //01 01 04 05 01 07 07 00 00 00 07 04 00 00 00 00 + //01 01 08 05 01 07 07 00 00 00 07 04 00 00 00 00 + //01 01 01 06 01 07 07 00 00 00 07 04 00 00 00 00 + //01 01 01 04 00 00 00 00 00 00 00 00 00 00 00 00 + //01 01 01 02 69 00 00 00 E8 03 00 00 F4 01 00 00 + //01 01 01 03 69 00 00 00 E8 03 00 00 F4 01 00 00 + //01 01 02 04 00 00 00 00 00 00 00 00 F4 01 00 00 + //01 01 02 02 00 00 00 00 F0 00 00 00 F4 01 00 00 + //01 01 02 03 00 00 00 00 F0 00 00 00 F4 01 00 00 + //01 01 04 04 00 00 00 00 00 00 00 00 F4 01 00 00 + //01 01 04 02 00 00 00 00 F4 01 00 00 F4 01 00 00 + //01 01 04 03 00 00 00 00 F4 01 00 00 F4 01 00 00 + //01 06 07 53 01 0F 00 00 F4 01 00 00 F4 01 00 00 + //AbortMotion(); m_cSendData[0] = CT_ORDER; m_cSendData[1] = CT_STOP; @@ -412,6 +449,7 @@ HSI_STATUS HSI_Motion::Startup(HWND _hWnd, bool _bOfflineOnly) } g_pLogger->SendAndFlushWithTime(L"[Startup] Connected scuuess\n"); + if (HSI_STATUS_FAILED == DriverAlarmStatus()) { g_pLogger->SendAndFlushWithTime(L"[Startup] DriverAlarmStatus HSI_STATUS_FAILED\n"); @@ -430,7 +468,7 @@ HSI_STATUS HSI_Motion::Startup(HWND _hWnd, bool _bOfflineOnly) m_cSendData[9] = 0; m_cSendData[10] = 0; m_cSendData[11] = 0; - m_WriteByte = Send_Command(0, (const char*)m_cSendData, m_SendDataLength);//ʼֹһЧ + m_WriteByte = Send_Command(0, (const char*)m_cSendData, m_SendDataLength); //ʼֹһЧ Sleep(5); m_WriteByte = Send_Command(0, (const char*)m_cSendData, m_SendDataLength); g_pLogger->SendAndFlushWithTime(L"[Startup] Limit no Enable\n"); @@ -448,22 +486,22 @@ HSI_STATUS HSI_Motion::Startup(HWND _hWnd, bool _bOfflineOnly) m_cSendData[0] = CT_MOTOR; m_cSendData[1] = CT_MDATA_INIT; m_cSendData[2] = m_motorType & 0xff; //ͣŷ - m_cSendData[3] = m_IsUseExternalTrigger; //Ƿⴥ - m_cSendData[4] = m_IsUseSixRingEightArea; //Ƿƹ + m_cSendData[3] = m_IsUseExternalTrigger; //Ƿⴥ + m_cSendData[4] = m_IsUseSixRingEightArea; //Ƿƹ m_cSendData[5] = m_IsHardLimit; m_cSendData[6] = m_IsEnableAxis; - m_cSendData[7] = m_IsProbe; //Ƿ̽ - m_cSendData[8] = m_EF3LightType; //5VƵƹ - m_cSendData[9] = m_IsUseRocker; //Ƿҡ - m_cSendData[10] = m_IsHavePattern; //դ - m_cSendData[11] = m_AxisHomeDirection; //ؼҷ - m_cSendData[12] = m_IsCollectPos; //ǷӴڴӡλ - m_cSendData[16] = m_IsLightDebug; //Ƿ񲻻ؼҲܵԵƹ + m_cSendData[7] = m_IsProbe; //Ƿ̽ + m_cSendData[8] = m_EF3LightType; //5VƵƹ + m_cSendData[9] = m_IsUseRocker; //Ƿҡ + m_cSendData[10] = m_IsHavePattern; //դ + m_cSendData[11] = m_AxisHomeDirection; //ؼҷ + m_cSendData[12] = m_IsCollectPos; //ǷӴڴӡλ + m_cSendData[16] = m_IsLightDebug; //Ƿ񲻻ؼҲܵԵƹ if (m_IsStartInput == 1 && m_IsUseRocker == 2) { - m_cSendData[14] = m_StartInputPort >> 8 & 0xff; //ⲿ˿ں H - m_cSendData[15] = m_StartInputPort & 0xff; //ⲿ˿ں L + m_cSendData[14] = m_StartInputPort >> 8 & 0xff; //ⲿ˿ں H + m_cSendData[15] = m_StartInputPort & 0xff; //ⲿ˿ں L } m_WriteByte = Send_Command(0, (const char*)m_cSendData, m_SendDataLength); Sleep(10); @@ -556,6 +594,7 @@ HSI_STATUS HSI_Motion::Startup(HWND _hWnd, bool _bOfflineOnly) Sleep(5); g_pLogger->SendAndFlushWithTime(L"[Startup] Set Rocker Success\n"); } + //ҡ2صλ if (m_IsUseRocker == 2) { @@ -563,32 +602,34 @@ HSI_STATUS HSI_Motion::Startup(HWND _hWnd, bool _bOfflineOnly) Sleep(5); g_pLogger->SendAndFlushWithTime(L"[Startup] Set Gears Success\n"); } - CreateThread(); + + CreateThread(); //ˢλ״̬ SetEvent(m_hTriggerEvent); m_Thread_State = HSI_THREAD_PAUSED; g_pLogger->SendAndFlushWithTime(L"[Startup] SetpositionXyz Enable\n"); - CreateThreadData(); + + CreateThreadData(); //ȡEF3״̬ SetEvent(m_hTriggerEventData); m_Thread_StateData = HSI_THREAD_RUNNING; g_pLogger->SendAndFlushWithTime(L"[Startup] Read EF3 Status Run\n"); if (m_DeviceType != 3) { - CreateThreadJOGStop(); + CreateThreadJOGStop(); ////JOGеλ˶ SetEvent(m_hTriggerEventJOGStop); m_Thread_StateJOGStop = HSI_THREAD_PAUSED; } - if (m_IsIOFuntion == 1) + if (m_IsIOFuntion == 1) //ǷIOܣͨļ { m_Thread_StateIO = HSI_THREAD_RUNNING; - CreateThreadIO(); + CreateThreadIO(); //IOϢʹ SetEvent(m_hTriggerEventIO); g_pLogger->SendAndFlushWithTime(L"[Startup] m_IsIOFuntion Enable\n"); SetDIO(HSI_MOTION_OUTPUT_CH1, 0xfffff); } - if (m_IsProbe == 1) + if (m_IsProbe == 1) //Ƿ̽벶ܣͨļ { - CreateThreadProbe(); + CreateThreadProbe(); //̽벶 m_Thread_StateProbe = HSI_THREAD_RUNNING; SetEvent(m_hTriggerEventProbe); g_pLogger->SendAndFlushWithTime(L"[Startup] m_IsProbe Enable\n"); @@ -602,13 +643,14 @@ HSI_STATUS HSI_Motion::Startup(HWND _hWnd, bool _bOfflineOnly) } return rStatus; } + //=============================ȡEF3̼汾=============================== -HSI_STATUS HSI_Motion::GetFirmwareVersion(byte *version) +HSI_STATUS HSI_Motion::GetFirmwareVersion(byte* version) { m_Thread_StateData = HSI_THREAD_PAUSED; Sleep(3); int waite_count = 0; - unsigned char senddata[64] = { 0 }; + unsigned char senddata[64] = {0}; senddata[0] = 0x04; senddata[1] = 0x03; m_SO7_Serial.m_RecvData[0] = 0; @@ -660,6 +702,7 @@ HSI_STATUS HSI_Motion::GetFirmwareVersion(byte *version) SetEvent(m_hTriggerEventData); //¼hEventʾֵɹ򷵻طֵΪ0 return HSI_STATUS_NORMAL; } + //================================ؼ======================================= HSI_STATUS HSI_Motion::HomeMachine(bool bHomed) { @@ -694,31 +737,41 @@ HSI_STATUS HSI_Motion::HomeMachine(bool bHomed) g_pLogger->SendAndFlushWithTime(L"[HomeMachine] Cancel\n"); return HSI_STATUS_NORMAL; } - if (m_bEmergencyState) - { - AfxMessageBox(_T("ͣȫŻȫĻ")); - return HSI_STATUS_FAILED; - } + + if (m_bEmergencyState) + { + AfxMessageBox(_T("ͣȫŻȫĻ")); + return HSI_STATUS_FAILED; + } + CurrentHomeMachineState = E_EF3_HOME_ING; - int GetHomePos[5] = { 0 }; + int GetHomePos[5] = {0}; if (m_SO7_Serial.m_RecvData[0] == 2) { if (m_IsHavePattern & 0x01 == 0x01) - GetHomePos[1] = (m_SO7_Serial.m_RecvData[1] << 24 | m_SO7_Serial.m_RecvData[2] << 16 | m_SO7_Serial.m_RecvData[3] << 8 | m_SO7_Serial.m_RecvData[4]); + GetHomePos[1] = (m_SO7_Serial.m_RecvData[1] << 24 | m_SO7_Serial.m_RecvData[2] << 16 | m_SO7_Serial. + m_RecvData[3] << 8 | m_SO7_Serial.m_RecvData[4]); else - GetHomePos[1] = (m_SO7_Serial.m_RecvData[17] << 24 | m_SO7_Serial.m_RecvData[18] << 16 | m_SO7_Serial.m_RecvData[19] << 8 | m_SO7_Serial.m_RecvData[20]); + GetHomePos[1] = (m_SO7_Serial.m_RecvData[17] << 24 | m_SO7_Serial.m_RecvData[18] << 16 | m_SO7_Serial. + m_RecvData[19] << 8 | m_SO7_Serial.m_RecvData[20]); if (m_IsHavePattern & 0x02) - GetHomePos[2] = (m_SO7_Serial.m_RecvData[5] << 24 | m_SO7_Serial.m_RecvData[6] << 16 | m_SO7_Serial.m_RecvData[7] << 8 | m_SO7_Serial.m_RecvData[8]); + GetHomePos[2] = (m_SO7_Serial.m_RecvData[5] << 24 | m_SO7_Serial.m_RecvData[6] << 16 | m_SO7_Serial. + m_RecvData[7] << 8 | m_SO7_Serial.m_RecvData[8]); else - GetHomePos[2] = (m_SO7_Serial.m_RecvData[21] << 24 | m_SO7_Serial.m_RecvData[22] << 16 | m_SO7_Serial.m_RecvData[23] << 8 | m_SO7_Serial.m_RecvData[24]); + GetHomePos[2] = (m_SO7_Serial.m_RecvData[21] << 24 | m_SO7_Serial.m_RecvData[22] << 16 | m_SO7_Serial. + m_RecvData[23] << 8 | m_SO7_Serial.m_RecvData[24]); if (m_IsHavePattern & 0x04) - GetHomePos[3] = (m_SO7_Serial.m_RecvData[9] << 24 | m_SO7_Serial.m_RecvData[10] << 16 | m_SO7_Serial.m_RecvData[11] << 8 | m_SO7_Serial.m_RecvData[12]); + GetHomePos[3] = (m_SO7_Serial.m_RecvData[9] << 24 | m_SO7_Serial.m_RecvData[10] << 16 | m_SO7_Serial. + m_RecvData[11] << 8 | m_SO7_Serial.m_RecvData[12]); else - GetHomePos[3] = (m_SO7_Serial.m_RecvData[25] << 24 | m_SO7_Serial.m_RecvData[26] << 16 | m_SO7_Serial.m_RecvData[27] << 8 | m_SO7_Serial.m_RecvData[28]); + GetHomePos[3] = (m_SO7_Serial.m_RecvData[25] << 24 | m_SO7_Serial.m_RecvData[26] << 16 | m_SO7_Serial. + m_RecvData[27] << 8 | m_SO7_Serial.m_RecvData[28]); if (m_IsHavePattern & 0x08) - GetHomePos[4] = (m_SO7_Serial.m_RecvData[13] << 24 | m_SO7_Serial.m_RecvData[14] << 16 | m_SO7_Serial.m_RecvData[15] << 8 | m_SO7_Serial.m_RecvData[16]); + GetHomePos[4] = (m_SO7_Serial.m_RecvData[13] << 24 | m_SO7_Serial.m_RecvData[14] << 16 | m_SO7_Serial. + m_RecvData[15] << 8 | m_SO7_Serial.m_RecvData[16]); else - GetHomePos[4] = (m_SO7_Serial.m_RecvData[29] << 24 | m_SO7_Serial.m_RecvData[30] << 16 | m_SO7_Serial.m_RecvData[31] << 8 | m_SO7_Serial.m_RecvData[32]); + GetHomePos[4] = (m_SO7_Serial.m_RecvData[29] << 24 | m_SO7_Serial.m_RecvData[30] << 16 | m_SO7_Serial. + m_RecvData[31] << 8 | m_SO7_Serial.m_RecvData[32]); //GetHomePos[1] = (m_SO7_Serial.m_RecvData[1] << 24 | m_SO7_Serial.m_RecvData[2] << 16 | m_SO7_Serial.m_RecvData[3] << 8 | m_SO7_Serial.m_RecvData[4]); //GetHomePos[2] = (m_SO7_Serial.m_RecvData[5] << 24 | m_SO7_Serial.m_RecvData[6] << 16 | m_SO7_Serial.m_RecvData[7] << 8 | m_SO7_Serial.m_RecvData[8]); //GetHomePos[3] = (m_SO7_Serial.m_RecvData[9] << 24 | m_SO7_Serial.m_RecvData[10] << 16 | m_SO7_Serial.m_RecvData[11] << 8 | m_SO7_Serial.m_RecvData[12]); @@ -728,39 +781,53 @@ HSI_STATUS HSI_Motion::HomeMachine(bool bHomed) { return HSI_STATUS_FAILED; } - int SavePos[5] = { 0 }; + int SavePos[5] = {0}; if (m_SO7_Serial.m_RecvData[0] == 2) { - SavePos[1] = (m_SO7_Serial.m_RecvData[41] << 24 | m_SO7_Serial.m_RecvData[42] << 16 | m_SO7_Serial.m_RecvData[43] << 8 | m_SO7_Serial.m_RecvData[44]); - SavePos[2] = (m_SO7_Serial.m_RecvData[45] << 24 | m_SO7_Serial.m_RecvData[46] << 16 | m_SO7_Serial.m_RecvData[47] << 8 | m_SO7_Serial.m_RecvData[48]); - SavePos[3] = (m_SO7_Serial.m_RecvData[49] << 24 | m_SO7_Serial.m_RecvData[50] << 16 | m_SO7_Serial.m_RecvData[51] << 8 | m_SO7_Serial.m_RecvData[52]); - SavePos[4] = (m_SO7_Serial.m_RecvData[53] << 24 | m_SO7_Serial.m_RecvData[54] << 16 | m_SO7_Serial.m_RecvData[55] << 8 | m_SO7_Serial.m_RecvData[56]); + SavePos[1] = (m_SO7_Serial.m_RecvData[41] << 24 | m_SO7_Serial.m_RecvData[42] << 16 | m_SO7_Serial. + m_RecvData[43] << 8 | m_SO7_Serial.m_RecvData[44]); + SavePos[2] = (m_SO7_Serial.m_RecvData[45] << 24 | m_SO7_Serial.m_RecvData[46] << 16 | m_SO7_Serial. + m_RecvData[47] << 8 | m_SO7_Serial.m_RecvData[48]); + SavePos[3] = (m_SO7_Serial.m_RecvData[49] << 24 | m_SO7_Serial.m_RecvData[50] << 16 | m_SO7_Serial. + m_RecvData[51] << 8 | m_SO7_Serial.m_RecvData[52]); + SavePos[4] = (m_SO7_Serial.m_RecvData[53] << 24 | m_SO7_Serial.m_RecvData[54] << 16 | m_SO7_Serial. + m_RecvData[55] << 8 | m_SO7_Serial.m_RecvData[56]); } - double PrinfPos[5] = { 0 }; + double PrinfPos[5] = {0}; PrinfPos[1] = SavePos[1] * m_Resolution[1]; PrinfPos[2] = SavePos[2] * m_Resolution[2]; PrinfPos[3] = SavePos[3] * m_Resolution[3]; PrinfPos[4] = SavePos[4] * m_Resolution[4]; - g_pLogger->SendAndFlushWithTime(L"[HomeMachine] SavePos[1] = %d,SavePos[2] = %d,SavePos[3] = %d,SavePos[4] = %d\n", SavePos[1], SavePos[2], SavePos[3], SavePos[4]); - g_pLogger->SendAndFlushWithTime(L"[HomeMachine] PrinfPos[1] = %.4f,PrinfPos[2] = %.4f,PrinfPos[3] = %.4f,PrinfPos[4] = %.4f\n", PrinfPos[1], PrinfPos[2], PrinfPos[3], PrinfPos[4]); + g_pLogger->SendAndFlushWithTime( + L"[HomeMachine] SavePos[1] = %d,SavePos[2] = %d,SavePos[3] = %d,SavePos[4] = %d\n", SavePos[1], SavePos[2], + SavePos[3], SavePos[4]); + g_pLogger->SendAndFlushWithTime( + L"[HomeMachine] PrinfPos[1] = %.4f,PrinfPos[2] = %.4f,PrinfPos[3] = %.4f,PrinfPos[4] = %.4f\n", PrinfPos[1], + PrinfPos[2], PrinfPos[3], PrinfPos[4]); - int LastPos[5] = { 0 }; + int LastPos[5] = {0}; if (m_SO7_Serial.m_RecvData[0] == 2) { - LastPos[1] = (m_SO7_Serial.m_RecvData[1] << 24 | m_SO7_Serial.m_RecvData[2] << 16 | m_SO7_Serial.m_RecvData[3] << 8 | m_SO7_Serial.m_RecvData[4]); - LastPos[2] = (m_SO7_Serial.m_RecvData[5] << 24 | m_SO7_Serial.m_RecvData[6] << 16 | m_SO7_Serial.m_RecvData[7] << 8 | m_SO7_Serial.m_RecvData[8]); - LastPos[3] = (m_SO7_Serial.m_RecvData[9] << 24 | m_SO7_Serial.m_RecvData[10] << 16 | m_SO7_Serial.m_RecvData[11] << 8 | m_SO7_Serial.m_RecvData[12]); - LastPos[4] = (m_SO7_Serial.m_RecvData[13] << 24 | m_SO7_Serial.m_RecvData[14] << 16 | m_SO7_Serial.m_RecvData[15] << 8 | m_SO7_Serial.m_RecvData[16]); + LastPos[1] = (m_SO7_Serial.m_RecvData[1] << 24 | m_SO7_Serial.m_RecvData[2] << 16 | m_SO7_Serial.m_RecvData[ + 3] << 8 | m_SO7_Serial.m_RecvData[4]); + LastPos[2] = (m_SO7_Serial.m_RecvData[5] << 24 | m_SO7_Serial.m_RecvData[6] << 16 | m_SO7_Serial.m_RecvData[ + 7] << 8 | m_SO7_Serial.m_RecvData[8]); + LastPos[3] = (m_SO7_Serial.m_RecvData[9] << 24 | m_SO7_Serial.m_RecvData[10] << 16 | m_SO7_Serial.m_RecvData + [11] << 8 | m_SO7_Serial.m_RecvData[12]); + LastPos[4] = (m_SO7_Serial.m_RecvData[13] << 24 | m_SO7_Serial.m_RecvData[14] << 16 | m_SO7_Serial. + m_RecvData[15] << 8 | m_SO7_Serial.m_RecvData[16]); } m_Thread_State = HSI_THREAD_RUNNING; g_pLogger->SendAndFlushWithTime(L"[HomeMachine] SetPositionXyz\n"); - double PrinfMovePos[5] = { 0 }; - PrinfMovePos[1] = (GetHomePos[1] - SavePos[1])*m_Resolution[1]; - PrinfMovePos[2] = (GetHomePos[2] - SavePos[2])*m_Resolution[2]; - PrinfMovePos[3] = (GetHomePos[3] - SavePos[3])*m_Resolution[3]; - PrinfMovePos[4] = (GetHomePos[4] - SavePos[4])*m_Resolution[4]; - g_pLogger->SendAndFlushWithTime(L"[HomeMachine] SetPos[1] = %.4fmm,SetPos[2] = %.4fmm,SetPos[3] = %.4fmm,SetPos[4] = %.4fmm\n", PrinfMovePos[1], PrinfMovePos[2], PrinfMovePos[3], PrinfMovePos[4]); + double PrinfMovePos[5] = {0}; + PrinfMovePos[1] = (GetHomePos[1] - SavePos[1]) * m_Resolution[1]; + PrinfMovePos[2] = (GetHomePos[2] - SavePos[2]) * m_Resolution[2]; + PrinfMovePos[3] = (GetHomePos[3] - SavePos[3]) * m_Resolution[3]; + PrinfMovePos[4] = (GetHomePos[4] - SavePos[4]) * m_Resolution[4]; + g_pLogger->SendAndFlushWithTime( + L"[HomeMachine] SetPos[1] = %.4fmm,SetPos[2] = %.4fmm,SetPos[3] = %.4fmm,SetPos[4] = %.4fmm\n", + PrinfMovePos[1], PrinfMovePos[2], PrinfMovePos[3], PrinfMovePos[4]); if (m_DeviceType == 0 || m_DeviceType == 1) { for (short i = 1; i < 5; i++) @@ -771,32 +838,37 @@ HSI_STATUS HSI_Motion::HomeMachine(bool bHomed) } } Sleep(20); - SetPositionXyza(0, PrinfMovePos[1], PrinfMovePos[2], PrinfMovePos[3], PrinfMovePos[4], HSI_MOTION_MOVE_WAIT, 0); + SetPositionXyza(0, PrinfMovePos[1], PrinfMovePos[2], PrinfMovePos[3], PrinfMovePos[4], HSI_MOTION_MOVE_WAIT, + 0); } CurrentHomeMachineState = E_EF3_HOME_FINISHED; for (int AxisTypes = 1; AxisTypes <= 8;) { if (CurrentHomeMachineState == E_EF3_HOME_FINISHED) { - byte AxisNumber = (byte)AxisConvertIndex(AxisTypes); + byte AxisNumber = static_cast(AxisConvertIndex(AxisTypes)); m_cSendData[0] = CT_MOTOR; m_cSendData[1] = CT_MOTOR_SET; m_cSendData[2] = AxisTypes; m_cSendData[3] = SOFT_LIMIT_POS_NEG; - m_cSendData[4] = (int)(m_P_Work_Limit[AxisNumber] / m_Resolution[AxisNumber]) & 0xff; - m_cSendData[5] = ((int)(m_P_Work_Limit[AxisNumber] / m_Resolution[AxisNumber]) >> 8) & 0xff; - m_cSendData[6] = ((int)(m_P_Work_Limit[AxisNumber] / m_Resolution[AxisNumber]) >> 16) & 0xff; - m_cSendData[7] = ((int)(m_P_Work_Limit[AxisNumber] / m_Resolution[AxisNumber]) >> 24) & 0xff; + m_cSendData[4] = static_cast(m_P_Work_Limit[AxisNumber] / m_Resolution[AxisNumber]) & 0xff; + m_cSendData[5] = (static_cast(m_P_Work_Limit[AxisNumber] / m_Resolution[AxisNumber]) >> 8) & 0xff; + m_cSendData[6] = (static_cast(m_P_Work_Limit[AxisNumber] / m_Resolution[AxisNumber]) >> 16) & 0xff; + m_cSendData[7] = (static_cast(m_P_Work_Limit[AxisNumber] / m_Resolution[AxisNumber]) >> 24) & 0xff; - m_cSendData[8] = (int)(m_N_Work_Limit[AxisNumber] / m_Resolution[AxisNumber]) & 0xff; - m_cSendData[9] = ((int)(m_N_Work_Limit[AxisNumber] / m_Resolution[AxisNumber]) >> 8) & 0xff; - m_cSendData[10] = ((int)(m_N_Work_Limit[AxisNumber] / m_Resolution[AxisNumber]) >> 16) & 0xff; - m_cSendData[11] = ((int)(m_N_Work_Limit[AxisNumber] / m_Resolution[AxisNumber]) >> 24) & 0xff; + m_cSendData[8] = static_cast(m_N_Work_Limit[AxisNumber] / m_Resolution[AxisNumber]) & 0xff; + m_cSendData[9] = (static_cast(m_N_Work_Limit[AxisNumber] / m_Resolution[AxisNumber]) >> 8) & 0xff; + m_cSendData[10] = (static_cast(m_N_Work_Limit[AxisNumber] / m_Resolution[AxisNumber]) >> 16) & + 0xff; + m_cSendData[11] = (static_cast(m_N_Work_Limit[AxisNumber] / m_Resolution[AxisNumber]) >> 24) & + 0xff; m_WriteByte = Send_Command(0, (const char*)m_cSendData, m_SendDataLength); Sleep(10); AxisTypes = 2 * AxisTypes; - g_pLogger->SendAndFlushWithTime(L"[HomeMachine] Limit Enable, m_P_Work_Limit[AxisNumber] = %f,m_N_Work_Limit[AxisNumber] = %f\n", m_P_Work_Limit[AxisNumber], m_N_Work_Limit[AxisNumber]); + g_pLogger->SendAndFlushWithTime( + L"[HomeMachine] Limit Enable, m_P_Work_Limit[AxisNumber] = %f,m_N_Work_Limit[AxisNumber] = %f\n", + m_P_Work_Limit[AxisNumber], m_N_Work_Limit[AxisNumber]); } } //SetPositionXyz(0, -10,-10,-10, HSI_MOTION_MOVE_NOWAIT, 0); @@ -806,8 +878,8 @@ HSI_STATUS HSI_Motion::HomeMachine(bool bHomed) g_pLogger->SendAndFlushWithTime(L"[HomeMachine] Out\n"); } return rStatus; - } + //=========================================================================== HSI_STATUS HSI_Motion::HomeJog(short AxisNumber, short Dir, bool Wait) { @@ -820,6 +892,7 @@ HSI_STATUS HSI_Motion::HomeJog(short AxisNumber, short Dir, bool Wait) } return rStatus; } + //=========================================================================== HSI_STATUS HSI_Motion::HomeFindIndex() { @@ -863,7 +936,8 @@ HSI_STATUS HSI_Motion::HomeFindIndex() m_cSendData[1] = CT_MOTOR_SET; m_cSendData[2] = AxisTypes; m_cSendData[3] = HOME_LIMIT_SPEED_ACC_DEC; - HomeJogGearsChoice(i, m_Home_AddJogGears[i], DriveSpeed, StartSpeed, AccLine, DecLine, AccCurve, DecCurve); + HomeJogGearsChoice(i, m_Home_AddJogGears[i], DriveSpeed, StartSpeed, AccLine, DecLine, AccCurve, + DecCurve); m_cSendData[4] = (StartSpeed & 0xff); m_cSendData[5] = ((StartSpeed >> 8) & 0xff); @@ -901,7 +975,8 @@ HSI_STATUS HSI_Motion::HomeFindIndex() m_cSendData[1] = CT_MOTOR_SET; m_cSendData[2] = AxisTypes; m_cSendData[3] = HOME_ORG_SPEED_ACC_DEC; - HomeJogGearsChoice(i, m_Home_DecJogGears[i], DriveSpeed, StartSpeed, AccLine, DecLine, AccCurve, DecCurve); + HomeJogGearsChoice(i, m_Home_DecJogGears[i], DriveSpeed, StartSpeed, AccLine, DecLine, AccCurve, + DecCurve); m_cSendData[4] = (StartSpeed & 0xff); m_cSendData[5] = ((StartSpeed >> 8) & 0xff); m_cSendData[6] = ((StartSpeed >> 16) & 0xff); @@ -968,11 +1043,12 @@ HSI_STATUS HSI_Motion::HomeFindIndex() break; } } - if (m_bEmergencyState) - { - AfxMessageBox(_T("ͣȫŻȫĻ")); - return HSI_STATUS_FAILED; - } + if (m_bEmergencyState) + { + AfxMessageBox(_T("ͣȫŻȫĻ")); + return HSI_STATUS_FAILED; + } + if (Count > 25000) { g_pLogger->SendAndFlushWithTime(L"[HomeFindIndex] Go Home Timeout HSI_STATUS_FAILED\n"); @@ -985,7 +1061,9 @@ HSI_STATUS HSI_Motion::HomeFindIndex() return HSI_STATUS_FAILED; } Count++; - } while (true); + g_pLogger->SendAndFlushWithTime(L"[HomeFindIndex] Going Home Count=%d\n", Count); + } + while (true); char MessageHome[100] = ""; bool bHomed = true; @@ -1026,8 +1104,10 @@ HSI_STATUS HSI_Motion::HomeFindIndex() } return rStatus; } + //=========================================================================== -void HSI_Motion::HomeJogGearsChoice(int AxisTypes, int JogGears, int &DriveSpeed, int &StartSpeed, int &AccLine, int &DecLine, int &AccCurve, int &DecCurve) +void HSI_Motion::HomeJogGearsChoice(int AxisTypes, int JogGears, int& DriveSpeed, int& StartSpeed, int& AccLine, + int& DecLine, int& AccCurve, int& DecCurve) { DriveSpeed = m_JogDriveSpeed[AxisTypes][4 - JogGears]; StartSpeed = m_JogStartSpeed[AxisTypes][4 - JogGears]; @@ -1036,15 +1116,16 @@ void HSI_Motion::HomeJogGearsChoice(int AxisTypes, int JogGears, int &DriveSpeed AccCurve = m_JogAccCurve[AxisTypes][4 - JogGears]; DecCurve = m_JogDecCurve[AxisTypes][4 - JogGears]; } + //=========================================================================== -HSI_STATUS HSI_Motion::GetAppPath(CString &Path) +HSI_STATUS HSI_Motion::GetAppPath(CString& Path) { auto rStatus = HSI_STATUS_NORMAL; Path = _T(""); if (Path.IsEmpty()) { CString tmpPath; - GetModuleFileName(NULL, tmpPath.GetBuffer(255), 255); + GetModuleFileName(nullptr, tmpPath.GetBuffer(255), 255); tmpPath.ReleaseBuffer(); tmpPath.TrimRight(); int nLastSlash = tmpPath.ReverseFind('\\'); @@ -1056,21 +1137,23 @@ HSI_STATUS HSI_Motion::GetAppPath(CString &Path) } return rStatus; } + //=========================================================================== -HSI_STATUS HSI_Motion::IsHomed(bool &bHomed) +HSI_STATUS HSI_Motion::IsHomed(bool& bHomed) { auto rStatus = HSI_STATUS_NORMAL; if (g_pHSI_Motion) { g_pLogger->SendAndFlushWithTime(L"[IsHomed] In\n"); - short isHomed[5] = { 1, 1, 1, 1, 1 }; + short isHomed[5] = {1, 1, 1, 1, 1}; //int Count = 0; //if (bHomed == true)//λжϾ //{ // Count = 1000; //} //ᶼҪؼ - if (m_Home_Machine_Axis[1] == 0 && m_Home_Machine_Axis[2] == 0 && m_Home_Machine_Axis[3] == 0 && m_Home_Machine_Axis[4] == 0) + if (m_Home_Machine_Axis[1] == 0 && m_Home_Machine_Axis[2] == 0 && m_Home_Machine_Axis[3] == 0 && + m_Home_Machine_Axis[4] == 0) { g_pLogger->SendAndFlushWithTime(L"[IsHomed] No Axis Go Home E_GTS_HOME_FINISHED\n"); CurrentHomeMachineState = E_EF3_HOME_FINISHED; @@ -1126,6 +1209,7 @@ HSI_STATUS HSI_Motion::IsHomed(bool &bHomed) } return rStatus; } + //=========================================================================== HSI_STATUS HSI_Motion::ZeroPos(bool bZeroPos) { @@ -1191,7 +1275,7 @@ HSI_STATUS HSI_Motion::Jog(UINT AxisTypes, double Speed) int DecCurve(1); int JogSpeed(1); bool bJOGDir = Speed > 0 ? true : false; - byte AxisNumber = (byte)AxisConvertIndex(AxisTypes); + byte AxisNumber = static_cast(AxisConvertIndex(AxisTypes)); jogAxisNum = AxisNumber; jogDirFlag = bJOGDir; m_Thread_State = HSI_THREAD_PAUSED; @@ -1201,18 +1285,20 @@ HSI_STATUS HSI_Motion::Jog(UINT AxisTypes, double Speed) m_cSendData[1] = CT_MOTOR_SET; m_cSendData[2] = AxisTypes; m_cSendData[3] = SOFT_LIMIT_POS_NEG; - m_cSendData[4] = (int)(m_P_Work_Limit[AxisNumber] / m_Resolution[AxisNumber]) & 0xff;//λ - m_cSendData[5] = ((int)(m_P_Work_Limit[AxisNumber] / m_Resolution[AxisNumber]) >> 8) & 0xff; - m_cSendData[6] = ((int)(m_P_Work_Limit[AxisNumber] / m_Resolution[AxisNumber]) >> 16) & 0xff; - m_cSendData[7] = ((int)(m_P_Work_Limit[AxisNumber] / m_Resolution[AxisNumber]) >> 24) & 0xff; + m_cSendData[4] = static_cast(m_P_Work_Limit[AxisNumber] / m_Resolution[AxisNumber]) & 0xff; //λ + m_cSendData[5] = (static_cast(m_P_Work_Limit[AxisNumber] / m_Resolution[AxisNumber]) >> 8) & 0xff; + m_cSendData[6] = (static_cast(m_P_Work_Limit[AxisNumber] / m_Resolution[AxisNumber]) >> 16) & 0xff; + m_cSendData[7] = (static_cast(m_P_Work_Limit[AxisNumber] / m_Resolution[AxisNumber]) >> 24) & 0xff; - m_cSendData[8] = (int)(m_N_Work_Limit[AxisNumber] / m_Resolution[AxisNumber]) & 0xff; //λ - m_cSendData[9] = ((int)(m_N_Work_Limit[AxisNumber] / m_Resolution[AxisNumber]) >> 8) & 0xff; - m_cSendData[10] = ((int)(m_N_Work_Limit[AxisNumber] / m_Resolution[AxisNumber]) >> 16) & 0xff; - m_cSendData[11] = ((int)(m_N_Work_Limit[AxisNumber] / m_Resolution[AxisNumber]) >> 24) & 0xff; + m_cSendData[8] = static_cast(m_N_Work_Limit[AxisNumber] / m_Resolution[AxisNumber]) & 0xff; //λ + m_cSendData[9] = (static_cast(m_N_Work_Limit[AxisNumber] / m_Resolution[AxisNumber]) >> 8) & 0xff; + m_cSendData[10] = (static_cast(m_N_Work_Limit[AxisNumber] / m_Resolution[AxisNumber]) >> 16) & 0xff; + m_cSendData[11] = (static_cast(m_N_Work_Limit[AxisNumber] / m_Resolution[AxisNumber]) >> 24) & 0xff; m_WriteByte = Send_Command(0, (const char*)m_cSendData, m_SendDataLength); - g_pLogger->SendAndFlushWithTime(L"[Jog] Limit Enable, m_P_Work_Limit[AxisNumber] = %f,m_N_Work_Limit[AxisNumber] = %f\n", m_P_Work_Limit[AxisNumber], m_N_Work_Limit[AxisNumber]); + g_pLogger->SendAndFlushWithTime( + L"[Jog] Limit Enable, m_P_Work_Limit[AxisNumber] = %f,m_N_Work_Limit[AxisNumber] = %f\n", + m_P_Work_Limit[AxisNumber], m_N_Work_Limit[AxisNumber]); } else { @@ -1236,9 +1322,9 @@ HSI_STATUS HSI_Motion::Jog(UINT AxisTypes, double Speed) { return rStatus; } - double now_pos[5] = { 0 }; - double Prf_pos[5] = { 0 }; - double limitpos[4] = { 0 }; + double now_pos[5] = {0}; + double Prf_pos[5] = {0}; + double limitpos[4] = {0}; int RemainPul = 0; int limitSDPul = 0; double time; @@ -1249,11 +1335,12 @@ HSI_STATUS HSI_Motion::Jog(UINT AxisTypes, double Speed) { if (AxisTypes == AXIS_X && m_motorType & 0x01) { - if (!bJOGDir)// + if (!bJOGDir) // { - RemainPul = (int)(now_pos[1] / m_Resolution[1]) - (int)(m_N_Work_Limit[1] / m_Resolution[1]); + RemainPul = static_cast(now_pos[1] / m_Resolution[1]) - static_cast(m_N_Work_Limit[1] / + m_Resolution[1]); limitSDPul = (DriveSpeed - StartSpeed) * 13; - if ((RemainPul < limitSDPul * 2) && (RemainPul>0)) + if ((RemainPul < limitSDPul * 2) && (RemainPul > 0)) { float SpeedRatio = limitSDPul * 2 / RemainPul; DriveSpeed = DriveSpeed / SpeedRatio; @@ -1265,9 +1352,10 @@ HSI_STATUS HSI_Motion::Jog(UINT AxisTypes, double Speed) } else { - RemainPul = (int)(m_P_Work_Limit[1] / m_Resolution[1]) - (int)(now_pos[1] / m_Resolution[1]); + RemainPul = static_cast(m_P_Work_Limit[1] / m_Resolution[1]) - static_cast(now_pos[1] / + m_Resolution[1]); limitSDPul = (DriveSpeed - StartSpeed) * 13; - if ((RemainPul < limitSDPul * 2) && (RemainPul>0)) + if ((RemainPul < limitSDPul * 2) && (RemainPul > 0)) { float SpeedRatio = limitSDPul * 2 / RemainPul; DriveSpeed = DriveSpeed / SpeedRatio; @@ -1280,11 +1368,12 @@ HSI_STATUS HSI_Motion::Jog(UINT AxisTypes, double Speed) } else if (AxisTypes == AXIS_Y && m_motorType & 0x02) { - if (!bJOGDir)// + if (!bJOGDir) // { - RemainPul = (int)(now_pos[2] / m_Resolution[2]) - (int)(m_N_Work_Limit[2] / m_Resolution[2]); + RemainPul = static_cast(now_pos[2] / m_Resolution[2]) - static_cast(m_N_Work_Limit[2] / + m_Resolution[2]); limitSDPul = (DriveSpeed - StartSpeed) * 13; - if ((RemainPul < limitSDPul * 2) && (RemainPul>0)) + if ((RemainPul < limitSDPul * 2) && (RemainPul > 0)) { float SpeedRatio = 1 + limitSDPul * 2 / RemainPul; DriveSpeed = DriveSpeed / SpeedRatio; @@ -1296,9 +1385,10 @@ HSI_STATUS HSI_Motion::Jog(UINT AxisTypes, double Speed) } else { - RemainPul = (int)(m_P_Work_Limit[2] / m_Resolution[2]) - (int)(now_pos[2] / m_Resolution[2]); + RemainPul = static_cast(m_P_Work_Limit[2] / m_Resolution[2]) - static_cast(now_pos[2] / + m_Resolution[2]); limitSDPul = (DriveSpeed - StartSpeed) * 13; - if ((RemainPul < limitSDPul * 2) && (RemainPul>0)) + if ((RemainPul < limitSDPul * 2) && (RemainPul > 0)) { float SpeedRatio = limitSDPul * 2 / RemainPul; DriveSpeed = DriveSpeed / SpeedRatio; @@ -1311,11 +1401,12 @@ HSI_STATUS HSI_Motion::Jog(UINT AxisTypes, double Speed) } if (AxisTypes == AXIS_Z && m_motorType & 0x04) { - if (!bJOGDir)// + if (!bJOGDir) // { - RemainPul = (int)(now_pos[3] / m_Resolution[3]) - (int)(m_N_Work_Limit[3] / m_Resolution[3]); + RemainPul = static_cast(now_pos[3] / m_Resolution[3]) - static_cast(m_N_Work_Limit[3] / + m_Resolution[3]); limitSDPul = (DriveSpeed - StartSpeed) * 13; - if ((RemainPul < limitSDPul * 2) && (RemainPul>0)) + if ((RemainPul < limitSDPul * 2) && (RemainPul > 0)) { float SpeedRatio = limitSDPul * 2 / RemainPul; DriveSpeed = DriveSpeed / SpeedRatio; @@ -1327,9 +1418,10 @@ HSI_STATUS HSI_Motion::Jog(UINT AxisTypes, double Speed) } else { - RemainPul = (int)(m_P_Work_Limit[3] / m_Resolution[3]) - (int)(now_pos[3] / m_Resolution[3]); + RemainPul = static_cast(m_P_Work_Limit[3] / m_Resolution[3]) - static_cast(now_pos[3] / + m_Resolution[3]); limitSDPul = (DriveSpeed - StartSpeed) * 13; - if ((RemainPul < limitSDPul * 2) && (RemainPul>0)) + if ((RemainPul < limitSDPul * 2) && (RemainPul > 0)) { float SpeedRatio = limitSDPul * 2 / RemainPul; DriveSpeed = DriveSpeed / SpeedRatio; @@ -1342,11 +1434,12 @@ HSI_STATUS HSI_Motion::Jog(UINT AxisTypes, double Speed) } if (AxisTypes == AXIS_U && m_motorType & 0x08) { - if (!bJOGDir)// + if (!bJOGDir) // { - RemainPul = (int)(now_pos[4] / m_Resolution[4]) - (int)(m_N_Work_Limit[4] / m_Resolution[4]); + RemainPul = static_cast(now_pos[4] / m_Resolution[4]) - static_cast(m_N_Work_Limit[4] / + m_Resolution[4]); limitSDPul = (DriveSpeed - StartSpeed) * 13; - if ((RemainPul < limitSDPul * 2) && (RemainPul>0)) + if ((RemainPul < limitSDPul * 2) && (RemainPul > 0)) { float SpeedRatio = limitSDPul * 2 / RemainPul; DriveSpeed = DriveSpeed / SpeedRatio; @@ -1358,9 +1451,10 @@ HSI_STATUS HSI_Motion::Jog(UINT AxisTypes, double Speed) } else { - RemainPul = (int)(m_P_Work_Limit[4] / m_Resolution[4]) - (int)(now_pos[4] / m_Resolution[4]); + RemainPul = static_cast(m_P_Work_Limit[4] / m_Resolution[4]) - static_cast(now_pos[4] / + m_Resolution[4]); limitSDPul = (DriveSpeed - StartSpeed) * 13; - if ((RemainPul < limitSDPul * 2) && (RemainPul>0)) + if ((RemainPul < limitSDPul * 2) && (RemainPul > 0)) { float SpeedRatio = limitSDPul * 2 / RemainPul; DriveSpeed = DriveSpeed / SpeedRatio; @@ -1421,7 +1515,7 @@ HSI_STATUS HSI_Motion::Jog(UINT AxisTypes, double Speed) m_cSendData[0] = CT_MOTOR; if (AxisNumber == 1 || AxisNumber == 2) { - if (!bJOGDir)// + if (!bJOGDir) // { m_cSendData[1] = CT_START_JOG_NEG; } @@ -1432,7 +1526,7 @@ HSI_STATUS HSI_Motion::Jog(UINT AxisTypes, double Speed) } else { - if (bJOGDir)// + if (bJOGDir) // { m_cSendData[1] = CT_START_JOG_POS; } @@ -1450,6 +1544,7 @@ HSI_STATUS HSI_Motion::Jog(UINT AxisTypes, double Speed) } return rStatus; } + //JOGģʽ //=========================================================================== HSI_STATUS HSI_Motion::JoyStick(UINT AxisTypes, long Speed) @@ -1470,7 +1565,7 @@ HSI_STATUS HSI_Motion::JoyStick(UINT AxisTypes, long Speed) int DecCurve(1); int JogSpeed(1); bool bJOGDir = Speed > 0 ? true : false; - byte AxisNumber = (byte)AxisConvertIndex(AxisTypes); + byte AxisNumber = static_cast(AxisConvertIndex(AxisTypes)); jogAxisNum = AxisNumber; jogDirFlag = bJOGDir; m_Thread_State = HSI_THREAD_PAUSED; @@ -1480,18 +1575,20 @@ HSI_STATUS HSI_Motion::JoyStick(UINT AxisTypes, long Speed) m_cSendData[1] = CT_MOTOR_SET; m_cSendData[2] = AxisTypes; m_cSendData[3] = SOFT_LIMIT_POS_NEG; - m_cSendData[4] = (int)(m_P_Work_Limit[AxisNumber] / m_Resolution[AxisNumber]) & 0xff; - m_cSendData[5] = ((int)(m_P_Work_Limit[AxisNumber] / m_Resolution[AxisNumber]) >> 8) & 0xff; - m_cSendData[6] = ((int)(m_P_Work_Limit[AxisNumber] / m_Resolution[AxisNumber]) >> 16) & 0xff; - m_cSendData[7] = ((int)(m_P_Work_Limit[AxisNumber] / m_Resolution[AxisNumber]) >> 24) & 0xff; + m_cSendData[4] = static_cast(m_P_Work_Limit[AxisNumber] / m_Resolution[AxisNumber]) & 0xff; + m_cSendData[5] = (static_cast(m_P_Work_Limit[AxisNumber] / m_Resolution[AxisNumber]) >> 8) & 0xff; + m_cSendData[6] = (static_cast(m_P_Work_Limit[AxisNumber] / m_Resolution[AxisNumber]) >> 16) & 0xff; + m_cSendData[7] = (static_cast(m_P_Work_Limit[AxisNumber] / m_Resolution[AxisNumber]) >> 24) & 0xff; - m_cSendData[8] = (int)(m_N_Work_Limit[AxisNumber] / m_Resolution[AxisNumber]) & 0xff; - m_cSendData[9] = ((int)(m_N_Work_Limit[AxisNumber] / m_Resolution[AxisNumber]) >> 8) & 0xff; - m_cSendData[10] = ((int)(m_N_Work_Limit[AxisNumber] / m_Resolution[AxisNumber]) >> 16) & 0xff; - m_cSendData[11] = ((int)(m_N_Work_Limit[AxisNumber] / m_Resolution[AxisNumber]) >> 24) & 0xff; + m_cSendData[8] = static_cast(m_N_Work_Limit[AxisNumber] / m_Resolution[AxisNumber]) & 0xff; + m_cSendData[9] = (static_cast(m_N_Work_Limit[AxisNumber] / m_Resolution[AxisNumber]) >> 8) & 0xff; + m_cSendData[10] = (static_cast(m_N_Work_Limit[AxisNumber] / m_Resolution[AxisNumber]) >> 16) & 0xff; + m_cSendData[11] = (static_cast(m_N_Work_Limit[AxisNumber] / m_Resolution[AxisNumber]) >> 24) & 0xff; m_WriteByte = Send_Command(0, (const char*)m_cSendData, m_SendDataLength); - g_pLogger->SendAndFlushWithTime(L"[Jog] Limit Enable, m_P_Work_Limit[AxisNumber] = %f,m_N_Work_Limit[AxisNumber] = %f\n", m_P_Work_Limit[AxisNumber], m_N_Work_Limit[AxisNumber]); + g_pLogger->SendAndFlushWithTime( + L"[Jog] Limit Enable, m_P_Work_Limit[AxisNumber] = %f,m_N_Work_Limit[AxisNumber] = %f\n", + m_P_Work_Limit[AxisNumber], m_N_Work_Limit[AxisNumber]); } else { @@ -1515,16 +1612,17 @@ HSI_STATUS HSI_Motion::JoyStick(UINT AxisTypes, long Speed) { return rStatus; } - double now_pos[5] = { 0 }; - double Prf_pos[5] = { 0 }; - double limitpos[4] = { 0 }; + double now_pos[5] = {0}; + double Prf_pos[5] = {0}; + double limitpos[4] = {0}; int RemainPul = 0; int limitSDPul = 0; double time; /*GetPositionXyz(1, now_pos[0], now_pos[1], now_pos[2], time);*/ GetPositionEncPrfMulti(1, now_pos, Prf_pos, 1); long lSpeed = abs(Speed); - if (!abs(SpeedPercentJoyStick(AxisNumber, lSpeed, DriveSpeed, StartSpeed, AccLine, DecLine, AccCurve, DecCurve))) + if (!abs(SpeedPercentJoyStick(AxisNumber, lSpeed, DriveSpeed, StartSpeed, AccLine, DecLine, AccCurve, + DecCurve))) { return rStatus; } @@ -1532,11 +1630,12 @@ HSI_STATUS HSI_Motion::JoyStick(UINT AxisTypes, long Speed) { if (AxisTypes == AXIS_X && m_motorType & 0x01) { - if (!bJOGDir)// + if (!bJOGDir) // { - RemainPul = (int)(now_pos[1] / m_Resolution[1]) - (int)(m_N_Work_Limit[1] / m_Resolution[1]); + RemainPul = static_cast(now_pos[1] / m_Resolution[1]) - static_cast(m_N_Work_Limit[1] / + m_Resolution[1]); limitSDPul = (DriveSpeed - StartSpeed) * 13; - if ((RemainPul < limitSDPul * 2) && (RemainPul>0)) + if ((RemainPul < limitSDPul * 2) && (RemainPul > 0)) { float SpeedRatio = limitSDPul * 2 / RemainPul; DriveSpeed = DriveSpeed / SpeedRatio; @@ -1548,9 +1647,10 @@ HSI_STATUS HSI_Motion::JoyStick(UINT AxisTypes, long Speed) } else { - RemainPul = (int)(m_P_Work_Limit[1] / m_Resolution[1]) - (int)(now_pos[1] / m_Resolution[1]); + RemainPul = static_cast(m_P_Work_Limit[1] / m_Resolution[1]) - static_cast(now_pos[1] / + m_Resolution[1]); limitSDPul = (DriveSpeed - StartSpeed) * 13; - if ((RemainPul < limitSDPul * 2) && (RemainPul>0)) + if ((RemainPul < limitSDPul * 2) && (RemainPul > 0)) { float SpeedRatio = limitSDPul * 2 / RemainPul; DriveSpeed = DriveSpeed / SpeedRatio; @@ -1563,11 +1663,12 @@ HSI_STATUS HSI_Motion::JoyStick(UINT AxisTypes, long Speed) } else if (AxisTypes == AXIS_Y && m_motorType & 0x02) { - if (!bJOGDir)// + if (!bJOGDir) // { - RemainPul = (int)(now_pos[2] / m_Resolution[2]) - (int)(m_N_Work_Limit[2] / m_Resolution[2]); + RemainPul = static_cast(now_pos[2] / m_Resolution[2]) - static_cast(m_N_Work_Limit[2] / + m_Resolution[2]); limitSDPul = (DriveSpeed - StartSpeed) * 13; - if ((RemainPul < limitSDPul * 2) && (RemainPul>0)) + if ((RemainPul < limitSDPul * 2) && (RemainPul > 0)) { float SpeedRatio = 1 + limitSDPul * 2 / RemainPul; DriveSpeed = DriveSpeed / SpeedRatio; @@ -1579,9 +1680,10 @@ HSI_STATUS HSI_Motion::JoyStick(UINT AxisTypes, long Speed) } else { - RemainPul = (int)(m_P_Work_Limit[2] / m_Resolution[2]) - (int)(now_pos[2] / m_Resolution[2]); + RemainPul = static_cast(m_P_Work_Limit[2] / m_Resolution[2]) - static_cast(now_pos[2] / + m_Resolution[2]); limitSDPul = (DriveSpeed - StartSpeed) * 13; - if ((RemainPul < limitSDPul * 2) && (RemainPul>0)) + if ((RemainPul < limitSDPul * 2) && (RemainPul > 0)) { float SpeedRatio = limitSDPul * 2 / RemainPul; DriveSpeed = DriveSpeed / SpeedRatio; @@ -1594,11 +1696,12 @@ HSI_STATUS HSI_Motion::JoyStick(UINT AxisTypes, long Speed) } if (AxisTypes == AXIS_Z && m_motorType & 0x04) { - if (!bJOGDir)// + if (!bJOGDir) // { - RemainPul = (int)(now_pos[3] / m_Resolution[3]) - (int)(m_N_Work_Limit[3] / m_Resolution[3]); + RemainPul = static_cast(now_pos[3] / m_Resolution[3]) - static_cast(m_N_Work_Limit[3] / + m_Resolution[3]); limitSDPul = (DriveSpeed - StartSpeed) * 13; - if ((RemainPul < limitSDPul * 2) && (RemainPul>0)) + if ((RemainPul < limitSDPul * 2) && (RemainPul > 0)) { float SpeedRatio = limitSDPul * 2 / RemainPul; DriveSpeed = DriveSpeed / SpeedRatio; @@ -1610,9 +1713,10 @@ HSI_STATUS HSI_Motion::JoyStick(UINT AxisTypes, long Speed) } else { - RemainPul = (int)(m_P_Work_Limit[3] / m_Resolution[3]) - (int)(now_pos[3] / m_Resolution[3]); + RemainPul = static_cast(m_P_Work_Limit[3] / m_Resolution[3]) - static_cast(now_pos[3] / + m_Resolution[3]); limitSDPul = (DriveSpeed - StartSpeed) * 13; - if ((RemainPul < limitSDPul * 2) && (RemainPul>0)) + if ((RemainPul < limitSDPul * 2) && (RemainPul > 0)) { float SpeedRatio = limitSDPul * 2 / RemainPul; DriveSpeed = DriveSpeed / SpeedRatio; @@ -1625,11 +1729,12 @@ HSI_STATUS HSI_Motion::JoyStick(UINT AxisTypes, long Speed) } if (AxisTypes == AXIS_U && m_motorType & 0x08) { - if (!bJOGDir)// + if (!bJOGDir) // { - RemainPul = (int)(now_pos[4] / m_Resolution[4]) - (int)(m_N_Work_Limit[4] / m_Resolution[4]); + RemainPul = static_cast(now_pos[4] / m_Resolution[4]) - static_cast(m_N_Work_Limit[4] / + m_Resolution[4]); limitSDPul = (DriveSpeed - StartSpeed) * 13; - if ((RemainPul < limitSDPul * 2) && (RemainPul>0)) + if ((RemainPul < limitSDPul * 2) && (RemainPul > 0)) { float SpeedRatio = limitSDPul * 2 / RemainPul; DriveSpeed = DriveSpeed / SpeedRatio; @@ -1641,9 +1746,10 @@ HSI_STATUS HSI_Motion::JoyStick(UINT AxisTypes, long Speed) } else { - RemainPul = (int)(m_P_Work_Limit[4] / m_Resolution[4]) - (int)(now_pos[4] / m_Resolution[4]); + RemainPul = static_cast(m_P_Work_Limit[4] / m_Resolution[4]) - static_cast(now_pos[4] / + m_Resolution[4]); limitSDPul = (DriveSpeed - StartSpeed) * 13; - if ((RemainPul < limitSDPul * 2) && (RemainPul>0)) + if ((RemainPul < limitSDPul * 2) && (RemainPul > 0)) { float SpeedRatio = limitSDPul * 2 / RemainPul; DriveSpeed = DriveSpeed / SpeedRatio; @@ -1704,7 +1810,7 @@ HSI_STATUS HSI_Motion::JoyStick(UINT AxisTypes, long Speed) m_cSendData[0] = CT_MOTOR; if (AxisNumber == 1 || AxisNumber == 2) { - if (!bJOGDir)// + if (!bJOGDir) // { m_cSendData[1] = CT_START_JOG_NEG; } @@ -1715,7 +1821,7 @@ HSI_STATUS HSI_Motion::JoyStick(UINT AxisTypes, long Speed) } else { - if (bJOGDir)// + if (bJOGDir) // { m_cSendData[1] = CT_START_JOG_POS; } @@ -1733,6 +1839,7 @@ HSI_STATUS HSI_Motion::JoyStick(UINT AxisTypes, long Speed) } return rStatus; } + //=========================================================================== HSI_STATUS HSI_Motion::StopJog() { @@ -1750,7 +1857,7 @@ HSI_STATUS HSI_Motion::StopJog() g_pLogger->SendAndFlushWithTime(L"[StopJog] PushButtonTime = %d\n", t_use); Sleep(t_use); } - unsigned char m_SendJogData[64] = { 0 }; + unsigned char m_SendJogData[64] = {0}; if (m_IsUseJerk == 0) { m_SendJogData[0] = CT_MOTOR; @@ -1779,6 +1886,7 @@ HSI_STATUS HSI_Motion::StopJog() } return rStatus; } + //=========================================================================== HSI_STATUS HSI_Motion::StopJogEx(UINT AxisTypes) { @@ -1786,7 +1894,7 @@ HSI_STATUS HSI_Motion::StopJogEx(UINT AxisTypes) auto rStatus = HSI_STATUS_NORMAL; if (g_pHSI_Motion) { - byte AxisNumber = (byte)IndexConvertAxis(AxisTypes); + byte AxisNumber = static_cast(IndexConvertAxis(AxisTypes)); g_pLogger->SendAndFlushWithTime(L"[StopJog] In\n"); t_end = GetTickCount(); g_pLogger->SendAndFlushWithTime(L"[StopJog] t_start = %d, t_end = %d\n", t_start, t_end); @@ -1797,7 +1905,7 @@ HSI_STATUS HSI_Motion::StopJogEx(UINT AxisTypes) g_pLogger->SendAndFlushWithTime(L"[StopJog] PushButtonTime = %d\n", t_use); Sleep(t_use); } - unsigned char m_SendJogData[64] = { 0 }; + unsigned char m_SendJogData[64] = {0}; if (m_IsUseJerk == 0) { m_SendJogData[0] = CT_MOTOR; @@ -1834,19 +1942,20 @@ HSI_STATUS HSI_Motion::StopJogEx(UINT AxisTypes) } return rStatus; } + //=========================================================================== int HSI_Motion::P2P(short AxisNumber, long Pos, double Speed, double Acc) { if (g_pHSI_Motion) { - } return 0; } + //=========================================================================== //˶Ʋ //=========================================================================== -HSI_STATUS HSI_Motion::GetPositionEncPrfMulti(UINT AxisTypes, double *EncPos, double *PrfPos, int Count) +HSI_STATUS HSI_Motion::GetPositionEncPrfMulti(UINT AxisTypes, double* EncPos, double* PrfPos, int Count) { auto rStatus = HSI_STATUS_NORMAL; UNREFERENCED_PARAMETER(AxisTypes); @@ -1856,15 +1965,23 @@ HSI_STATUS HSI_Motion::GetPositionEncPrfMulti(UINT AxisTypes, double *EncPos, do //g_pLogger->SendAndFlushWithTime(L"[GetPositionEncPrfMulti] In\n"); if (m_SO7_Serial.m_RecvData[0] == 2) { - EncPos[1] = (m_SO7_Serial.m_RecvData[1] << 24 | m_SO7_Serial.m_RecvData[2] << 16 | m_SO7_Serial.m_RecvData[3] << 8 | m_SO7_Serial.m_RecvData[4]) * m_Resolution[1]; - EncPos[2] = (m_SO7_Serial.m_RecvData[5] << 24 | m_SO7_Serial.m_RecvData[6] << 16 | m_SO7_Serial.m_RecvData[7] << 8 | m_SO7_Serial.m_RecvData[8]) * m_Resolution[2]; - EncPos[3] = (m_SO7_Serial.m_RecvData[9] << 24 | m_SO7_Serial.m_RecvData[10] << 16 | m_SO7_Serial.m_RecvData[11] << 8 | m_SO7_Serial.m_RecvData[12]) * m_Resolution[3]; - EncPos[4] = (m_SO7_Serial.m_RecvData[13] << 24 | m_SO7_Serial.m_RecvData[14] << 16 | m_SO7_Serial.m_RecvData[15] << 8 | m_SO7_Serial.m_RecvData[16]) * m_Resolution[4]; + EncPos[1] = (m_SO7_Serial.m_RecvData[1] << 24 | m_SO7_Serial.m_RecvData[2] << 16 | m_SO7_Serial.m_RecvData[ + 3] << 8 | m_SO7_Serial.m_RecvData[4]) * m_Resolution[1]; + EncPos[2] = (m_SO7_Serial.m_RecvData[5] << 24 | m_SO7_Serial.m_RecvData[6] << 16 | m_SO7_Serial.m_RecvData[ + 7] << 8 | m_SO7_Serial.m_RecvData[8]) * m_Resolution[2]; + EncPos[3] = (m_SO7_Serial.m_RecvData[9] << 24 | m_SO7_Serial.m_RecvData[10] << 16 | m_SO7_Serial.m_RecvData[ + 11] << 8 | m_SO7_Serial.m_RecvData[12]) * m_Resolution[3]; + EncPos[4] = (m_SO7_Serial.m_RecvData[13] << 24 | m_SO7_Serial.m_RecvData[14] << 16 | m_SO7_Serial.m_RecvData + [15] << 8 | m_SO7_Serial.m_RecvData[16]) * m_Resolution[4]; - PrfPos[1] = (m_SO7_Serial.m_RecvData[17] << 24 | m_SO7_Serial.m_RecvData[18] << 16 | m_SO7_Serial.m_RecvData[19] << 8 | m_SO7_Serial.m_RecvData[20]) * m_Resolution[1]; - PrfPos[2] = (m_SO7_Serial.m_RecvData[21] << 24 | m_SO7_Serial.m_RecvData[22] << 16 | m_SO7_Serial.m_RecvData[23] << 8 | m_SO7_Serial.m_RecvData[24]) * m_Resolution[2]; - PrfPos[3] = (m_SO7_Serial.m_RecvData[25] << 24 | m_SO7_Serial.m_RecvData[26] << 16 | m_SO7_Serial.m_RecvData[27] << 8 | m_SO7_Serial.m_RecvData[28]) * m_Resolution[3]; - PrfPos[4] = (m_SO7_Serial.m_RecvData[29] << 24 | m_SO7_Serial.m_RecvData[30] << 16 | m_SO7_Serial.m_RecvData[31] << 8 | m_SO7_Serial.m_RecvData[32]) * m_Resolution[4]; + PrfPos[1] = (m_SO7_Serial.m_RecvData[17] << 24 | m_SO7_Serial.m_RecvData[18] << 16 | m_SO7_Serial.m_RecvData + [19] << 8 | m_SO7_Serial.m_RecvData[20]) * m_Resolution[1]; + PrfPos[2] = (m_SO7_Serial.m_RecvData[21] << 24 | m_SO7_Serial.m_RecvData[22] << 16 | m_SO7_Serial.m_RecvData + [23] << 8 | m_SO7_Serial.m_RecvData[24]) * m_Resolution[2]; + PrfPos[3] = (m_SO7_Serial.m_RecvData[25] << 24 | m_SO7_Serial.m_RecvData[26] << 16 | m_SO7_Serial.m_RecvData + [27] << 8 | m_SO7_Serial.m_RecvData[28]) * m_Resolution[3]; + PrfPos[4] = (m_SO7_Serial.m_RecvData[29] << 24 | m_SO7_Serial.m_RecvData[30] << 16 | m_SO7_Serial.m_RecvData + [31] << 8 | m_SO7_Serial.m_RecvData[32]) * m_Resolution[4]; if (m_IsHavePattern & 0x01) m_EncPos[1] = EncPos[1]; @@ -1909,8 +2026,10 @@ HSI_STATUS HSI_Motion::GetPositionEncPrfMulti(UINT AxisTypes, double *EncPos, do } return rStatus; } + //=========================================================================== -HSI_STATUS HSI_Motion::GetPositionXyz(UINT AxisTypes, double &PositionX, double &PositionY, double &PositionZ, double &Time) +HSI_STATUS HSI_Motion::GetPositionXyz(UINT AxisTypes, double& PositionX, double& PositionY, double& PositionZ, + double& Time) { auto rStatus = HSI_STATUS_NORMAL; UNREFERENCED_PARAMETER(AxisTypes); @@ -1923,27 +2042,38 @@ HSI_STATUS HSI_Motion::GetPositionXyz(UINT AxisTypes, double &PositionX, double if (m_DeviceType != 1) { if (m_IsHavePattern & 0x01) - PositionX = (m_SO7_Serial.m_RecvData[1] << 24 | m_SO7_Serial.m_RecvData[2] << 16 | m_SO7_Serial.m_RecvData[3] << 8 | m_SO7_Serial.m_RecvData[4]) * m_Resolution[1]; + PositionX = (m_SO7_Serial.m_RecvData[1] << 24 | m_SO7_Serial.m_RecvData[2] << 16 | m_SO7_Serial. + m_RecvData[3] << 8 | m_SO7_Serial.m_RecvData[4]) * m_Resolution[1]; else - PositionX = (m_SO7_Serial.m_RecvData[17] << 24 | m_SO7_Serial.m_RecvData[18] << 16 | m_SO7_Serial.m_RecvData[19] << 8 | m_SO7_Serial.m_RecvData[20]) * m_Resolution[1]; + PositionX = (m_SO7_Serial.m_RecvData[17] << 24 | m_SO7_Serial.m_RecvData[18] << 16 | m_SO7_Serial. + m_RecvData[19] << 8 | m_SO7_Serial.m_RecvData[20]) * m_Resolution[1]; if (m_IsHavePattern & 0x02) - PositionY = (m_SO7_Serial.m_RecvData[5] << 24 | m_SO7_Serial.m_RecvData[6] << 16 | m_SO7_Serial.m_RecvData[7] << 8 | m_SO7_Serial.m_RecvData[8]) * m_Resolution[2]; + PositionY = (m_SO7_Serial.m_RecvData[5] << 24 | m_SO7_Serial.m_RecvData[6] << 16 | m_SO7_Serial. + m_RecvData[7] << 8 | m_SO7_Serial.m_RecvData[8]) * m_Resolution[2]; else - PositionY = (m_SO7_Serial.m_RecvData[21] << 24 | m_SO7_Serial.m_RecvData[22] << 16 | m_SO7_Serial.m_RecvData[23] << 8 | m_SO7_Serial.m_RecvData[24]) * m_Resolution[2]; + PositionY = (m_SO7_Serial.m_RecvData[21] << 24 | m_SO7_Serial.m_RecvData[22] << 16 | m_SO7_Serial. + m_RecvData[23] << 8 | m_SO7_Serial.m_RecvData[24]) * m_Resolution[2]; if (m_IsHavePattern & 0x04) - PositionZ = (m_SO7_Serial.m_RecvData[9] << 24 | m_SO7_Serial.m_RecvData[10] << 16 | m_SO7_Serial.m_RecvData[11] << 8 | m_SO7_Serial.m_RecvData[12]) * m_Resolution[3]; + PositionZ = (m_SO7_Serial.m_RecvData[9] << 24 | m_SO7_Serial.m_RecvData[10] << 16 | m_SO7_Serial. + m_RecvData[11] << 8 | m_SO7_Serial.m_RecvData[12]) * m_Resolution[3]; else - PositionZ = (m_SO7_Serial.m_RecvData[25] << 24 | m_SO7_Serial.m_RecvData[26] << 16 | m_SO7_Serial.m_RecvData[27] << 8 | m_SO7_Serial.m_RecvData[28]) * m_Resolution[3]; + PositionZ = (m_SO7_Serial.m_RecvData[25] << 24 | m_SO7_Serial.m_RecvData[26] << 16 | m_SO7_Serial. + m_RecvData[27] << 8 | m_SO7_Serial.m_RecvData[28]) * m_Resolution[3]; if (m_IsHavePattern & 0x08) - m_PosForAllAxis[4] = (m_SO7_Serial.m_RecvData[13] << 24 | m_SO7_Serial.m_RecvData[14] << 16 | m_SO7_Serial.m_RecvData[15] << 8 | m_SO7_Serial.m_RecvData[16]) * m_Resolution[4]; + m_PosForAllAxis[4] = (m_SO7_Serial.m_RecvData[13] << 24 | m_SO7_Serial.m_RecvData[14] << 16 | + m_SO7_Serial.m_RecvData[15] << 8 | m_SO7_Serial.m_RecvData[16]) * m_Resolution[4]; else - m_PosForAllAxis[4] = (m_SO7_Serial.m_RecvData[29] << 24 | m_SO7_Serial.m_RecvData[30] << 16 | m_SO7_Serial.m_RecvData[31] << 8 | m_SO7_Serial.m_RecvData[32]) * m_Resolution[4]; + m_PosForAllAxis[4] = (m_SO7_Serial.m_RecvData[29] << 24 | m_SO7_Serial.m_RecvData[30] << 16 | + m_SO7_Serial.m_RecvData[31] << 8 | m_SO7_Serial.m_RecvData[32]) * m_Resolution[4]; } else { - PositionX = (m_SO7_Serial.m_RecvData[1] << 24 | m_SO7_Serial.m_RecvData[2] << 16 | m_SO7_Serial.m_RecvData[3] << 8 | m_SO7_Serial.m_RecvData[4]) * m_Resolution[1]; - PositionY = (m_SO7_Serial.m_RecvData[21] << 24 | m_SO7_Serial.m_RecvData[22] << 16 | m_SO7_Serial.m_RecvData[23] << 8 | m_SO7_Serial.m_RecvData[24]) * m_Resolution[2]; - PositionZ = (m_SO7_Serial.m_RecvData[25] << 24 | m_SO7_Serial.m_RecvData[26] << 16 | m_SO7_Serial.m_RecvData[27] << 8 | m_SO7_Serial.m_RecvData[28]) * m_Resolution[3]; + PositionX = (m_SO7_Serial.m_RecvData[1] << 24 | m_SO7_Serial.m_RecvData[2] << 16 | m_SO7_Serial. + m_RecvData[3] << 8 | m_SO7_Serial.m_RecvData[4]) * m_Resolution[1]; + PositionY = (m_SO7_Serial.m_RecvData[21] << 24 | m_SO7_Serial.m_RecvData[22] << 16 | m_SO7_Serial. + m_RecvData[23] << 8 | m_SO7_Serial.m_RecvData[24]) * m_Resolution[2]; + PositionZ = (m_SO7_Serial.m_RecvData[25] << 24 | m_SO7_Serial.m_RecvData[26] << 16 | m_SO7_Serial. + m_RecvData[27] << 8 | m_SO7_Serial.m_RecvData[28]) * m_Resolution[3]; } m_EncPos[1] = PositionX; m_EncPos[2] = PositionY; @@ -1971,8 +2101,9 @@ HSI_STATUS HSI_Motion::GetPositionXyz(UINT AxisTypes, double &PositionX, double } return rStatus; } + //=========================================================================== -HSI_STATUS HSI_Motion::GetEncoderXyz(long *lEncoderVal) +HSI_STATUS HSI_Motion::GetEncoderXyz(long* lEncoderVal) { auto rStatus = HSI_STATUS_NORMAL; //ȡ3ıֵ @@ -1983,23 +2114,32 @@ HSI_STATUS HSI_Motion::GetEncoderXyz(long *lEncoderVal) if (m_DeviceType != 1) { if (m_IsHavePattern & 0x01) - lEncoderVal[0] = (m_SO7_Serial.m_RecvData[1] << 24 | m_SO7_Serial.m_RecvData[2] << 16 | m_SO7_Serial.m_RecvData[3] << 8 | m_SO7_Serial.m_RecvData[4]); + lEncoderVal[0] = (m_SO7_Serial.m_RecvData[1] << 24 | m_SO7_Serial.m_RecvData[2] << 16 | m_SO7_Serial + .m_RecvData[3] << 8 | m_SO7_Serial.m_RecvData[4]); else - lEncoderVal[0] = (m_SO7_Serial.m_RecvData[17] << 24 | m_SO7_Serial.m_RecvData[18] << 16 | m_SO7_Serial.m_RecvData[19] << 8 | m_SO7_Serial.m_RecvData[20]); + lEncoderVal[0] = (m_SO7_Serial.m_RecvData[17] << 24 | m_SO7_Serial.m_RecvData[18] << 16 | + m_SO7_Serial.m_RecvData[19] << 8 | m_SO7_Serial.m_RecvData[20]); if (m_IsHavePattern & 0x02) - lEncoderVal[1] = (m_SO7_Serial.m_RecvData[5] << 24 | m_SO7_Serial.m_RecvData[6] << 16 | m_SO7_Serial.m_RecvData[7] << 8 | m_SO7_Serial.m_RecvData[8]); + lEncoderVal[1] = (m_SO7_Serial.m_RecvData[5] << 24 | m_SO7_Serial.m_RecvData[6] << 16 | m_SO7_Serial + .m_RecvData[7] << 8 | m_SO7_Serial.m_RecvData[8]); else - lEncoderVal[1] = (m_SO7_Serial.m_RecvData[21] << 24 | m_SO7_Serial.m_RecvData[22] << 16 | m_SO7_Serial.m_RecvData[23] << 8 | m_SO7_Serial.m_RecvData[24]); + lEncoderVal[1] = (m_SO7_Serial.m_RecvData[21] << 24 | m_SO7_Serial.m_RecvData[22] << 16 | + m_SO7_Serial.m_RecvData[23] << 8 | m_SO7_Serial.m_RecvData[24]); if (m_IsHavePattern & 0x04) - lEncoderVal[2] = (m_SO7_Serial.m_RecvData[9] << 24 | m_SO7_Serial.m_RecvData[10] << 16 | m_SO7_Serial.m_RecvData[11] << 8 | m_SO7_Serial.m_RecvData[12]); + lEncoderVal[2] = (m_SO7_Serial.m_RecvData[9] << 24 | m_SO7_Serial.m_RecvData[10] << 16 | + m_SO7_Serial.m_RecvData[11] << 8 | m_SO7_Serial.m_RecvData[12]); else - lEncoderVal[2] = (m_SO7_Serial.m_RecvData[25] << 24 | m_SO7_Serial.m_RecvData[26] << 16 | m_SO7_Serial.m_RecvData[27] << 8 | m_SO7_Serial.m_RecvData[28]); + lEncoderVal[2] = (m_SO7_Serial.m_RecvData[25] << 24 | m_SO7_Serial.m_RecvData[26] << 16 | + m_SO7_Serial.m_RecvData[27] << 8 | m_SO7_Serial.m_RecvData[28]); } else { - lEncoderVal[0] = (m_SO7_Serial.m_RecvData[1] << 24 | m_SO7_Serial.m_RecvData[2] << 16 | m_SO7_Serial.m_RecvData[3] << 8 | m_SO7_Serial.m_RecvData[4]); - lEncoderVal[1] = (m_SO7_Serial.m_RecvData[21] << 24 | m_SO7_Serial.m_RecvData[22] << 16 | m_SO7_Serial.m_RecvData[23] << 8 | m_SO7_Serial.m_RecvData[24]); - lEncoderVal[2] = (m_SO7_Serial.m_RecvData[25] << 24 | m_SO7_Serial.m_RecvData[26] << 16 | m_SO7_Serial.m_RecvData[27] << 8 | m_SO7_Serial.m_RecvData[28]); + lEncoderVal[0] = (m_SO7_Serial.m_RecvData[1] << 24 | m_SO7_Serial.m_RecvData[2] << 16 | m_SO7_Serial. + m_RecvData[3] << 8 | m_SO7_Serial.m_RecvData[4]); + lEncoderVal[1] = (m_SO7_Serial.m_RecvData[21] << 24 | m_SO7_Serial.m_RecvData[22] << 16 | m_SO7_Serial. + m_RecvData[23] << 8 | m_SO7_Serial.m_RecvData[24]); + lEncoderVal[2] = (m_SO7_Serial.m_RecvData[25] << 24 | m_SO7_Serial.m_RecvData[26] << 16 | m_SO7_Serial. + m_RecvData[27] << 8 | m_SO7_Serial.m_RecvData[28]); } } else @@ -2010,8 +2150,10 @@ HSI_STATUS HSI_Motion::GetEncoderXyz(long *lEncoderVal) } return rStatus; } + //=========================================================================== -HSI_STATUS HSI_Motion::GetPositionXyzaProbe(UINT AxisTypes, double &PositionX, double &PositionY, double &PositionZ, double &PositionA) +HSI_STATUS HSI_Motion::GetPositionXyzaProbe(UINT AxisTypes, double& PositionX, double& PositionY, double& PositionZ, + double& PositionA) { auto rStatus = HSI_STATUS_NORMAL; UNREFERENCED_PARAMETER(AxisTypes); @@ -2024,16 +2166,19 @@ HSI_STATUS HSI_Motion::GetPositionXyzaProbe(UINT AxisTypes, double &PositionX, d } return rStatus; } + //=========================================================================== -HSI_STATUS HSI_Motion::SetPositionXyz(UINT AxisTypes, double PositionX, double PositionY, double PositionZ, HSI_MOTION_MOVE_TYPE eType, double dFlyRadius) +HSI_STATUS HSI_Motion::SetPositionXyz(UINT AxisTypes, double PositionX, double PositionY, double PositionZ, + HSI_MOTION_MOVE_TYPE eType, double dFlyRadius) { WaitForSingleObject(g_WR_ToMove_Mutex, INFINITE); auto rStatus = HSI_STATUS_NORMAL; if (g_pHSI_Motion) { g_pLogger->SendAndFlushWithTime(L"[SetPositionXyz] In\n"); - g_pLogger->SendAndFlushWithTime(L"[SetPositionXyz] Pos[1] = %.4f,Pos[2] = %.4f,Pos[3] = %.4f\n", PositionX, PositionY, PositionZ); - unsigned char send_pos_data[64] = { 0 }; + g_pLogger->SendAndFlushWithTime(L"[SetPositionXyz] Pos[1] = %.4f,Pos[2] = %.4f,Pos[3] = %.4f\n", PositionX, + PositionY, PositionZ); + unsigned char send_pos_data[64] = {0}; axis_start = 0; unsigned char direct_pos = 0; unsigned char xyzAxis = 0; @@ -2045,7 +2190,7 @@ HSI_STATUS HSI_Motion::SetPositionXyz(UINT AxisTypes, double PositionX, double LimitOver(HSI_MOTION_AXIS_Z, PositionZ); LimitOver(HSI_MOTION_AXIS_R, m_PositionA); - m_PosThread[1] = PositionX; + m_PosThread[1] = PositionX; //SetpositionXyzĿλ m_PosThread[2] = PositionY; m_PosThread[3] = PositionZ; m_PosThread[4] = m_PositionA; @@ -2055,74 +2200,90 @@ HSI_STATUS HSI_Motion::SetPositionXyz(UINT AxisTypes, double PositionX, double targetpos_n[3] = PositionZ; targetpos_n[4] = m_PositionA; - int Pos_t[5] = { 0 }; - int Pos_n[5] = { 0 }; - int Pos[5] = { 0 }; - int NowPos[5] = { 0 }; - int target_pos[5] = { 0 }; + int Pos_t[5] = {0}; + int Pos_n[5] = {0}; + int Pos[5] = {0}; + int NowPos[5] = {0}; + int target_pos[5] = {0}; if (m_SO7_Serial.m_RecvData[0] == 2) { if (m_DeviceType != 1) { if (m_IsHavePattern & 0x01 == 0x01) - NowPos[1] = (m_SO7_Serial.m_RecvData[1] << 24 | m_SO7_Serial.m_RecvData[2] << 16 | m_SO7_Serial.m_RecvData[3] << 8 | m_SO7_Serial.m_RecvData[4]); + NowPos[1] = (m_SO7_Serial.m_RecvData[1] << 24 | m_SO7_Serial.m_RecvData[2] << 16 | m_SO7_Serial. + m_RecvData[3] << 8 | m_SO7_Serial.m_RecvData[4]); else - NowPos[1] = (m_SO7_Serial.m_RecvData[17] << 24 | m_SO7_Serial.m_RecvData[18] << 16 | m_SO7_Serial.m_RecvData[19] << 8 | m_SO7_Serial.m_RecvData[20]); + NowPos[1] = (m_SO7_Serial.m_RecvData[17] << 24 | m_SO7_Serial.m_RecvData[18] << 16 | + m_SO7_Serial.m_RecvData[19] << 8 | m_SO7_Serial.m_RecvData[20]); if (m_IsHavePattern & 0x02) - NowPos[2] = (m_SO7_Serial.m_RecvData[5] << 24 | m_SO7_Serial.m_RecvData[6] << 16 | m_SO7_Serial.m_RecvData[7] << 8 | m_SO7_Serial.m_RecvData[8]); + NowPos[2] = (m_SO7_Serial.m_RecvData[5] << 24 | m_SO7_Serial.m_RecvData[6] << 16 | m_SO7_Serial. + m_RecvData[7] << 8 | m_SO7_Serial.m_RecvData[8]); else - NowPos[2] = (m_SO7_Serial.m_RecvData[21] << 24 | m_SO7_Serial.m_RecvData[22] << 16 | m_SO7_Serial.m_RecvData[23] << 8 | m_SO7_Serial.m_RecvData[24]); + NowPos[2] = (m_SO7_Serial.m_RecvData[21] << 24 | m_SO7_Serial.m_RecvData[22] << 16 | + m_SO7_Serial.m_RecvData[23] << 8 | m_SO7_Serial.m_RecvData[24]); if (m_IsHavePattern & 0x04) - NowPos[3] = (m_SO7_Serial.m_RecvData[9] << 24 | m_SO7_Serial.m_RecvData[10] << 16 | m_SO7_Serial.m_RecvData[11] << 8 | m_SO7_Serial.m_RecvData[12]); + NowPos[3] = (m_SO7_Serial.m_RecvData[9] << 24 | m_SO7_Serial.m_RecvData[10] << 16 | m_SO7_Serial + .m_RecvData[11] << 8 | m_SO7_Serial.m_RecvData[12]); else - NowPos[3] = (m_SO7_Serial.m_RecvData[25] << 24 | m_SO7_Serial.m_RecvData[26] << 16 | m_SO7_Serial.m_RecvData[27] << 8 | m_SO7_Serial.m_RecvData[28]); + NowPos[3] = (m_SO7_Serial.m_RecvData[25] << 24 | m_SO7_Serial.m_RecvData[26] << 16 | + m_SO7_Serial.m_RecvData[27] << 8 | m_SO7_Serial.m_RecvData[28]); if (m_IsHavePattern & 0x08) - NowPos[4] = (m_SO7_Serial.m_RecvData[13] << 24 | m_SO7_Serial.m_RecvData[14] << 16 | m_SO7_Serial.m_RecvData[15] << 8 | m_SO7_Serial.m_RecvData[16]); + NowPos[4] = (m_SO7_Serial.m_RecvData[13] << 24 | m_SO7_Serial.m_RecvData[14] << 16 | + m_SO7_Serial.m_RecvData[15] << 8 | m_SO7_Serial.m_RecvData[16]); else - NowPos[4] = (m_SO7_Serial.m_RecvData[29] << 24 | m_SO7_Serial.m_RecvData[30] << 16 | m_SO7_Serial.m_RecvData[31] << 8 | m_SO7_Serial.m_RecvData[32]); + NowPos[4] = (m_SO7_Serial.m_RecvData[29] << 24 | m_SO7_Serial.m_RecvData[30] << 16 | + m_SO7_Serial.m_RecvData[31] << 8 | m_SO7_Serial.m_RecvData[32]); } else { - NowPos[1] = (m_SO7_Serial.m_RecvData[1] << 24 | m_SO7_Serial.m_RecvData[2] << 16 | m_SO7_Serial.m_RecvData[3] << 8 | m_SO7_Serial.m_RecvData[4]); - NowPos[2] = (m_SO7_Serial.m_RecvData[21] << 24 | m_SO7_Serial.m_RecvData[22] << 16 | m_SO7_Serial.m_RecvData[23] << 8 | m_SO7_Serial.m_RecvData[24]); - NowPos[3] = (m_SO7_Serial.m_RecvData[25] << 24 | m_SO7_Serial.m_RecvData[26] << 16 | m_SO7_Serial.m_RecvData[27] << 8 | m_SO7_Serial.m_RecvData[28]); - NowPos[4] = (m_SO7_Serial.m_RecvData[13] << 24 | m_SO7_Serial.m_RecvData[14] << 16 | m_SO7_Serial.m_RecvData[15] << 8 | m_SO7_Serial.m_RecvData[16]); + NowPos[1] = (m_SO7_Serial.m_RecvData[1] << 24 | m_SO7_Serial.m_RecvData[2] << 16 | m_SO7_Serial. + m_RecvData[3] << 8 | m_SO7_Serial.m_RecvData[4]); + NowPos[2] = (m_SO7_Serial.m_RecvData[21] << 24 | m_SO7_Serial.m_RecvData[22] << 16 | m_SO7_Serial. + m_RecvData[23] << 8 | m_SO7_Serial.m_RecvData[24]); + NowPos[3] = (m_SO7_Serial.m_RecvData[25] << 24 | m_SO7_Serial.m_RecvData[26] << 16 | m_SO7_Serial. + m_RecvData[27] << 8 | m_SO7_Serial.m_RecvData[28]); + NowPos[4] = (m_SO7_Serial.m_RecvData[13] << 24 | m_SO7_Serial.m_RecvData[14] << 16 | m_SO7_Serial. + m_RecvData[15] << 8 | m_SO7_Serial.m_RecvData[16]); } //NowPos[1] = (m_SO7_Serial.m_RecvData[1] << 24 | m_SO7_Serial.m_RecvData[2] << 16 | m_SO7_Serial.m_RecvData[3] << 8 | m_SO7_Serial.m_RecvData[4]); //NowPos[2] = (m_SO7_Serial.m_RecvData[5] << 24 | m_SO7_Serial.m_RecvData[6] << 16 | m_SO7_Serial.m_RecvData[7] << 8 | m_SO7_Serial.m_RecvData[8]); //NowPos[3] = (m_SO7_Serial.m_RecvData[9] << 24 | m_SO7_Serial.m_RecvData[10] << 16 | m_SO7_Serial.m_RecvData[11] << 8 | m_SO7_Serial.m_RecvData[12]); //NowPos[4] = (m_SO7_Serial.m_RecvData[13] << 24 | m_SO7_Serial.m_RecvData[14] << 16 | m_SO7_Serial.m_RecvData[15] << 8 | m_SO7_Serial.m_RecvData[16]); - Pos_t[1] = (m_SO7_Serial.m_RecvData[17] << 24 | m_SO7_Serial.m_RecvData[18] << 16 | m_SO7_Serial.m_RecvData[19] << 8 | m_SO7_Serial.m_RecvData[20]); - Pos_t[2] = (m_SO7_Serial.m_RecvData[21] << 24 | m_SO7_Serial.m_RecvData[22] << 16 | m_SO7_Serial.m_RecvData[23] << 8 | m_SO7_Serial.m_RecvData[24]); - Pos_t[3] = (m_SO7_Serial.m_RecvData[25] << 24 | m_SO7_Serial.m_RecvData[26] << 16 | m_SO7_Serial.m_RecvData[27] << 8 | m_SO7_Serial.m_RecvData[28]); - Pos_t[4] = (m_SO7_Serial.m_RecvData[29] << 24 | m_SO7_Serial.m_RecvData[30] << 16 | m_SO7_Serial.m_RecvData[31] << 8 | m_SO7_Serial.m_RecvData[32]); + Pos_t[1] = (m_SO7_Serial.m_RecvData[17] << 24 | m_SO7_Serial.m_RecvData[18] << 16 | m_SO7_Serial. + m_RecvData[19] << 8 | m_SO7_Serial.m_RecvData[20]); + Pos_t[2] = (m_SO7_Serial.m_RecvData[21] << 24 | m_SO7_Serial.m_RecvData[22] << 16 | m_SO7_Serial. + m_RecvData[23] << 8 | m_SO7_Serial.m_RecvData[24]); + Pos_t[3] = (m_SO7_Serial.m_RecvData[25] << 24 | m_SO7_Serial.m_RecvData[26] << 16 | m_SO7_Serial. + m_RecvData[27] << 8 | m_SO7_Serial.m_RecvData[28]); + Pos_t[4] = (m_SO7_Serial.m_RecvData[29] << 24 | m_SO7_Serial.m_RecvData[30] << 16 | m_SO7_Serial. + m_RecvData[31] << 8 | m_SO7_Serial.m_RecvData[32]); } else { - Pos_t[1] = NowPos[1] = (int)(m_EncPos[1] / m_Resolution[1]); - Pos_t[2] = NowPos[2] = (int)(m_EncPos[2] / m_Resolution[2]); - Pos_t[3] = NowPos[3] = (int)(m_EncPos[3] / m_Resolution[3]); - Pos_t[4] = NowPos[4] = (int)(m_EncPos[4] / m_Resolution[4]); + Pos_t[1] = NowPos[1] = static_cast(m_EncPos[1] / m_Resolution[1]); + Pos_t[2] = NowPos[2] = static_cast(m_EncPos[2] / m_Resolution[2]); + Pos_t[3] = NowPos[3] = static_cast(m_EncPos[3] / m_Resolution[3]); + Pos_t[4] = NowPos[4] = static_cast(m_EncPos[4] / m_Resolution[4]); } if (m_motorType & 0x01) // - Pos[1] = (int)(PositionX / m_Resolution[1]) - NowPos[1]; + Pos[1] = static_cast(PositionX / m_Resolution[1]) - NowPos[1]; else - Pos[1] = (int)(PositionX / m_Resolution[1]) - Pos_t[1]; + Pos[1] = static_cast(PositionX / m_Resolution[1]) - Pos_t[1]; if (m_motorType & 0x02) // - Pos[2] = (int)(PositionX / m_Resolution[2]) - NowPos[2]; + Pos[2] = static_cast(PositionX / m_Resolution[2]) - NowPos[2]; else - Pos[2] = (int)(PositionY / m_Resolution[2]) - Pos_t[2]; + Pos[2] = static_cast(PositionY / m_Resolution[2]) - Pos_t[2]; if (m_motorType & 0x04) // - Pos[3] = (int)(PositionX / m_Resolution[3]) - NowPos[3]; + Pos[3] = static_cast(PositionX / m_Resolution[3]) - NowPos[3]; else - Pos[3] = (int)(PositionZ / m_Resolution[3]) - Pos_t[3]; + Pos[3] = static_cast(PositionZ / m_Resolution[3]) - Pos_t[3]; if (m_motorType & 0x08) // - Pos[4] = (int)(PositionX / m_Resolution[4]) - NowPos[4]; + Pos[4] = static_cast(PositionX / m_Resolution[4]) - NowPos[4]; else - Pos[4] = (int)(m_PositionA / m_Resolution[4]) - Pos_t[4]; + Pos[4] = static_cast(m_PositionA / m_Resolution[4]) - Pos_t[4]; /*if (m_motorType==1) { @@ -2174,20 +2335,20 @@ HSI_STATUS HSI_Motion::SetPositionXyz(UINT AxisTypes, double PositionX, double Pos[4] = (int)(m_PositionA / m_Resolution[4]) - NowPos[4]; } }*/ - target_pos[1] = (int)(PositionX / m_Resolution[1]); - target_pos[2] = (int)(PositionY / m_Resolution[2]); - target_pos[3] = (int)(PositionZ / m_Resolution[3]); - target_pos[4] = (int)(m_PositionA / m_Resolution[4]); + target_pos[1] = static_cast(PositionX / m_Resolution[1]); + target_pos[2] = static_cast(PositionY / m_Resolution[2]); + target_pos[3] = static_cast(PositionZ / m_Resolution[3]); + target_pos[4] = static_cast(m_PositionA / m_Resolution[4]); begin_position[1] = target_pos[1]; begin_position[2] = target_pos[2]; begin_position[3] = target_pos[3]; begin_position[4] = target_pos[4]; - float scale[4] = { 0 }; - int Stepdriverspeed[5] = { 0 }; - int StepStartspeed[5] = { 0 }; - int StepAcc[5] = { 0 }; + float scale[4] = {0}; + int Stepdriverspeed[5] = {0}; + int StepStartspeed[5] = {0}; + int StepAcc[5] = {0}; //if (Pos[1] > 0) direct_pos |= 0x01; //if (Pos[2] > 0) direct_pos |= 0x02; //if (Pos[3] > 0) direct_pos |= 0x04; @@ -2203,13 +2364,18 @@ HSI_STATUS HSI_Motion::SetPositionXyz(UINT AxisTypes, double PositionX, double } } //MaxPos = abs(MaxPos); - scale[0] = abs(Pos[1]) / (float)MaxPos; - scale[1] = abs(Pos[2]) / (float)MaxPos; - scale[2] = abs(Pos[3]) / (float)MaxPos; - scale[3] = abs(Pos[4]) / (float)MaxPos; + scale[0] = abs(Pos[1]) / static_cast(MaxPos); + scale[1] = abs(Pos[2]) / static_cast(MaxPos); + scale[2] = abs(Pos[3]) / static_cast(MaxPos); + scale[3] = abs(Pos[4]) / static_cast(MaxPos); - g_pLogger->SendAndFlushWithTime(L"[SetPositionXyzNowPos] Pos[1] = %.4f,Pos[2] = %.4f,Pos[3] = %.4f,Pos[4] = %.4f\n", NowPos[1] * m_Resolution[1], NowPos[2] * m_Resolution[2], NowPos[3] * m_Resolution[3], NowPos[4] * m_Resolution[4]); - g_pLogger->SendAndFlushWithTime(L"[SetPositionXyzTagPos] Pos[1] = %.4f,Pos[2] = %.4f,Pos[3] = %.4f,Pos[4] = %.4f\n", PositionX, PositionY, PositionZ, m_PositionA); + g_pLogger->SendAndFlushWithTime( + L"[SetPositionXyzNowPos] Pos[1] = %.4f,Pos[2] = %.4f,Pos[3] = %.4f,Pos[4] = %.4f\n", + NowPos[1] * m_Resolution[1], NowPos[2] * m_Resolution[2], NowPos[3] * m_Resolution[3], + NowPos[4] * m_Resolution[4]); + g_pLogger->SendAndFlushWithTime( + L"[SetPositionXyzTagPos] Pos[1] = %.4f,Pos[2] = %.4f,Pos[3] = %.4f,Pos[4] = %.4f\n", PositionX, + PositionY, PositionZ, m_PositionA); int stepinterpolation = 0x03; @@ -2341,7 +2507,7 @@ HSI_STATUS HSI_Motion::SetPositionXyz(UINT AxisTypes, double PositionX, double if (fourthAxisFlag) { fourthAxisFlag = false; - if (Pos[4] > 0) direct_pos |= 0x08; + if (Pos[4] > 0) direct_pos |= 0x08; if (abs(Pos[4]) > 20) axis_start |= 0x08; axisCount = 5; xyzAxis = AXIS_XYZU; @@ -2396,7 +2562,9 @@ HSI_STATUS HSI_Motion::SetPositionXyz(UINT AxisTypes, double PositionX, double send_pos_data[34] = ((Pos[i] >> 16) & 0xff); send_pos_data[35] = ((Pos[i] >> 24) & 0xff); - g_pLogger->SendAndFlushWithTime(L"[SetPositionXyz] m_SetPotion_StartSpeed[%d] = %d,m_SetPotion_DriveSpeed[%d] = %d\n", i, m_SetPotion_StartSpeed[i], i, m_SetPotion_DriveSpeed[i]); + g_pLogger->SendAndFlushWithTime( + L"[SetPositionXyz] m_SetPotion_StartSpeed[%d] = %d,m_SetPotion_DriveSpeed[%d] = %d\n", i, + m_SetPotion_StartSpeed[i], i, m_SetPotion_DriveSpeed[i]); //send_pos_data[32] = 0x21; /*}*/ @@ -2525,7 +2693,7 @@ HSI_STATUS HSI_Motion::SetPositionXyz(UINT AxisTypes, double PositionX, double g_IsClose = false; m_WriteByte = Send_Command(0, (const char*)send_pos_data, m_SendDataLength); set_start = GetTickCount(); - Sleep(3);// + Sleep(3); // if (eType == HSI_MOTION_MOVE_NOWAIT) { g_pLogger->SendAndFlushWithTime(L"[SetPositionXyz] Nowait SetEvent\n"); @@ -2559,10 +2727,11 @@ HSI_STATUS HSI_Motion::SetPositionXyz(UINT AxisTypes, double PositionX, double ReleaseMutex(g_WR_ToMove_Mutex); return rStatus; } + //=========================================================================== int HSI_Motion::CaculateStepMotorACC(int pos, int maxacc, int minacc) { - double mpos = (double)abs(pos) / 1000; + double mpos = static_cast(abs(pos)) / 1000; int acc = (mpos * mpos) / 20 + mpos / 2 + 8; if (acc < minacc) acc = minacc; @@ -2570,8 +2739,10 @@ int HSI_Motion::CaculateStepMotorACC(int pos, int maxacc, int minacc) acc = maxacc; return acc; } + //=========================================================================== -HSI_STATUS HSI_Motion::SetPositionXyza(UINT AxisTypes, double PositionX, double PositionY, double PositionZ, double PositionA, HSI_MOTION_MOVE_TYPE eType, double dFlyRadius) +HSI_STATUS HSI_Motion::SetPositionXyza(UINT AxisTypes, double PositionX, double PositionY, double PositionZ, + double PositionA, HSI_MOTION_MOVE_TYPE eType, double dFlyRadius) { auto rStatus = HSI_STATUS_NORMAL; if (g_pHSI_Motion) @@ -2583,8 +2754,9 @@ HSI_STATUS HSI_Motion::SetPositionXyza(UINT AxisTypes, double PositionX, double } return rStatus; } + //=========================================================================== -HSI_STATUS HSI_Motion::SetPositionXyzCache(UINT AxisTypes, HSI_MOTION_MOVE_TYPE eType, int DataCount, Point *CacheData) +HSI_STATUS HSI_Motion::SetPositionXyzCache(UINT AxisTypes, HSI_MOTION_MOVE_TYPE eType, int DataCount, Point* CacheData) { auto rStatus = HSI_STATUS_NORMAL; if (g_pHSI_Motion) @@ -2595,23 +2767,25 @@ HSI_STATUS HSI_Motion::SetPositionXyzCache(UINT AxisTypes, HSI_MOTION_MOVE_TYPE } return rStatus; } + //=========================================================================== -HSI_STATUS HSI_Motion::SetCircleInterpolate(double PositionX, double PositionY, double PositionZ) +HSI_STATUS HSI_Motion::SetCircleInterpolate(double PositionX, double PositionY, double PositionZ) { auto rStatus = HSI_STATUS_NORMAL; if (g_pHSI_Motion) { g_pLogger->SendAndFlushWithTime(L"SetCircleInterpolate : start\n"); bCircleRun = true; - iCircleRunPnt[1] = (int)(PositionX / m_Resolution[1]); - iCircleRunPnt[2] = (int)(PositionY / m_Resolution[2]); - iCircleRunPnt[3] = (int)(PositionZ / m_Resolution[3]); + iCircleRunPnt[1] = static_cast(PositionX / m_Resolution[1]); + iCircleRunPnt[2] = static_cast(PositionY / m_Resolution[2]); + iCircleRunPnt[3] = static_cast(PositionZ / m_Resolution[3]); g_pLogger->SendAndFlushWithTime(L"SetCircleInterpolate : end\n"); } return rStatus; } + //===========================̽ӿ================================================ -void HSI_Motion::ProbeRetractManDist(int RetractManDist) +void HSI_Motion::ProbeRetractManDist(int RetractManDist) { if (g_pHSI_Motion) { @@ -2620,7 +2794,7 @@ void HSI_Motion::ProbeRetractManDist(int RetractManDist) m_cSendData[2] = (RetractManDist >> 24 & 0xff); m_cSendData[3] = ((RetractManDist >> 16) & 0xff); m_cSendData[4] = ((RetractManDist >> 8) & 0xff); - m_cSendData[5] = ((RetractManDist)& 0xff); + m_cSendData[5] = ((RetractManDist) & 0xff); m_cSendData[6] = (m_ProbeReturnSpeed >> 8) & 0xff; m_cSendData[7] = m_ProbeReturnSpeed & 0xff; m_WriteByte = Send_Command(0, (const char*)m_cSendData, m_SendDataLength); @@ -2640,7 +2814,7 @@ HSI_STATUS HSI_Motion::JogProbe(UINT AxisTypes, double Speed) m_WriteByte = Send_Command(0, (const char*)m_cSendData, m_SendDataLength); Sleep(10); } - unsigned char send_probe_data[64] = { 0 }; + unsigned char send_probe_data[64] = {0}; unsigned char motionAxis = 0; unsigned char motionDir = 0; for (size_t i = 0; i < 3; i++) @@ -2682,10 +2856,11 @@ HSI_STATUS HSI_Motion::JogProbe(UINT AxisTypes, double Speed) int AccCurve(1); int DecCurve(1); int JogSpeed(1); - byte AxisNumber = (byte)IndexConvertAxis(i + 1); + byte AxisNumber = static_cast(IndexConvertAxis(i + 1)); m_Thread_State = HSI_THREAD_PAUSED; - JogSpeed = abs(SpeedPercent(AxisNumber, Speed, DriveSpeed, StartSpeed, AccLine, DecLine, AccCurve, DecCurve)); + JogSpeed = abs(SpeedPercent(AxisNumber, Speed, DriveSpeed, StartSpeed, AccLine, DecLine, AccCurve, + DecCurve)); send_probe_data[0] = CT_MOTOR; send_probe_data[1] = CT_MOTOR_SET; send_probe_data[2] = AxisNumber; @@ -2736,11 +2911,11 @@ HSI_STATUS HSI_Motion::JogProbe(UINT AxisTypes, double Speed) send_probe_data[7] = m_ProbeReturnSpeed & 0xff; m_WriteByte = Send_Command(0, (const char*)send_probe_data, m_SendDataLength); - Sleep(3);// - + Sleep(3); // } return rStatus; } + //=============================ȡ============================================== HSI_STATUS HSI_Motion::Load_EF3_Motion_Inifile(CString GoogolIniFile) { @@ -2750,13 +2925,13 @@ HSI_STATUS HSI_Motion::Load_EF3_Motion_Inifile(CString GoogolIniFile) CString csAppPath = GoogolIniFile; USES_CONVERSION; CString temp = L""; - CString strGear[5] = { L"GEAR0_", L"GEAR1_", L"GEAR2_", L"GEAR3_", L"GEAR4_" }; - CString axisNum[5] = { L"0", L"1", L"2", L"3", L"4" }; + CString strGear[5] = {L"GEAR0_", L"GEAR1_", L"GEAR2_", L"GEAR3_", L"GEAR4_"}; + CString axisNum[5] = {L"0", L"1", L"2", L"3", L"4"}; //жLogĿ¼Ƿڣھʹ - if (CreateDirectory(m_AppPath + L"\\Log", NULL)) + if (CreateDirectory(m_AppPath + L"\\Log", nullptr)) { g_pLogger->SendAndFlushWithTime(L"[Load_EF3_Motion_Inifile] Create Log Directory\n"); - CreateDirectory(m_AppPath + L"\\Log", NULL); + CreateDirectory(m_AppPath + L"\\Log", nullptr); } if (GetFileAttributes(GoogolIniFile) == -1) { @@ -2772,46 +2947,63 @@ HSI_STATUS HSI_Motion::Load_EF3_Motion_Inifile(CString GoogolIniFile) m_motorType = GetPrivateProfileInt(L"MOTORTYPE", L"SERVOMOTOR", 1, csAppPath); for (int i = 1; i < 5; i++) { - m_precisionCount[i] = GetPrivateProfileInt(L"PRECISION", L"PRECISION_COUNT_" + axisNum[i], 14000, csAppPath); - m_precisionTime[i] = (long)GetPrivateProfileInt(L"PRECISION", L"PRECISION_TIME_" + axisNum[i], 14000, csAppPath); - GetPrivateProfileString(L"RESOLUTION", L"SCALE_RESOLUTION_" + axisNum[i], L"0.0004", temp.GetBufferSetLength(50), 50, csAppPath); + m_precisionCount[i] = + GetPrivateProfileInt(L"PRECISION", L"PRECISION_COUNT_" + axisNum[i], 14000, csAppPath); //ؼ + m_precisionTime[i] = static_cast(GetPrivateProfileInt(L"PRECISION", L"PRECISION_TIME_" + axisNum[i], + 14000, + csAppPath)); //ʱʱ(0.1ms) + GetPrivateProfileString(L"RESOLUTION", L"SCALE_RESOLUTION_" + axisNum[i], L"0.0004", + temp.GetBufferSetLength(50), 50, csAppPath); m_Resolution[i] = (atof(T2A(temp))); - GetPrivateProfileString(L"LIMIT", L"NEG_WORKING_LIMIT_" + axisNum[i], L"-40", temp.GetBufferSetLength(50), 50, csAppPath); + GetPrivateProfileString(L"LIMIT", L"NEG_WORKING_LIMIT_" + axisNum[i], L"-40", temp.GetBufferSetLength(50), + 50, csAppPath); m_N_Work_Limit[i] = (atof(T2A(temp))); - GetPrivateProfileString(L"LIMIT", L"POS_WORKING_LIMIT_" + axisNum[i], L"160", temp.GetBufferSetLength(50), 50, csAppPath); + GetPrivateProfileString(L"LIMIT", L"POS_WORKING_LIMIT_" + axisNum[i], L"160", temp.GetBufferSetLength(50), + 50, csAppPath); m_P_Work_Limit[i] = (atof(T2A(temp))); - m_Home_Time[i] = (long)GetPrivateProfileInt(L"HOME", L"HOME_TIME_" + axisNum[i], 1500, csAppPath); + m_Home_Time[i] = static_cast(GetPrivateProfileInt(L"HOME", L"HOME_TIME_" + axisNum[i], 1500, + csAppPath)); m_Home_AddJogGears[i] = GetPrivateProfileInt(L"HOME", L"HOME_ADD_JOGCHOICE_" + axisNum[i], 100, csAppPath); m_Home_DecJogGears[i] = GetPrivateProfileInt(L"HOME", L"HOME_DEC_JOGCHOICE_" + axisNum[i], 100, csAppPath); - m_SetPotion_Count[i] = GetPrivateProfileInt(L"SET_POSITION_SPEED", L"SET_POSITION_COUNT_" + axisNum[i], 10, csAppPath); - m_SetPotion_DriveSpeed[i] = GetPrivateProfileInt(L"SET_POSITION_SPEED", L"SET_POTION_DRIVESPEED_" + axisNum[i], 100, csAppPath); + m_SetPotion_Count[i] = GetPrivateProfileInt(L"SET_POSITION_SPEED", L"SET_POSITION_COUNT_" + axisNum[i], 10, + csAppPath); + m_SetPotion_DriveSpeed[i] = GetPrivateProfileInt(L"SET_POSITION_SPEED", + L"SET_POTION_DRIVESPEED_" + axisNum[i], 100, csAppPath); m_SetPotion_DriveSpeed[i] = m_SetPotion_DriveSpeed[i] / (m_Resolution[i] * 50); - m_SetPotion_Line[i] = GetPrivateProfileInt(L"SET_POSITION_SPEED", L"SET_POTION_LINE_" + axisNum[i], 100, csAppPath); - m_SetPotion_StartSpeed[i] = GetPrivateProfileInt(L"SET_POSITION_SPEED", L"SET_POTION_STARTSPEED_" + axisNum[i], 100, csAppPath); + m_SetPotion_Line[i] = GetPrivateProfileInt(L"SET_POSITION_SPEED", L"SET_POTION_LINE_" + axisNum[i], 100, + csAppPath); + m_SetPotion_StartSpeed[i] = GetPrivateProfileInt(L"SET_POSITION_SPEED", + L"SET_POTION_STARTSPEED_" + axisNum[i], 100, csAppPath); m_SetPotion_StartSpeed[i] = m_SetPotion_StartSpeed[i] / (m_Resolution[i] * 500); - m_SetPotion_Buffer[i] = GetPrivateProfileInt(L"SET_POSITION_SPEED", L"SET_POTION_BUFFER_" + axisNum[i], 105, csAppPath); + m_SetPotion_Buffer[i] = GetPrivateProfileInt(L"SET_POSITION_SPEED", L"SET_POTION_BUFFER_" + axisNum[i], 105, + csAppPath); m_LogIsOpen[i] = GetPrivateProfileInt(L"LOG", L"LOG_IS_OPEN_" + axisNum[i], 0, csAppPath); m_Home_Machine_Axis[i] = GetPrivateProfileInt(L"HOME", L"HOME_MACHINE_AXIS_" + axisNum[i], 0, csAppPath); m_Home_Pos_Axis[i] = GetPrivateProfileInt(L"HOME", L"HOME_POS_AXIS_" + axisNum[i], 0, csAppPath); m_StopJogMode[i] = GetPrivateProfileInt(L"JOG_SPEED", L"JOG_STOP_MODE_" + axisNum[i], 0, csAppPath); - m_SpeedAdjustPeriod[i] = GetPrivateProfileInt(L"SET_POSITION_SPEED", L"SPEED_ADJUSTMENT_" + axisNum[i], 1, csAppPath); + m_SpeedAdjustPeriod[i] = GetPrivateProfileInt(L"SET_POSITION_SPEED", L"SPEED_ADJUSTMENT_" + axisNum[i], 1, + csAppPath); m_SpeedMax[i] = GetPrivateProfileInt(L"SET_POSITION_SPEED", L"SPEED_RUNMAX_" + axisNum[i], 150, csAppPath); } for (int i = 0; i < 5; i++) { for (int j = 1; j < 5; j++) { - GetPrivateProfileString(L"JOG_SPEED", L"JOG_DRIVESPEED_" + strGear[i] + axisNum[j], L"10", temp.GetBufferSetLength(50), 10, csAppPath); + GetPrivateProfileString(L"JOG_SPEED", L"JOG_DRIVESPEED_" + strGear[i] + axisNum[j], L"10", + temp.GetBufferSetLength(50), 10, csAppPath); float speed = (atof(T2A(temp))); //m_JogDriveSpeed[j][i] = GetPrivateProfileInt(L"JOG_SPEED", L"JOG_DRIVESPEED_" , 10, csAppPath); m_JogDriveSpeed[j][i] = speed / (m_Resolution[j] * 50); - GetPrivateProfileString(L"JOG_SPEED", L"JOG_STARTSPEED_" + strGear[i] + axisNum[j], L"10", temp.GetBufferSetLength(50), 10, csAppPath); + GetPrivateProfileString(L"JOG_SPEED", L"JOG_STARTSPEED_" + strGear[i] + axisNum[j], L"10", + temp.GetBufferSetLength(50), 10, csAppPath); speed = (atof(T2A(temp))); //m_JogStartSpeed[j][i] = GetPrivateProfileInt(L"JOG_SPEED", L"JOG_STARTSPEED_" + strGear[i] + axisNum[j], 10, csAppPath); m_JogStartSpeed[j][i] = speed / (m_Resolution[j] * 50); - m_JogAccLine[j][i] = GetPrivateProfileInt(L"JOG_SPEED", L"JOG_LINE_" + strGear[i] + axisNum[j], 10, csAppPath); - m_JogDecLine[j][i] = GetPrivateProfileInt(L"JOG_SPEED", L"JOG_LINE_" + strGear[i] + axisNum[j], 10, csAppPath); + m_JogAccLine[j][i] = GetPrivateProfileInt(L"JOG_SPEED", L"JOG_LINE_" + strGear[i] + axisNum[j], 10, + csAppPath); + m_JogDecLine[j][i] = GetPrivateProfileInt(L"JOG_SPEED", L"JOG_LINE_" + strGear[i] + axisNum[j], 10, + csAppPath); } } m_Jog_Auto_Focus = m_JogDriveSpeed[3][4]; @@ -2843,46 +3035,57 @@ HSI_STATUS HSI_Motion::Load_EF3_Motion_Inifile(CString GoogolIniFile) m_iSpeedType = GetPrivateProfileInt(L"SET_SPEED", L"SPEEDTYPE", 0, csAppPath); - CString comNum[5] = { L"0", L"1", L"2", L"3" }; + CString comNum[5] = {L"0", L"1", L"2", L"3"}; for (int i = 0; i < 4; i++) { - GetPrivateProfileString(L"ROCKER_SPEED", L"ROCKER_HSTARTSPEED_" + comNum[i], L"5", temp.GetBufferSetLength(50), 10, csAppPath); + GetPrivateProfileString(L"ROCKER_SPEED", L"ROCKER_HSTARTSPEED_" + comNum[i], L"5", + temp.GetBufferSetLength(50), 10, csAppPath); float speed = (atof(T2A(temp))); m_rockerHStartSpeed[i] = speed / (m_Resolution[i] * 50); - GetPrivateProfileString(L"ROCKER_SPEED", L"ROCKER_HDRIVESPEED_" + comNum[i], L"20", temp.GetBufferSetLength(50), 10, csAppPath); + GetPrivateProfileString(L"ROCKER_SPEED", L"ROCKER_HDRIVESPEED_" + comNum[i], L"20", + temp.GetBufferSetLength(50), 10, csAppPath); speed = (atof(T2A(temp))); m_rockerHDriveSpeed[i] = speed / (m_Resolution[i] * 50); - GetPrivateProfileString(L"ROCKER_SPEED", L"ROCKER_LSTARTSPEED_" + comNum[i], L"2", temp.GetBufferSetLength(50), 10, csAppPath); + GetPrivateProfileString(L"ROCKER_SPEED", L"ROCKER_LSTARTSPEED_" + comNum[i], L"2", + temp.GetBufferSetLength(50), 10, csAppPath); speed = (atof(T2A(temp))); m_rockerLStartSpeed[i] = speed / (m_Resolution[i] * 50); - GetPrivateProfileString(L"ROCKER_SPEED", L"ROCKER_LDRIVESPEED_" + comNum[i], L"10", temp.GetBufferSetLength(50), 10, csAppPath); + GetPrivateProfileString(L"ROCKER_SPEED", L"ROCKER_LDRIVESPEED_" + comNum[i], L"10", + temp.GetBufferSetLength(50), 10, csAppPath); speed = (atof(T2A(temp))); m_rockerLDriveSpeed[i] = speed / (m_Resolution[i] * 50); - GetPrivateProfileString(L"ROCKER_SPEED", L"ROCKER_ASPEED_" + comNum[i], L"100", temp.GetBufferSetLength(50), 10, csAppPath); + GetPrivateProfileString(L"ROCKER_SPEED", L"ROCKER_ASPEED_" + comNum[i], L"100", temp.GetBufferSetLength(50), + 10, csAppPath); m_rockerASpeed[i] = (atoi(T2A(temp))); - GetPrivateProfileString(L"ROCKER_SPEED", L"ROCKER_DSPEED_" + comNum[i], L"100", temp.GetBufferSetLength(50), 10, csAppPath); + GetPrivateProfileString(L"ROCKER_SPEED", L"ROCKER_DSPEED_" + comNum[i], L"100", temp.GetBufferSetLength(50), + 10, csAppPath); m_rockerDSpeed[i] = (atoi(T2A(temp))); } - CString strAxis[10] = { L"0", L"1", L"2", L"3", L"4", L"5", L"6", L"7", L"8", L"9" }; + CString strAxis[10] = {L"0", L"1", L"2", L"3", L"4", L"5", L"6", L"7", L"8", L"9"}; for (int i = 0; i < 10; i++) { - m_stepPosition_L_speed[i] = GetPrivateProfileInt(L"STEPMOTORPOSITIONINIT", L"StepPositionLSpeed_" + strAxis[i], 1, csAppPath); + m_stepPosition_L_speed[i] = GetPrivateProfileInt(L"STEPMOTORPOSITIONINIT", + L"StepPositionLSpeed_" + strAxis[i], 1, csAppPath); m_stepPosition_L_speed[i] = m_stepPosition_L_speed[i] / (m_Resolution[1] * 50); - m_stepPosition_H_speed[i] = GetPrivateProfileInt(L"STEPMOTORPOSITIONINIT", L"StepPositionHSpeed_" + strAxis[i], 1, csAppPath); + m_stepPosition_H_speed[i] = GetPrivateProfileInt(L"STEPMOTORPOSITIONINIT", + L"StepPositionHSpeed_" + strAxis[i], 1, csAppPath); m_stepPosition_H_speed[i] = m_stepPosition_H_speed[i] / (m_Resolution[1] * 50); - m_stepPosition_Load[i] = GetPrivateProfileInt(L"STEPMOTORPOSITIONINIT", L"StepPositionLoad_" + strAxis[i], 1, csAppPath); + m_stepPosition_Load[i] = GetPrivateProfileInt(L"STEPMOTORPOSITIONINIT", L"StepPositionLoad_" + strAxis[i], + 1, csAppPath); m_stepPosition_Load[i] = m_stepPosition_Load[i] / (m_Resolution[1]); - m_stepPosition_acc[i] = GetPrivateProfileInt(L"STEPMOTORPOSITIONINIT", L"StepPositionAcc_" + strAxis[i], 1, csAppPath); + m_stepPosition_acc[i] = GetPrivateProfileInt(L"STEPMOTORPOSITIONINIT", L"StepPositionAcc_" + strAxis[i], 1, + csAppPath); } - CString SubArea[8] = { L"0", L"1", L"2", L"3", L"4", L"5", L"6", L"7" }; + CString SubArea[8] = {L"0", L"1", L"2", L"3", L"4", L"5", L"6", L"7"}; for (int i = 0; i < 8; i++) { - m_SixEightSubArea[i] = GetPrivateProfileInt(L"SIXEIGHTSUBAREA", L"SIXEIGHT_SUBARE_" + SubArea[i], 0, csAppPath); + m_SixEightSubArea[i] = GetPrivateProfileInt(L"SIXEIGHTSUBAREA", L"SIXEIGHT_SUBARE_" + SubArea[i], 0, + csAppPath); } - } return rStatus; } + //=========================================================================== HSI_STATUS HSI_Motion::Load_EF3_Config_Inifile(CString GoogolIniFile) { @@ -2920,20 +3123,20 @@ HSI_STATUS HSI_Motion::Load_EF3_Config_Inifile(CString GoogolIniFile) m_IsUseTwentySixLight = GetPrivateProfileInt(L"FUNCTION", L"IS_USETWENTYSIXLIGHT", 0, csAppPath); m_EF3LightType = GetPrivateProfileInt(L"FUNCTION", L"IS_LIGHTTYPE", 1, csAppPath); m_IsCollectPos = GetPrivateProfileInt(L"FUNCTION", L"IS_COLLECT_POS", 0, csAppPath); - m_IsLightDebug = GetPrivateProfileInt(L"FUNCTION", L"IS_LIGHT_DEBUG", 0, csAppPath); + m_IsLightDebug = GetPrivateProfileInt(L"FUNCTION", L"IS_LIGHT_DEBUG", 0, csAppPath); - m_IsIOFuntion = GetPrivateProfileInt(L"IO", L"IS_IO_FUNTION", 0, csAppPath); + m_IsIOFuntion = GetPrivateProfileInt(L"IO", L"IS_IO_FUNTION", 0, csAppPath); //ǷIOܣ1Ϊã0ΪرգĬ0 m_IsStartInput = GetPrivateProfileInt(L"IO", L"IS_START_INPUT", 0, csAppPath); m_StartInputPort = GetPrivateProfileInt(L"IO", L"START_INPUT_PORT", 1, csAppPath); - m_IsProbe = GetPrivateProfileInt(L"PROBE", L"IS_PROBE", 0, csAppPath); + m_IsProbe = GetPrivateProfileInt(L"PROBE", L"IS_PROBE", 0, csAppPath); // Ƿ̽벶ܣ1ãĬ0ر m_ProbeAllAxis = GetPrivateProfileInt(L"PROBE", L"PROBE_All_AXIS", 3, csAppPath); m_ProbeReturnSpeed = GetPrivateProfileInt(L"PROBE", L"PROBE_RETURN_SPEED", 40, csAppPath); m_ProbeReturnSpeed = m_ProbeReturnSpeed * 50; GetPrivateProfileString(L"PROBE", L"PROBE_RETURN_POS", L"10.0", temp.GetBufferSetLength(50), 50, csAppPath); m_ProbeReturnPos = atof(T2A(temp)); - m_IsUseRocker = GetPrivateProfileInt(L"ROCKER", L"IS_USEROCKER", 0, csAppPath); + m_IsUseRocker = GetPrivateProfileInt(L"ROCKER", L"IS_USEROCKER", 0, csAppPath); //Ƿҡ˹ 0 1Ϊ ĬΪ0 m_IsCloseRocker = GetPrivateProfileInt(L"ROCKER", L"IS_CLOSEROCKER", 0, csAppPath); m_bISUseMoreLights = GetPrivateProfileInt(L"IPADDRESS", L"IS_USENUM", 0, csAppPath); @@ -2947,10 +3150,11 @@ HSI_STATUS HSI_Motion::Load_EF3_Config_Inifile(CString GoogolIniFile) m_UseAxisNum = GetPrivateProfileInt(L"DEVICE", L"USE_AXISNUM", 0, csAppPath); m_iJoyStick = GetPrivateProfileInt(L"JOYSTICK", L"JOY_STICK_TYPE", 0, csAppPath); - CString comNum[5] = { L"0", L"1", L"2", L"3" }; + CString comNum[5] = {L"0", L"1", L"2", L"3"}; for (int i = 0; i < 4; i++) { - GetPrivateProfileString(L"IPADDRESS", L"IP_ADDRESS_" + comNum[i], L"192.168.0.1", temp.GetBufferSetLength(50), 50, csAppPath); + GetPrivateProfileString(L"IPADDRESS", L"IP_ADDRESS_" + comNum[i], L"192.168.0.1", + temp.GetBufferSetLength(50), 50, csAppPath); m_IsOpenTCPIP[i] = temp; temp = temp.Trim(); int iNext = temp.Find(':'); @@ -2966,8 +3170,9 @@ HSI_STATUS HSI_Motion::Load_EF3_Config_Inifile(CString GoogolIniFile) } return rStatus; } + //===============================ȡ/ùդ߾============================================ -HSI_STATUS HSI_Motion::GetScaleResolution(double &_ScaleX, double &_ScaleY, double &_ScaleZ) +HSI_STATUS HSI_Motion::GetScaleResolution(double& _ScaleX, double& _ScaleY, double& _ScaleZ) { auto rStatus = HSI_STATUS_NORMAL; if (g_pHSI_Motion) @@ -2978,29 +3183,31 @@ HSI_STATUS HSI_Motion::GetScaleResolution(double &_ScaleX, double &_ScaleY, doub } return rStatus; } + //=========================================================================== HSI_STATUS HSI_Motion::SetScaleResolution(double _ScaleX, double _ScaleY, double _ScaleZ) { auto rStatus = HSI_STATUS_NORMAL; if (g_pHSI_Motion) { - m_Resolution[1] = (int)(_ScaleX * 10000); - m_Resolution[2] = (int)(_ScaleY * 10000); - m_Resolution[3] = (int)(_ScaleZ * 10000); + m_Resolution[1] = static_cast(_ScaleX * 10000); + m_Resolution[2] = static_cast(_ScaleY * 10000); + m_Resolution[3] = static_cast(_ScaleZ * 10000); } return rStatus; } -//============================صλ=============================================== + +//============================λ¼=============================================== void HSI_Motion::SendMsgMotionFinished() { sEvenProp.Init(); sEvenProp.EventType = HSI_EVENT_FUNCTION; - sEvenProp.EventID = HSI_EVENT_MOVE_POINT; + sEvenProp.EventID = HSI_EVENT_MOVE_POINT; //λ¼ sEvenProp.EventResponse = HSI_EVENT_FUNCTION_OK; EventCallback(sEvenProp); } -//=============================ص̽============================================== +//=============================ص̽¼============================================== void HSI_Motion::SendMsgProbeFinished() { sEvenProp.Init(); @@ -3009,6 +3216,7 @@ void HSI_Motion::SendMsgProbeFinished() sEvenProp.EventResponse = HSI_EVENT_FUNCTION_OK; EventCallback(sEvenProp); } + //=========================================================================== void HSI_Motion::UpdateMotionState() { @@ -3042,14 +3250,14 @@ void HSI_Motion::UpdateMotionState() break; } //else if ((m_SO7_Serial.m_RecvData[39] == 0x07))//axis_start - else if ((m_SO7_Serial.m_RecvData[39] == axis_start)/* &&(m_motorType == 0)*/) + if ((m_SO7_Serial.m_RecvData[39] == axis_start)/* &&(m_motorType == 0)*/) { m_SO7_Serial.m_RecvData[39] = 0; SpCompleteTStart = GetTickCount(); interpolationflag = true; break; } - else if (m_SO7_Serial.m_RecvData[39] & 0x20) + if (m_SO7_Serial.m_RecvData[39] & 0x20) { m_SO7_Serial.m_RecvData[39] = 0; timeoutflag = true; @@ -3063,27 +3271,34 @@ void HSI_Motion::UpdateMotionState() timeoutflag = true; break; } - } while (true); + } + while (true); g_pLogger->SendAndFlushWithTime(L"[UpdateMotionState] Nowait Run End\n"); - unsigned int tempPrecision[5] = { 0, m_precisionCount[1], m_precisionCount[2], m_precisionCount[3], m_precisionCount[4] }; - tempPrecision[1] = m_Home_Machine_Axis[1] == 0 ? 10000000 : m_precisionCount[1]; + unsigned int tempPrecision[5] = { + 0, m_precisionCount[1], m_precisionCount[2], m_precisionCount[3], m_precisionCount[4] + }; + tempPrecision[1] = m_Home_Machine_Axis[1] == 0 ? 10000000 : m_precisionCount[1]; //ʱҪԭѡ,ȡؼ tempPrecision[2] = m_Home_Machine_Axis[2] == 0 ? 10000000 : m_precisionCount[2]; tempPrecision[3] = m_Home_Machine_Axis[3] == 0 ? 10000000 : m_precisionCount[3]; tempPrecision[4] = m_Home_Machine_Axis[4] == 0 ? 10000000 : m_precisionCount[4]; int i = 0, j = 0; unsigned long Count = 0; - double prfpos[5] = { 0 }; + double prfpos[5] = {0}; //GetPositionEncPrfMulti(1, m_EncPos, m_PrfPos, 4); //double EncPos[5] = { 0.0 }; // double ProPulse[5] = { 0.0 }; - if (interpolationflag&&m_motorType) + if (interpolationflag && m_motorType) { - while (Count < m_SetPotion_Count[1])//λж + while (Count < m_SetPotion_Count[1]) //λж { Sleep(2); GetPositionXyz(HSI_MOTION_AXIS_ALL, prfpos[1], prfpos[2], prfpos[3], prfpos[0]); - if ((fabs(m_PosThread[1] - prfpos[1]) <= tempPrecision[1] * m_Resolution[1]) && (fabs(m_PosThread[2] - prfpos[2]) <= tempPrecision[2] * m_Resolution[2]) && (fabs(m_PosThread[3] - prfpos[3]) <= tempPrecision[3] * m_Resolution[3]) && (fabs(m_PosThread[4] - m_PosForAllAxis[4]) <= tempPrecision[4] * m_Resolution[4])) + //Ŀλ ͵ǰλ Сڻؼ + if ((fabs(m_PosThread[1] - prfpos[1]) <= tempPrecision[1] * m_Resolution[1]) && ( + fabs(m_PosThread[2] - prfpos[2]) <= tempPrecision[2] * m_Resolution[2]) && ( + fabs(m_PosThread[3] - prfpos[3]) <= tempPrecision[3] * m_Resolution[3]) && (fabs( + m_PosThread[4] - m_PosForAllAxis[4]) <= tempPrecision[4] * m_Resolution[4])) { i++; if (m_SetPotion_Count[1] > m_setPositionNum) @@ -3104,7 +3319,7 @@ void HSI_Motion::UpdateMotionState() { } Count++; - g_pLogger->SendAndFlushWithTime(L"[UpdateMotionState] m_SetPotion_Count = %d\n", Count); + g_pLogger->SendAndFlushWithTime(L"[UpdateMotionState] m_SetPotion_Count = %d\n", Count); //ӡλ } //if (Count == m_SetPotion_Count[1]) //ʱ˳ //{ @@ -3128,7 +3343,8 @@ void HSI_Motion::UpdateMotionState() { SpCompleteTEnd = GetTickCount(); SpTimeCount = SpCompleteTEnd - SpCompleteTStart; - double dis = pow(m_PrfPos[1] - m_EncPos[1], 2.0) + pow(m_PrfPos[2] - m_EncPos[2], 2.0) + pow(m_PrfPos[3] - m_EncPos[3], 2.0); + double dis = pow(m_PrfPos[1] - m_EncPos[1], 2.0) + pow(m_PrfPos[2] - m_EncPos[2], 2.0) + pow( + m_PrfPos[3] - m_EncPos[3], 2.0); if (dis > 0) { PntToPntDistance = sqrt(dis); @@ -3139,9 +3355,12 @@ void HSI_Motion::UpdateMotionState() } SetPotionRunEnd = true; } - g_pLogger->SendAndFlushWithTime(L"[UpdateMotionState] m_PosThread[1] = %.4f,m_PosThread[2] = %.4f,m_PosThread[3] = %.4f\n", m_PosThread[1], m_PosThread[2], m_PosThread[3]); - g_pLogger->SendAndFlushWithTime(L"[UpdateMotionState] Pos[1] = %.4f,Pos[2] = %.4f,Pos[3] = %.4f\n", prfpos[1], prfpos[2], prfpos[3]); - if (timeoutflag) + g_pLogger->SendAndFlushWithTime( + L"[UpdateMotionState] m_PosThread[1] = %.4f,m_PosThread[2] = %.4f,m_PosThread[3] = %.4f\n", + m_PosThread[1], m_PosThread[2], m_PosThread[3]); + g_pLogger->SendAndFlushWithTime(L"[UpdateMotionState] Pos[1] = %.4f,Pos[2] = %.4f,Pos[3] = %.4f\n", + prfpos[1], prfpos[2], prfpos[3]); + if (timeoutflag) //λʱ { g_pLogger->SendAndFlushWithTime(L"[UpdateMotionState] Nowait Timeout\n"); sEvenProp.Init(); @@ -3153,16 +3372,17 @@ void HSI_Motion::UpdateMotionState() } switch (CurrentMotionState) { - case E_SO7_MOTION_MOVETO: + case E_SO7_MOTION_MOVETO: { - g_pLogger->SendAndFlushWithTime(L"[UpdateMotionState] Nowait CurrentMotionState E_SO7_MOTION_MOVETO\n"); + g_pLogger->SendAndFlushWithTime( + L"[UpdateMotionState] Nowait CurrentMotionState E_SO7_MOTION_MOVETO\n"); m_Thread_State = HSI_THREAD_PAUSED; CurrentMotionState = E_SO7_MOTION_NONE; m_IsExMotion = 2; SendMsgMotionFinished(); break; } - default: + default: { g_pLogger->SendAndFlushWithTime(L"[UpdateMotionState] Nowait CurrentMotionState default\n"); break; @@ -3172,6 +3392,7 @@ void HSI_Motion::UpdateMotionState() g_pLogger->SendAndFlushWithTime(L"[UpdateMotionState] Out\n"); } } + //=========================================================================== void HSI_Motion::UpdateMotionStateEx() { @@ -3182,6 +3403,7 @@ void HSI_Motion::UpdateMotionStateEx() g_pLogger->SendAndFlushWithTime(L"[UpdateMotionStateEx] Out\n"); } } + //=========================================================================== void HSI_Motion::UpdateMotionStateIO() { @@ -3263,7 +3485,8 @@ void HSI_Motion::UpdateMotionStateIO() } } } -//=========================================================================== + +//========================ȡ˶״̬=================================================== void HSI_Motion::UpdateMotionStateData() { while (m_Thread_StateData == HSI_THREAD_RUNNING) @@ -3277,11 +3500,10 @@ void HSI_Motion::UpdateMotionStateData() } else { - } - } } + //=========================================================================== void HSI_Motion::UpdateMotionStateProbe() { @@ -3306,11 +3528,14 @@ void HSI_Motion::UpdateMotionStateProbe() //Beep(300,1000); //printf("\a"); // m_SO7_Serial.m_RecvData[57] = 0; - m_LockPos[1] = (m_SO7_Serial.m_RecvData[41] << 24 | m_SO7_Serial.m_RecvData[42] << 16 | m_SO7_Serial.m_RecvData[43] << 8 | m_SO7_Serial.m_RecvData[44])*m_Resolution[1]; - m_LockPos[2] = (m_SO7_Serial.m_RecvData[45] << 24 | m_SO7_Serial.m_RecvData[46] << 16 | m_SO7_Serial.m_RecvData[47] << 8 | m_SO7_Serial.m_RecvData[48])*m_Resolution[2]; - m_LockPos[3] = (m_SO7_Serial.m_RecvData[49] << 24 | m_SO7_Serial.m_RecvData[50] << 16 | m_SO7_Serial.m_RecvData[51] << 8 | m_SO7_Serial.m_RecvData[52])*m_Resolution[3]; - m_LockPos[4] = (m_SO7_Serial.m_RecvData[53] << 24 | m_SO7_Serial.m_RecvData[54] << 16 | m_SO7_Serial.m_RecvData[55] << 8 | m_SO7_Serial.m_RecvData[56])*m_Resolution[4]; - continue; + m_LockPos[1] = (m_SO7_Serial.m_RecvData[41] << 24 | m_SO7_Serial.m_RecvData[42] << 16 | m_SO7_Serial. + m_RecvData[43] << 8 | m_SO7_Serial.m_RecvData[44]) * m_Resolution[1]; + m_LockPos[2] = (m_SO7_Serial.m_RecvData[45] << 24 | m_SO7_Serial.m_RecvData[46] << 16 | m_SO7_Serial. + m_RecvData[47] << 8 | m_SO7_Serial.m_RecvData[48]) * m_Resolution[2]; + m_LockPos[3] = (m_SO7_Serial.m_RecvData[49] << 24 | m_SO7_Serial.m_RecvData[50] << 16 | m_SO7_Serial. + m_RecvData[51] << 8 | m_SO7_Serial.m_RecvData[52]) * m_Resolution[3]; + m_LockPos[4] = (m_SO7_Serial.m_RecvData[53] << 24 | m_SO7_Serial.m_RecvData[54] << 16 | m_SO7_Serial. + m_RecvData[55] << 8 | m_SO7_Serial.m_RecvData[56]) * m_Resolution[4]; } else if (m_SO7_Serial.m_RecvData[57] == 2) { @@ -3319,15 +3544,14 @@ void HSI_Motion::UpdateMotionStateProbe() m_LockPos[2] = 0.0; m_LockPos[3] = 0.0; m_LockPos[4] = 0.0; - //m_SO7_Serial.m_RecvData[57] == 0; - continue; } else if (m_SO7_Serial.m_RecvData[57] == 3 && hitFlag) { Sleep(200); hitFlag = false; - double ProbeHitCompletePos[4] = { 0 }; - GetPositionXyz(0, ProbeHitCompletePos[0], ProbeHitCompletePos[1], ProbeHitCompletePos[2], ProbeHitCompletePos[3]); + double ProbeHitCompletePos[4] = {0}; + GetPositionXyz(0, ProbeHitCompletePos[0], ProbeHitCompletePos[1], ProbeHitCompletePos[2], + ProbeHitCompletePos[3]); m_ijk[0] = ProbeHitCompletePos[0]; m_ijk[1] = ProbeHitCompletePos[1]; m_ijk[2] = ProbeHitCompletePos[2]; @@ -3337,11 +3561,15 @@ void HSI_Motion::UpdateMotionStateProbe() } } } + //=========================================================================== void HSI_Motion::DoEvents() { MSG msg; - while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) + //ͺPeekMessageһǣGetMessage:ϵͳȡϢϢϵͳƳ + //ϵͳϢʱGetMessageȴһϢPeekMesssgeԲ鿴ķʽϵͳлȡϢԲϢϵͳƳ + //ǷϵͳϢʱFALSEִк + while (PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE)) { __try { @@ -3364,6 +3592,7 @@ void HSI_Motion::DoEvents() } } } + //=========================================================================== HSI_STATUS HSI_Motion::DriverAlarmStatus() { @@ -3376,6 +3605,7 @@ HSI_STATUS HSI_Motion::DriverAlarmStatus() } return rStatus; } + //=========================================================================== HSI_STATUS HSI_Motion::FirstHome() { @@ -3388,6 +3618,7 @@ HSI_STATUS HSI_Motion::FirstHome() } return rStatus; } + //=========================================================================== HSI_STATUS HSI_Motion::SpecialMotorHome(short AxisNum) { @@ -3400,6 +3631,7 @@ HSI_STATUS HSI_Motion::SpecialMotorHome(short AxisNum) } return rStatus; } + //=========================================================================== HSI_STATUS HSI_Motion::SpecialMotorMove(short AxisNumber, double Position) { @@ -3465,6 +3697,7 @@ HSI_STATUS HSI_Motion::GetDIO(UINT IOChannel, UINT& _Status) } return rStatus; } + //=========================================================================== HSI_STATUS HSI_Motion::SetDIO(UINT IOChannel, UINT _Status) { @@ -3519,6 +3752,7 @@ HSI_STATUS HSI_Motion::SetDIO(UINT IOChannel, UINT _Status) } return rStatus; } + //=========================================================================== HSI_STATUS HSI_Motion::GetAxisStatus(int* _Status) { @@ -3532,7 +3766,7 @@ HSI_STATUS HSI_Motion::GetAxisStatus(int* _Status) } //=============================ͣ͹ر============================================== -HSI_STATUS HSI_Motion::AbortMotion() +HSI_STATUS HSI_Motion::AbortMotion() //Ҫ˶ʵ { auto rStatus = HSI_STATUS_NORMAL; if (g_pHSI_Motion) @@ -3570,6 +3804,7 @@ HSI_STATUS HSI_Motion::AbortMotion() } return rStatus; } + //===============================ر============================================ HSI_STATUS HSI_Motion::Shutdown() { @@ -3578,7 +3813,7 @@ HSI_STATUS HSI_Motion::Shutdown() { g_pLogger->SendAndFlushWithTime(L"[Shutdown] In\n"); g_IsClose = true; - SetDIO(HSI_MOTION_OUTPUT_CH1, 0xffff); + //SetDIO(HSI_MOTION_OUTPUT_CH1, 0xffff); if (m_bConnected) { CloseHandle(hCom); @@ -3635,13 +3870,14 @@ HSI_STATUS HSI_Motion::Shutdown() } //==============================ƹ============================================= -HSI_STATUS HSI_Motion::SetTriggerLight(int triggleNum, int delayLighting, int delayLightBefor, int triggleMode, double* Intensities) +HSI_STATUS HSI_Motion::SetTriggerLight(int triggleNum, int delayLighting, int delayLightBefor, int triggleMode, + double* Intensities) { auto rStatus = HSI_STATUS_NORMAL; if (g_pHSI_Motion) { setLightFlag = true; - unsigned char m_SetTriggerLightData[64] = { 0 }; + unsigned char m_SetTriggerLightData[64] = {0}; m_SetTriggerLightData[0] = CT_LIGHT; m_SetTriggerLightData[1] = 0x03; m_SetTriggerLightData[2] = triggleNum; @@ -3653,8 +3889,8 @@ HSI_STATUS HSI_Motion::SetTriggerLight(int triggleNum, int delayLighting, int de int z = 4; for (int j = 24 * i; j < 24 * (i + 1); ++j) { - m_SetTriggerLightData[z++] = ((int(Intensities[j] * 11.2)) >> 8) & 0xff; - m_SetTriggerLightData[z++] = (int(Intensities[j] * 11.2)) & 0xff; + m_SetTriggerLightData[z++] = (static_cast(Intensities[j] * 11.2) >> 8) & 0xff; + m_SetTriggerLightData[z++] = static_cast(Intensities[j] * 11.2) & 0xff; } m_SetTriggerLightData[z++] = delayLighting & 0xff; m_SetTriggerLightData[z++] = triggleMode & 0xff; @@ -3668,8 +3904,8 @@ HSI_STATUS HSI_Motion::SetTriggerLight(int triggleNum, int delayLighting, int de int z = 4; for (int j = 24 * i; j < 8 * triggleNum; ++j) { - m_SetTriggerLightData[z++] = ((int(Intensities[j] * 11.2)) >> 8) & 0xff; - m_SetTriggerLightData[z++] = (int(Intensities[j] * 11.2)) & 0xff; + m_SetTriggerLightData[z++] = (static_cast(Intensities[j] * 11.2) >> 8) & 0xff; + m_SetTriggerLightData[z++] = static_cast(Intensities[j] * 11.2) & 0xff; } m_SetTriggerLightData[52] = delayLighting & 0xff; m_SetTriggerLightData[53] = triggleMode & 0xff; @@ -3683,8 +3919,8 @@ HSI_STATUS HSI_Motion::SetTriggerLight(int triggleNum, int delayLighting, int de int z = 4; for (int j = 0; j < 8 * triggleNum; ++j) { - m_SetTriggerLightData[z++] = ((int(Intensities[j] * 11.2)) >> 8) & 0xff; - m_SetTriggerLightData[z++] = (int(Intensities[j] * 11.2)) & 0xff; + m_SetTriggerLightData[z++] = (static_cast(Intensities[j] * 11.2) >> 8) & 0xff; + m_SetTriggerLightData[z++] = static_cast(Intensities[j] * 11.2) & 0xff; } m_SetTriggerLightData[52] = delayLighting & 0xff; m_SetTriggerLightData[53] = triggleMode & 0xff; @@ -3697,18 +3933,19 @@ HSI_STATUS HSI_Motion::SetTriggerLight(int triggleNum, int delayLighting, int de } //=============================Ӳ============================================== -HSI_STATUS HSI_Motion::DCCPPStartPoint(double *startPoint) +HSI_STATUS HSI_Motion::DCCPPStartPoint(double* startPoint) { auto rStatus = HSI_STATUS_NORMAL; if (g_pHSI_Motion) { m_IsUsePPS = true; - begin_position[1] = (int)(startPoint[1] / m_Resolution[1]); - begin_position[2] = (int)(startPoint[2] / m_Resolution[2]); - begin_position[3] = (int)(startPoint[3] / m_Resolution[3]); + begin_position[1] = static_cast(startPoint[1] / m_Resolution[1]); + begin_position[2] = static_cast(startPoint[2] / m_Resolution[2]); + begin_position[3] = static_cast(startPoint[3] / m_Resolution[3]); } return rStatus; } + //=========================================================================== HSI_STATUS HSI_Motion::DCCScanSetData(UINT AxisTypes, HSI_SCAN_MOTION_TYPE eType, UINT lTrigNumber, double* dTrigDis) { @@ -3719,7 +3956,7 @@ HSI_STATUS HSI_Motion::DCCScanSetData(UINT AxisTypes, HSI_SCAN_MOTION_TYPE eType //λΪλ,÷һƶλãٿʼôλ(λ)յλ g_pLogger->SendAndFlushWithTime(L"[DCCScanSetData] In\n"); int axisNum; - unsigned char m_SendDCCData[64] = { 0 }; + unsigned char m_SendDCCData[64] = {0}; m_SendDCCData[0] = CT_MOTOR; m_SendDCCData[1] = CT_TRIGGER_DATA; m_SendDCCData[2] = 0x01; @@ -3749,110 +3986,108 @@ HSI_STATUS HSI_Motion::DCCScanSetData(UINT AxisTypes, HSI_SCAN_MOTION_TYPE eType switch (eType) { case HSI_SCAN_MOTION_SPEC_LOCA: - { - if (dTrigDis[0] > 0.0001) { - iMotionDirection = 0; - } - else - { - iMotionDirection = 1; - } + if (dTrigDis[0] > 0.0001) + { + iMotionDirection = 0; + } + else + { + iMotionDirection = 1; + } - switch (iaxisNum) - { - case AXIS_X: - { - if (!m_IsUsePPS) + switch (iaxisNum) { - begin_position[1] = begin_position[1] + dTrigDis[0] / m_Resolution[axisNum]; - } - else - { - if (iMotionDirection == 0) + case AXIS_X: { - begin_position[1] = begin_position[1] - 20; + if (!m_IsUsePPS) + { + begin_position[1] = begin_position[1] + dTrigDis[0] / m_Resolution[axisNum]; + } + else + { + if (iMotionDirection == 0) + { + begin_position[1] = begin_position[1] - 20; + } + else + { + begin_position[1] = begin_position[1] + 20; + } + } + if (iMotionDirection == 0) + { + limit = 1000.0; + } + else + { + limit = -1000.0; + } + break; } - else + case AXIS_Y: { - begin_position[1] = begin_position[1] + 20; + if (!m_IsUsePPS) + { + begin_position[2] = begin_position[2] + dTrigDis[0] / m_Resolution[axisNum]; + } + else + { + if (iMotionDirection == 0) + { + begin_position[2] = begin_position[2] - 20; + } + else + { + begin_position[2] = begin_position[2] + 20; + } + } + if (iMotionDirection == 0) + { + limit = 1000.0; + } + else + { + limit = -1000.0; + } + break; } - } - if (iMotionDirection == 0) - { - limit = 1000.0; - } - else - { - limit = -1000.0; - } - break; - } - case AXIS_Y: - { - if (!m_IsUsePPS) - { - begin_position[2] = begin_position[2] + dTrigDis[0] / m_Resolution[axisNum]; - } - else - { - if (iMotionDirection == 0) + case AXIS_Z: { - begin_position[2] = begin_position[2] - 20; - } - else - { - begin_position[2] = begin_position[2] + 20; + if (!m_IsUsePPS) + { + begin_position[3] = begin_position[3] + dTrigDis[0] / m_Resolution[axisNum]; + } + else + { + if (iMotionDirection == 0) + { + begin_position[3] = begin_position[3] - 20; + } + else + { + begin_position[3] = begin_position[3] + 20; + } + } + if (iMotionDirection == 0) + { + limit = 1000.0; + } + else + { + limit = -1000.0; + } + break; } + default: + break; } - if (iMotionDirection == 0) - { - limit = 1000.0; - } - else - { - limit = -1000.0; - } - break; - } - case AXIS_Z: - { - if (!m_IsUsePPS) - { - begin_position[3] = begin_position[3] + dTrigDis[0] / m_Resolution[axisNum]; - } - else - { - if (iMotionDirection == 0) - { - begin_position[3] = begin_position[3] - 20; - } - else - { - begin_position[3] = begin_position[3] + 20; - } - } - if (iMotionDirection == 0) - { - limit = 1000.0; - } - else - { - limit = -1000.0; - } - break; - } - default: - break; - } - iScanMotionType = HSI_SCAN_MOTION_SPEC_LOCA; - if (lTrigNumber > 100) - { - return HSI_STATUS_FAILED; - } - else - { + iScanMotionType = HSI_SCAN_MOTION_SPEC_LOCA; + if (lTrigNumber > 100) + { + return HSI_STATUS_FAILED; + } int num = lTrigNumber / 14; int i = 0; for (i = 0; i < num; i++) @@ -3860,10 +4095,10 @@ HSI_STATUS HSI_Motion::DCCScanSetData(UINT AxisTypes, HSI_SCAN_MOTION_TYPE eType m_SendDCCData[3] = i; for (size_t j = 14 * i, z = 4; j < 14 * (i + 1); ++j) { - m_SendDCCData[z++] = ((long)(dTrigDis[j] / m_Resolution[axisNum])) & 0xff; - m_SendDCCData[z++] = (((long)(dTrigDis[j] / m_Resolution[axisNum])) >> 8) & 0xff; - m_SendDCCData[z++] = (((long)(dTrigDis[j] / m_Resolution[axisNum])) >> 16) & 0xff; - m_SendDCCData[z++] = ((long)(dTrigDis[j] / m_Resolution[axisNum])) >> 24; + m_SendDCCData[z++] = static_cast(dTrigDis[j] / m_Resolution[axisNum]) & 0xff; + m_SendDCCData[z++] = (static_cast(dTrigDis[j] / m_Resolution[axisNum]) >> 8) & 0xff; + m_SendDCCData[z++] = (static_cast(dTrigDis[j] / m_Resolution[axisNum]) >> 16) & 0xff; + m_SendDCCData[z++] = static_cast(dTrigDis[j] / m_Resolution[axisNum]) >> 24; } m_WriteByte = Send_Command(0, (const char*)m_SendDCCData, m_SendDataLength); Sleep(1); @@ -3874,15 +4109,15 @@ HSI_STATUS HSI_Motion::DCCScanSetData(UINT AxisTypes, HSI_SCAN_MOTION_TYPE eType int j = 0, z = 0; for (j = 14 * i, z = 4; j < lTrigNumber; ++j) { - m_SendDCCData[z++] = ((long)(dTrigDis[j] / m_Resolution[axisNum])) & 0xff; - m_SendDCCData[z++] = (((long)(dTrigDis[j] / m_Resolution[axisNum])) >> 8) & 0xff; - m_SendDCCData[z++] = (((long)(dTrigDis[j] / m_Resolution[axisNum])) >> 16) & 0xff; - m_SendDCCData[z++] = ((long)(dTrigDis[j] / m_Resolution[axisNum])) >> 24; + m_SendDCCData[z++] = static_cast(dTrigDis[j] / m_Resolution[axisNum]) & 0xff; + m_SendDCCData[z++] = (static_cast(dTrigDis[j] / m_Resolution[axisNum]) >> 8) & 0xff; + m_SendDCCData[z++] = (static_cast(dTrigDis[j] / m_Resolution[axisNum]) >> 16) & 0xff; + m_SendDCCData[z++] = static_cast(dTrigDis[j] / m_Resolution[axisNum]) >> 24; } - m_SendDCCData[z++] = ((long)(limit / m_Resolution[axisNum])) & 0xff; - m_SendDCCData[z++] = (((long)(limit / m_Resolution[axisNum])) >> 8) & 0xff; - m_SendDCCData[z++] = (((long)(limit / m_Resolution[axisNum])) >> 16) & 0xff; - m_SendDCCData[z++] = ((long)(limit / m_Resolution[axisNum])) >> 24; + m_SendDCCData[z++] = static_cast(limit / m_Resolution[axisNum]) & 0xff; + m_SendDCCData[z++] = (static_cast(limit / m_Resolution[axisNum]) >> 8) & 0xff; + m_SendDCCData[z++] = (static_cast(limit / m_Resolution[axisNum]) >> 16) & 0xff; + m_SendDCCData[z++] = static_cast(limit / m_Resolution[axisNum]) >> 24; m_WriteByte = Send_Command(0, (const char*)m_SendDCCData, m_SendDataLength); Sleep(10); } @@ -3892,241 +4127,238 @@ HSI_STATUS HSI_Motion::DCCScanSetData(UINT AxisTypes, HSI_SCAN_MOTION_TYPE eType int j = 0, z = 0; for (j = 0, z = 4; j < lTrigNumber; ++j) { - m_SendDCCData[z++] = ((long)(dTrigDis[j] / m_Resolution[axisNum])) & 0xff; - m_SendDCCData[z++] = (((long)(dTrigDis[j] / m_Resolution[axisNum])) >> 8) & 0xff; - m_SendDCCData[z++] = (((long)(dTrigDis[j] / m_Resolution[axisNum])) >> 16) & 0xff; - m_SendDCCData[z++] = ((long)(dTrigDis[j] / m_Resolution[axisNum])) >> 24; + m_SendDCCData[z++] = static_cast(dTrigDis[j] / m_Resolution[axisNum]) & 0xff; + m_SendDCCData[z++] = (static_cast(dTrigDis[j] / m_Resolution[axisNum]) >> 8) & 0xff; + m_SendDCCData[z++] = (static_cast(dTrigDis[j] / m_Resolution[axisNum]) >> 16) & 0xff; + m_SendDCCData[z++] = static_cast(dTrigDis[j] / m_Resolution[axisNum]) >> 24; } - m_SendDCCData[z++] = ((long)(limit / m_Resolution[axisNum])) & 0xff; - m_SendDCCData[z++] = (((long)(limit / m_Resolution[axisNum])) >> 8) & 0xff; - m_SendDCCData[z++] = (((long)(limit / m_Resolution[axisNum])) >> 16) & 0xff; - m_SendDCCData[z++] = ((long)(limit / m_Resolution[axisNum])) >> 24; + m_SendDCCData[z++] = static_cast(limit / m_Resolution[axisNum]) & 0xff; + m_SendDCCData[z++] = (static_cast(limit / m_Resolution[axisNum]) >> 8) & 0xff; + m_SendDCCData[z++] = (static_cast(limit / m_Resolution[axisNum]) >> 16) & 0xff; + m_SendDCCData[z++] = static_cast(limit / m_Resolution[axisNum]) >> 24; m_WriteByte = Send_Command(0, (const char*)m_SendDCCData, m_SendDataLength); Sleep(10); } - + break; } - break; - } case HSI_SCAN_MOTION_EQ_DIS: - { - if (dTrigDis[0] > 0.0001) { - iMotionDirection = 0; - } - else - { - iMotionDirection = 1; - } - switch (iaxisNum) - { - case AXIS_X: - { - if (!m_IsUsePPS) + if (dTrigDis[0] > 0.0001) { - begin_position[1] = begin_position[1] + dTrigDis[0] / m_Resolution[axisNum]; + iMotionDirection = 0; } else { - if (iMotionDirection == 0) - { - begin_position[1] = begin_position[1] - 20; - } - else - { - begin_position[1] = begin_position[1] + 20; - } + iMotionDirection = 1; } - if (iMotionDirection == 0) + switch (iaxisNum) { - limit = 1000; - } - else - { - limit = -1000; + case AXIS_X: + { + if (!m_IsUsePPS) + { + begin_position[1] = begin_position[1] + dTrigDis[0] / m_Resolution[axisNum]; + } + else + { + if (iMotionDirection == 0) + { + begin_position[1] = begin_position[1] - 20; + } + else + { + begin_position[1] = begin_position[1] + 20; + } + } + if (iMotionDirection == 0) + { + limit = 1000; + } + else + { + limit = -1000; + } + break; + } + case AXIS_Y: + { + if (!m_IsUsePPS) + { + begin_position[2] = begin_position[2] + dTrigDis[0] / m_Resolution[axisNum]; + } + else + { + if (iMotionDirection == 0) + { + begin_position[2] = begin_position[2] - 20; + } + else + { + begin_position[2] = begin_position[2] + 20; + } + } + if (iMotionDirection == 0) + { + limit = 1000; + } + else + { + limit = -1000; + } + break; + } + case AXIS_Z: + { + if (!m_IsUsePPS) + { + begin_position[3] = begin_position[3] + dTrigDis[0] / m_Resolution[axisNum]; + } + else + { + if (iMotionDirection == 0) + { + begin_position[3] = begin_position[3] - 20; + } + else + { + begin_position[3] = begin_position[3] + 20; + } + } + if (iMotionDirection == 0) + { + limit = 1000; + } + else + { + limit = -1000; + } + break; + } + default: + break; } + iScanMotionType = HSI_SCAN_MOTION_EQ_DIS; + m_SendDCCData[3] = 0x00; + m_SendDCCData[4] = static_cast(dTrigDis[0] / m_Resolution[axisNum]) & 0xff; + m_SendDCCData[5] = (static_cast(dTrigDis[0] / m_Resolution[axisNum]) >> 8) & 0xff; + m_SendDCCData[6] = (static_cast(dTrigDis[0] / m_Resolution[axisNum]) >> 16) & 0xff; + m_SendDCCData[7] = static_cast(dTrigDis[0] / m_Resolution[axisNum]) >> 24; + m_WriteByte = Send_Command(0, (const char*)m_SendDCCData, m_SendDataLength); + Sleep(10); break; } - case AXIS_Y: - { - if (!m_IsUsePPS) - { - begin_position[2] = begin_position[2] + dTrigDis[0] / m_Resolution[axisNum]; - } - else - { - if (iMotionDirection == 0) - { - begin_position[2] = begin_position[2] - 20; - } - else - { - begin_position[2] = begin_position[2] + 20; - } - } - if (iMotionDirection == 0) - { - limit = 1000; - } - else - { - limit = -1000; - } - break; - } - case AXIS_Z: - { - if (!m_IsUsePPS) - { - begin_position[3] = begin_position[3] + dTrigDis[0] / m_Resolution[axisNum]; - } - else - { - if (iMotionDirection == 0) - { - begin_position[3] = begin_position[3] - 20; - } - else - { - begin_position[3] = begin_position[3] + 20; - } - - } - if (iMotionDirection == 0) - { - limit = 1000; - } - else - { - limit = -1000; - } - break; - } - default: - break; - } - iScanMotionType = HSI_SCAN_MOTION_EQ_DIS; - m_SendDCCData[3] = 0x00; - m_SendDCCData[4] = ((long)(dTrigDis[0] / m_Resolution[axisNum])) & 0xff; - m_SendDCCData[5] = (((long)(dTrigDis[0] / m_Resolution[axisNum])) >> 8) & 0xff; - m_SendDCCData[6] = (((long)(dTrigDis[0] / m_Resolution[axisNum])) >> 16) & 0xff; - m_SendDCCData[7] = ((long)(dTrigDis[0] / m_Resolution[axisNum])) >> 24; - m_WriteByte = Send_Command(0, (const char*)m_SendDCCData, m_SendDataLength); - Sleep(10); - break; - } case HSI_SCAN_MOTION_EQ_DIS_II: - { - if (dTrigDis[1] > 0.0001) { - iMotionDirection = 0; - } - else - { - iMotionDirection = 1; - } + if (dTrigDis[1] > 0.0001) + { + iMotionDirection = 0; + } + else + { + iMotionDirection = 1; + } - switch (iaxisNum) - { - case AXIS_X: - { - if (!m_IsUsePPS) + switch (iaxisNum) { - begin_position[1] = begin_position[1] + dTrigDis[0] / m_Resolution[axisNum]; - } - else - { - if (iMotionDirection == 0) + case AXIS_X: { - begin_position[1] = begin_position[1] - 20; + if (!m_IsUsePPS) + { + begin_position[1] = begin_position[1] + dTrigDis[0] / m_Resolution[axisNum]; + } + else + { + if (iMotionDirection == 0) + { + begin_position[1] = begin_position[1] - 20; + } + else + { + begin_position[1] = begin_position[1] + 20; + } + } + if (iMotionDirection == 0) + { + limit = 1000; + } + else + { + limit = -1000; + } + break; } - else + case AXIS_Y: { - begin_position[1] = begin_position[1] + 20; + if (!m_IsUsePPS) + { + begin_position[2] = begin_position[2] + dTrigDis[0] / m_Resolution[axisNum]; + } + else + { + if (iMotionDirection == 0) + { + begin_position[2] = begin_position[2] - 20; + } + else + { + begin_position[2] = begin_position[2] + 20; + } + } + if (iMotionDirection == 0) + { + limit = 1000; + } + else + { + limit = -1000; + } + break; } - } - if (iMotionDirection == 0) - { - limit = 1000; - } - else - { - limit = -1000; - } - break; - } - case AXIS_Y: - { - if (!m_IsUsePPS) - { - begin_position[2] = begin_position[2] + dTrigDis[0] / m_Resolution[axisNum]; - } - else - { - if (iMotionDirection == 0) + case AXIS_Z: { - begin_position[2] = begin_position[2] - 20; - } - else - { - begin_position[2] = begin_position[2] + 20; + if (!m_IsUsePPS) + { + begin_position[3] = begin_position[3] + dTrigDis[0] / m_Resolution[axisNum]; + } + else + { + if (iMotionDirection == 0) + { + begin_position[3] = begin_position[3] - 20; + } + else + { + begin_position[3] = begin_position[3] + 20; + } + } + if (iMotionDirection == 0) + { + limit = 1000; + } + else + { + limit = -1000; + } + break; } + default: + break; } - if (iMotionDirection == 0) - { - limit = 1000; - } - else - { - limit = -1000; - } - break; - } - case AXIS_Z: - { - if (!m_IsUsePPS) - { - begin_position[3] = begin_position[3] + dTrigDis[0] / m_Resolution[axisNum]; - } - else - { - if (iMotionDirection == 0) - { - begin_position[3] = begin_position[3] - 20; - } - else - { - begin_position[3] = begin_position[3] + 20; - } - } - if (iMotionDirection == 0) - { - limit = 1000; - } - else - { - limit = -1000; - } - break; - } - default: - break; - } - iScanMotionType = HSI_SCAN_MOTION_EQ_DIS_II; - m_SendDCCData[3] = 0x00; - int i = 0, j = 0; - for (i = 0, j = 4; i < 2; ++i) - { - m_SendDCCData[j++] = ((long)(dTrigDis[i] / m_Resolution[axisNum])) & 0xff; - m_SendDCCData[j++] = (((long)(dTrigDis[i] / m_Resolution[axisNum])) >> 8) & 0xff; - m_SendDCCData[j++] = (((long)(dTrigDis[i] / m_Resolution[axisNum])) >> 16) & 0xff; - m_SendDCCData[j++] = ((long)(dTrigDis[i] / m_Resolution[axisNum])) >> 24; + iScanMotionType = HSI_SCAN_MOTION_EQ_DIS_II; + m_SendDCCData[3] = 0x00; + int i = 0, j = 0; + for (i = 0, j = 4; i < 2; ++i) + { + m_SendDCCData[j++] = static_cast(dTrigDis[i] / m_Resolution[axisNum]) & 0xff; + m_SendDCCData[j++] = (static_cast(dTrigDis[i] / m_Resolution[axisNum]) >> 8) & 0xff; + m_SendDCCData[j++] = (static_cast(dTrigDis[i] / m_Resolution[axisNum]) >> 16) & 0xff; + m_SendDCCData[j++] = static_cast(dTrigDis[i] / m_Resolution[axisNum]) >> 24; + } + m_WriteByte = Send_Command(0, (const char*)m_SendDCCData, m_SendDataLength); + Sleep(10); + break; } - m_WriteByte = Send_Command(0, (const char*)m_SendDCCData, m_SendDataLength); - Sleep(10); - break; - } default: break; } @@ -4135,6 +4367,7 @@ HSI_STATUS HSI_Motion::DCCScanSetData(UINT AxisTypes, HSI_SCAN_MOTION_TYPE eType ReleaseMutex(g_WR_ToMove_Mutex); return rStatus; } + //=========================================================================== HSI_STATUS HSI_Motion::DCCScanStart() { @@ -4144,7 +4377,7 @@ HSI_STATUS HSI_Motion::DCCScanStart() { if (!setLightFlag) { - unsigned char m_SetTriggerLightData[64] = { 0 }; + unsigned char m_SetTriggerLightData[64] = {0}; m_SetTriggerLightData[0] = CT_LIGHT; m_SetTriggerLightData[1] = 0x03; m_SetTriggerLightData[53] = 0; @@ -4153,13 +4386,13 @@ HSI_STATUS HSI_Motion::DCCScanStart() } setLightFlag = false; g_pLogger->SendAndFlushWithTime(L"[DCCScanStart] In\n"); - unsigned char m_SendDCCData[64] = { 0 }; + unsigned char m_SendDCCData[64] = {0}; m_SendDCCData[0] = CT_MOTOR; m_SendDCCData[1] = CT_TRIGGER_DATA; m_SendDCCData[2] = 0x00; m_SendDCCData[3] = iaxisNum; m_SendDCCData[4] = iScanMotionType; - m_SendDCCData[5] = ((iTriggleNum)& 0xff); + m_SendDCCData[5] = ((iTriggleNum) & 0xff); m_SendDCCData[6] = (iTriggleNum >> 8) & 0xff; m_SendDCCData[7] = iMotionDirection; switch (iaxisNum) @@ -4171,7 +4404,7 @@ HSI_STATUS HSI_Motion::DCCScanStart() m_SendDCCData[12] = m_SetPotion_DriveSpeed[1] & 0xff; m_SendDCCData[13] = (m_SetPotion_DriveSpeed[1] >> 8) & 0xff; break; - case AXIS_Y: m_SendDCCData[8] = begin_position[2] & 0xff; + case AXIS_Y: m_SendDCCData[8] = begin_position[2] & 0xff; m_SendDCCData[9] = (begin_position[2] >> 8) & 0xff; m_SendDCCData[10] = (begin_position[2] >> 16) & 0xff; m_SendDCCData[11] = (begin_position[2] >> 24) & 0xff; @@ -4197,6 +4430,7 @@ HSI_STATUS HSI_Motion::DCCScanStart() ReleaseMutex(g_WR_ToMove_Mutex); return rStatus; } + //=========================================================================== HSI_STATUS HSI_Motion::DCCScanStop() { @@ -4205,7 +4439,7 @@ HSI_STATUS HSI_Motion::DCCScanStop() if (g_pHSI_Motion) { g_pLogger->SendAndFlushWithTime(L"[DCCScanStop] In\n"); - unsigned char m_SendDCCData[64] = { 0 }; + unsigned char m_SendDCCData[64] = {0}; m_SendDCCData[0] = CT_MOTOR; m_SendDCCData[1] = CT_TRIGGER_DATA; m_SendDCCData[2] = 0x02; @@ -4216,6 +4450,7 @@ HSI_STATUS HSI_Motion::DCCScanStop() ReleaseMutex(g_WR_ToMove_Mutex); return rStatus; } + //=========================================================================== HSI_STATUS HSI_Motion::DCCForLightPlate() { @@ -4253,7 +4488,8 @@ HSI_STATUS HSI_Motion::DCCForLightPlate() } //===============================ת============================================ -HSI_STATUS HSI_Motion::StartPlcJob(int* CamerasDis, int* BinsDis, int SubArea, int filterTime1, int filterTime2, int pluseSumDis) +HSI_STATUS HSI_Motion::StartPlcJob(int* CamerasDis, int* BinsDis, int SubArea, int filterTime1, int filterTime2, + int pluseSumDis) { g_pLogger->SendAndFlushWithTime(L"[StartPlcJob] In\n"); auto rStatus = HSI_STATUS_NORMAL; @@ -4305,6 +4541,7 @@ HSI_STATUS HSI_Motion::StartPlcJob(int* CamerasDis, int* BinsDis, int SubArea, i g_pLogger->SendAndFlushWithTime(L"[StartPlcJob] Out\n"); return rStatus; } + //=========================================================================== HSI_STATUS HSI_Motion::SendBinResult(int* BinResult) { @@ -4319,15 +4556,20 @@ HSI_STATUS HSI_Motion::SendBinResult(int* BinResult) switch (BinResult[0]) { case 1: - temp = 0x01; break; + temp = 0x01; + break; case 2: - temp = 0x02; break; + temp = 0x02; + break; case 3: - temp = 0x04; break; + temp = 0x04; + break; case 4: - temp = 0x08; break; + temp = 0x08; + break; default: - temp = 0x00; break; + temp = 0x00; + break; } m_cSendData[2] = temp; m_cSendData[3] = ((m_IbinCount >> 24) & 0xff); @@ -4341,8 +4583,9 @@ HSI_STATUS HSI_Motion::SendBinResult(int* BinResult) g_pLogger->SendAndFlushWithTime(L"[SendBinResult] out\n"); return rStatus; } + //=========================================================================== -HSI_STATUS HSI_Motion::GetTriggleCount(int *nCount, int& nArea) +HSI_STATUS HSI_Motion::GetTriggleCount(int* nCount, int& nArea) { auto rStatus = HSI_STATUS_NORMAL; if (g_pHSI_Motion) @@ -4350,32 +4593,44 @@ HSI_STATUS HSI_Motion::GetTriggleCount(int *nCount, int& nArea) if (m_SO7_Serial.m_RecvData[0] == 3) { nArea = m_SO7_Serial.m_RecvData[1]; - nCount[0] = m_SO7_Serial.m_RecvData[2] << 24 | m_SO7_Serial.m_RecvData[3] << 16 | m_SO7_Serial.m_RecvData[4] << 8 | m_SO7_Serial.m_RecvData[5]; - nCount[1] = m_SO7_Serial.m_RecvData[6] << 24 | m_SO7_Serial.m_RecvData[7] << 16 | m_SO7_Serial.m_RecvData[8] << 8 | m_SO7_Serial.m_RecvData[9]; - nCount[2] = m_SO7_Serial.m_RecvData[10] << 24 | m_SO7_Serial.m_RecvData[11] << 16 | m_SO7_Serial.m_RecvData[12] << 8 | m_SO7_Serial.m_RecvData[13]; - nCount[3] = m_SO7_Serial.m_RecvData[14] << 24 | m_SO7_Serial.m_RecvData[15] << 16 | m_SO7_Serial.m_RecvData[16] << 8 | m_SO7_Serial.m_RecvData[17]; - nCount[4] = m_SO7_Serial.m_RecvData[18] << 24 | m_SO7_Serial.m_RecvData[19] << 16 | m_SO7_Serial.m_RecvData[20] << 8 | m_SO7_Serial.m_RecvData[21]; - nCount[5] = m_SO7_Serial.m_RecvData[22] << 24 | m_SO7_Serial.m_RecvData[23] << 16 | m_SO7_Serial.m_RecvData[24] << 8 | m_SO7_Serial.m_RecvData[25]; - nCount[6] = m_SO7_Serial.m_RecvData[26] << 24 | m_SO7_Serial.m_RecvData[27] << 16 | m_SO7_Serial.m_RecvData[28] << 8 | m_SO7_Serial.m_RecvData[29]; - nCount[7] = m_SO7_Serial.m_RecvData[30] << 24 | m_SO7_Serial.m_RecvData[31] << 16 | m_SO7_Serial.m_RecvData[32] << 8 | m_SO7_Serial.m_RecvData[33]; - nCount[8] = m_SO7_Serial.m_RecvData[34] << 24 | m_SO7_Serial.m_RecvData[35] << 16 | m_SO7_Serial.m_RecvData[36] << 8 | m_SO7_Serial.m_RecvData[37]; - nCount[9] = m_SO7_Serial.m_RecvData[38] << 24 | m_SO7_Serial.m_RecvData[39] << 16 | m_SO7_Serial.m_RecvData[40] << 8 | m_SO7_Serial.m_RecvData[41]; + nCount[0] = m_SO7_Serial.m_RecvData[2] << 24 | m_SO7_Serial.m_RecvData[3] << 16 | m_SO7_Serial.m_RecvData[4] + << 8 | m_SO7_Serial.m_RecvData[5]; + nCount[1] = m_SO7_Serial.m_RecvData[6] << 24 | m_SO7_Serial.m_RecvData[7] << 16 | m_SO7_Serial.m_RecvData[8] + << 8 | m_SO7_Serial.m_RecvData[9]; + nCount[2] = m_SO7_Serial.m_RecvData[10] << 24 | m_SO7_Serial.m_RecvData[11] << 16 | m_SO7_Serial.m_RecvData[ + 12] << 8 | m_SO7_Serial.m_RecvData[13]; + nCount[3] = m_SO7_Serial.m_RecvData[14] << 24 | m_SO7_Serial.m_RecvData[15] << 16 | m_SO7_Serial.m_RecvData[ + 16] << 8 | m_SO7_Serial.m_RecvData[17]; + nCount[4] = m_SO7_Serial.m_RecvData[18] << 24 | m_SO7_Serial.m_RecvData[19] << 16 | m_SO7_Serial.m_RecvData[ + 20] << 8 | m_SO7_Serial.m_RecvData[21]; + nCount[5] = m_SO7_Serial.m_RecvData[22] << 24 | m_SO7_Serial.m_RecvData[23] << 16 | m_SO7_Serial.m_RecvData[ + 24] << 8 | m_SO7_Serial.m_RecvData[25]; + nCount[6] = m_SO7_Serial.m_RecvData[26] << 24 | m_SO7_Serial.m_RecvData[27] << 16 | m_SO7_Serial.m_RecvData[ + 28] << 8 | m_SO7_Serial.m_RecvData[29]; + nCount[7] = m_SO7_Serial.m_RecvData[30] << 24 | m_SO7_Serial.m_RecvData[31] << 16 | m_SO7_Serial.m_RecvData[ + 32] << 8 | m_SO7_Serial.m_RecvData[33]; + nCount[8] = m_SO7_Serial.m_RecvData[34] << 24 | m_SO7_Serial.m_RecvData[35] << 16 | m_SO7_Serial.m_RecvData[ + 36] << 8 | m_SO7_Serial.m_RecvData[37]; + nCount[9] = m_SO7_Serial.m_RecvData[38] << 24 | m_SO7_Serial.m_RecvData[39] << 16 | m_SO7_Serial.m_RecvData[ + 40] << 8 | m_SO7_Serial.m_RecvData[41]; g_pLogger->SendAndFlushWithTime(L"[GetTriggleCount] nArea = %d\n", nArea); } } return rStatus; } + //=========================================================================== //㽺 //=========================================================================== -HSI_STATUS HSI_Motion::GluePPSpnts(int* ppsDir, double* gluePPSPos, int* delayLightBefore, int* lightTime, double* lightData, int num) +HSI_STATUS HSI_Motion::GluePPSpnts(int* ppsDir, double* gluePPSPos, int* delayLightBefore, int* lightTime, + double* lightData, int num) { auto rStatus = HSI_STATUS_NORMAL; if (g_pHSI_Motion) { - unsigned char send_gluePPS_data[64] = { 0 }; + unsigned char send_gluePPS_data[64] = {0}; send_gluePPS_data[0] = CT_GLUEDISPENSER; - send_gluePPS_data[1] = 0x01; //ָ + send_gluePPS_data[1] = 0x01; //ָ m_WriteByte = Send_Command(0, (const char*)send_gluePPS_data, m_SendDataLength); Sleep(200); int posIndex = 0; @@ -4414,29 +4669,29 @@ HSI_STATUS HSI_Motion::GluePPSpnts(int* ppsDir, double* gluePPSPos, int* delayLi switch (saveDir) { case 0: - { - axisNum = 1; - dirnum = 2; - break; - } + { + axisNum = 1; + dirnum = 2; + break; + } case 1: - { - axisNum = 1; - dirnum = 1; - break; - } + { + axisNum = 1; + dirnum = 1; + break; + } case 2: - { - axisNum = 2; - dirnum = 2; - break; - } + { + axisNum = 2; + dirnum = 2; + break; + } case 3: - { - axisNum = 2; - dirnum = 1; - break; - } + { + axisNum = 2; + dirnum = 1; + break; + } default: break; } @@ -4453,53 +4708,53 @@ HSI_STATUS HSI_Motion::GluePPSpnts(int* ppsDir, double* gluePPSPos, int* delayLi switch (dirType) { case 0: - { - c++; - loadFeet[0] = (int)(gluePPSPos[posIndex++] / m_Resolution[1]); - loadFeet[1] = (int)(gluePPSPos[posIndex++] / m_Resolution[1]); - loadFeet[2] = (int)(gluePPSPos[posIndex++] / m_Resolution[1]); - send_gluePPS_data[j++] = (loadFeet[0] & 0xff); - send_gluePPS_data[j++] = ((loadFeet[0] >> 8) & 0xff); - send_gluePPS_data[j++] = ((loadFeet[0] >> 16) & 0xff); - send_gluePPS_data[j++] = ((loadFeet[0] >> 24) & 0xff); - break; - } + { + c++; + loadFeet[0] = static_cast(gluePPSPos[posIndex++] / m_Resolution[1]); + loadFeet[1] = static_cast(gluePPSPos[posIndex++] / m_Resolution[1]); + loadFeet[2] = static_cast(gluePPSPos[posIndex++] / m_Resolution[1]); + send_gluePPS_data[j++] = (loadFeet[0] & 0xff); + send_gluePPS_data[j++] = ((loadFeet[0] >> 8) & 0xff); + send_gluePPS_data[j++] = ((loadFeet[0] >> 16) & 0xff); + send_gluePPS_data[j++] = ((loadFeet[0] >> 24) & 0xff); + break; + } case 1: - { - c++; - loadFeet[0] = (int)(gluePPSPos[posIndex++] / m_Resolution[1]); - loadFeet[1] = (int)(gluePPSPos[posIndex++] / m_Resolution[1]); - loadFeet[2] = (int)(gluePPSPos[posIndex++] / m_Resolution[1]); - send_gluePPS_data[j++] = (loadFeet[0] & 0xff); - send_gluePPS_data[j++] = ((loadFeet[0] >> 8) & 0xff); - send_gluePPS_data[j++] = ((loadFeet[0] >> 16) & 0xff); - send_gluePPS_data[j++] = ((loadFeet[0] >> 24) & 0xff); - break; - } + { + c++; + loadFeet[0] = static_cast(gluePPSPos[posIndex++] / m_Resolution[1]); + loadFeet[1] = static_cast(gluePPSPos[posIndex++] / m_Resolution[1]); + loadFeet[2] = static_cast(gluePPSPos[posIndex++] / m_Resolution[1]); + send_gluePPS_data[j++] = (loadFeet[0] & 0xff); + send_gluePPS_data[j++] = ((loadFeet[0] >> 8) & 0xff); + send_gluePPS_data[j++] = ((loadFeet[0] >> 16) & 0xff); + send_gluePPS_data[j++] = ((loadFeet[0] >> 24) & 0xff); + break; + } case 2: - { - c++; - loadFeet[0] = (int)(gluePPSPos[posIndex++] / m_Resolution[1]); - loadFeet[1] = (int)(gluePPSPos[posIndex++] / m_Resolution[1]); - loadFeet[2] = (int)(gluePPSPos[posIndex++] / m_Resolution[1]); - send_gluePPS_data[j++] = (loadFeet[1] & 0xff); - send_gluePPS_data[j++] = ((loadFeet[1] >> 8) & 0xff); - send_gluePPS_data[j++] = ((loadFeet[1] >> 16) & 0xff); - send_gluePPS_data[j++] = ((loadFeet[1] >> 24) & 0xff); - break; - } + { + c++; + loadFeet[0] = static_cast(gluePPSPos[posIndex++] / m_Resolution[1]); + loadFeet[1] = static_cast(gluePPSPos[posIndex++] / m_Resolution[1]); + loadFeet[2] = static_cast(gluePPSPos[posIndex++] / m_Resolution[1]); + send_gluePPS_data[j++] = (loadFeet[1] & 0xff); + send_gluePPS_data[j++] = ((loadFeet[1] >> 8) & 0xff); + send_gluePPS_data[j++] = ((loadFeet[1] >> 16) & 0xff); + send_gluePPS_data[j++] = ((loadFeet[1] >> 24) & 0xff); + break; + } case 3: - { - c++; - loadFeet[0] = (int)(gluePPSPos[posIndex++] / m_Resolution[1]); - loadFeet[1] = (int)(gluePPSPos[posIndex++] / m_Resolution[1]); - loadFeet[2] = (int)(gluePPSPos[posIndex++] / m_Resolution[1]); - send_gluePPS_data[j++] = (loadFeet[1] & 0xff); - send_gluePPS_data[j++] = ((loadFeet[1] >> 8) & 0xff); - send_gluePPS_data[j++] = ((loadFeet[1] >> 16) & 0xff); - send_gluePPS_data[j++] = ((loadFeet[1] >> 24) & 0xff); - break; - } + { + c++; + loadFeet[0] = static_cast(gluePPSPos[posIndex++] / m_Resolution[1]); + loadFeet[1] = static_cast(gluePPSPos[posIndex++] / m_Resolution[1]); + loadFeet[2] = static_cast(gluePPSPos[posIndex++] / m_Resolution[1]); + send_gluePPS_data[j++] = (loadFeet[1] & 0xff); + send_gluePPS_data[j++] = ((loadFeet[1] >> 8) & 0xff); + send_gluePPS_data[j++] = ((loadFeet[1] >> 16) & 0xff); + send_gluePPS_data[j++] = ((loadFeet[1] >> 24) & 0xff); + break; + } default: break; } @@ -4516,29 +4771,29 @@ HSI_STATUS HSI_Motion::GluePPSpnts(int* ppsDir, double* gluePPSPos, int* delayLi switch (saveDir) { case 0: - { - axisNum = 1; - dirnum = 2; - break; - } + { + axisNum = 1; + dirnum = 2; + break; + } case 1: - { - axisNum = 1; - dirnum = 1; - break; - } + { + axisNum = 1; + dirnum = 1; + break; + } case 2: - { - axisNum = 2; - dirnum = 2; - break; - } + { + axisNum = 2; + dirnum = 2; + break; + } case 3: - { - axisNum = 2; - dirnum = 1; - break; - } + { + axisNum = 2; + dirnum = 1; + break; + } default: break; } @@ -4564,29 +4819,29 @@ HSI_STATUS HSI_Motion::GluePPSpnts(int* ppsDir, double* gluePPSPos, int* delayLi switch (saveDir) { case 0: - { - axisNum = 1; - dirnum = 2; - break; - } + { + axisNum = 1; + dirnum = 2; + break; + } case 1: - { - axisNum = 1; - dirnum = 1; - break; - } + { + axisNum = 1; + dirnum = 1; + break; + } case 2: - { - axisNum = 2; - dirnum = 2; - break; - } + { + axisNum = 2; + dirnum = 2; + break; + } case 3: - { - axisNum = 2; - dirnum = 1; - break; - } + { + axisNum = 2; + dirnum = 1; + break; + } default: break; } @@ -4597,8 +4852,8 @@ HSI_STATUS HSI_Motion::GluePPSpnts(int* ppsDir, double* gluePPSPos, int* delayLi } #pragma endregion - unsigned char send_data_light2[64] = { 0 }; - unsigned char send_data_delay[64] = { 0 }; + unsigned char send_data_light2[64] = {0}; + unsigned char send_data_delay[64] = {0}; c = 0; GlueDispenserindexNum = 0; int ldIndex = 0; @@ -4649,8 +4904,8 @@ HSI_STATUS HSI_Motion::GluePPSpnts(int* ppsDir, double* gluePPSPos, int* delayLi indexCount = 0; GlueDispenserindexNum++; } - light1 = (int)(lightData[ldIndex++] * 1120); - light2 = (int)(lightData[ldIndex++] * 1120); + light1 = static_cast(lightData[ldIndex++] * 1120); + light2 = static_cast(lightData[ldIndex++] * 1120); //send_gluePPS_data[j++] = (delayLightBefore[i] & 0xff); //send_gluePPS_data[j++] = ((delayLightBefore[i] >> 8) & 0xff); send_gluePPS_data[j++] = (light1 & 0xff); @@ -4712,13 +4967,14 @@ HSI_STATUS HSI_Motion::GluePPSpnts(int* ppsDir, double* gluePPSPos, int* delayLi } return rStatus; } + HSI_STATUS HSI_Motion::GlueDispenser(int* index, int* cirdirection, double* gluePos, int num) { auto rStatus = HSI_STATUS_NORMAL; if (g_pHSI_Motion) { GluerunCount = 0; - unsigned char send_glue_data[64] = { 0 }; + unsigned char send_glue_data[64] = {0}; send_glue_data[0] = CT_ORDER; send_glue_data[1] = CT_GLUEDISPENSER_CLEAR; send_glue_data[2] = 0x02; @@ -4736,418 +4992,418 @@ HSI_STATUS HSI_Motion::GlueDispenser(int* index, int* cirdirection, double* glue switch (index[i]) { case 0: - { - glueaxis = 0; - if (i == 0) { - GluerunCount++; - endGluepos[0] = gluePos[posIndex++]; - endGluepos[1] = gluePos[posIndex++]; - endGluepos[2] = gluePos[posIndex++]; - endGluepos[3] = gluePos[posIndex++]; - saveGluepos[0] = endGluepos[0]; - saveGluepos[1] = endGluepos[1]; - saveGluepos[2] = endGluepos[2]; - saveGluepos[3] = endGluepos[3]; - loadFeet[0] = (int)(endGluepos[0] / m_Resolution[1]); - loadFeet[1] = (int)(endGluepos[1] / m_Resolution[2]); - loadFeet[2] = (int)(endGluepos[2] / m_Resolution[3]); - loadFeet[3] = (int)(endGluepos[3] / m_Resolution[4]); - if (abs(loadFeet[0]) > 20) glueaxis |= 0x01; - if (abs(loadFeet[1]) > 20) glueaxis |= 0x02; - if (abs(loadFeet[2]) > 20) glueaxis |= 0x04; - if (abs(loadFeet[3]) > 20) glueaxis |= 0x08; - send_glue_data[3] = glueaxis; - send_glue_data[4] = 0x01; - send_glue_data[5] = 0x00; - int j = 6; - for (size_t k = 0; k < 4; k++) + glueaxis = 0; + if (i == 0) { - send_glue_data[j++] = (loadFeet[k] & 0xff); - send_glue_data[j++] = ((loadFeet[k] >> 8) & 0xff); - send_glue_data[j++] = ((loadFeet[k] >> 16) & 0xff); - send_glue_data[j++] = ((loadFeet[k] >> 24) & 0xff); + GluerunCount++; + endGluepos[0] = gluePos[posIndex++]; + endGluepos[1] = gluePos[posIndex++]; + endGluepos[2] = gluePos[posIndex++]; + endGluepos[3] = gluePos[posIndex++]; + saveGluepos[0] = endGluepos[0]; + saveGluepos[1] = endGluepos[1]; + saveGluepos[2] = endGluepos[2]; + saveGluepos[3] = endGluepos[3]; + loadFeet[0] = static_cast(endGluepos[0] / m_Resolution[1]); + loadFeet[1] = static_cast(endGluepos[1] / m_Resolution[2]); + loadFeet[2] = static_cast(endGluepos[2] / m_Resolution[3]); + loadFeet[3] = static_cast(endGluepos[3] / m_Resolution[4]); + if (abs(loadFeet[0]) > 20) glueaxis |= 0x01; + if (abs(loadFeet[1]) > 20) glueaxis |= 0x02; + if (abs(loadFeet[2]) > 20) glueaxis |= 0x04; + if (abs(loadFeet[3]) > 20) glueaxis |= 0x08; + send_glue_data[3] = glueaxis; + send_glue_data[4] = 0x01; + send_glue_data[5] = 0x00; + int j = 6; + for (size_t k = 0; k < 4; k++) + { + send_glue_data[j++] = (loadFeet[k] & 0xff); + send_glue_data[j++] = ((loadFeet[k] >> 8) & 0xff); + send_glue_data[j++] = ((loadFeet[k] >> 16) & 0xff); + send_glue_data[j++] = ((loadFeet[k] >> 24) & 0xff); + } + send_glue_data[0] = CT_MOTOR; + send_glue_data[1] = CT_GLUEDISPENSER_SET; + int len = j - 3; + send_glue_data[2] = len; + m_WriteByte = Send_Command(0, (const char*)send_glue_data, m_SendDataLength); + Sleep(20); } - send_glue_data[0] = CT_MOTOR; - send_glue_data[1] = CT_GLUEDISPENSER_SET; - int len = j - 3; - send_glue_data[2] = len; - m_WriteByte = Send_Command(0, (const char*)send_glue_data, m_SendDataLength); - Sleep(20); - } - else - { - GluerunCount++; - endGluepos[0] = gluePos[posIndex++]; - endGluepos[1] = gluePos[posIndex++]; - endGluepos[2] = gluePos[posIndex++]; - endGluepos[3] = gluePos[posIndex++]; - startGluepos[0] = saveGluepos[0]; - startGluepos[1] = saveGluepos[1]; - startGluepos[2] = saveGluepos[2]; - startGluepos[3] = saveGluepos[3]; - saveGluepos[0] = endGluepos[0]; - saveGluepos[1] = endGluepos[1]; - saveGluepos[2] = endGluepos[2]; - saveGluepos[3] = endGluepos[3]; - loadFeet[0] = (int)((endGluepos[0] - startGluepos[0]) / m_Resolution[1]); - loadFeet[1] = (int)((endGluepos[1] - startGluepos[1]) / m_Resolution[2]); - loadFeet[2] = (int)((endGluepos[2] - startGluepos[2]) / m_Resolution[3]); - loadFeet[3] = (int)((endGluepos[3] - startGluepos[3]) / m_Resolution[4]); - if (abs(loadFeet[0]) > 20) glueaxis |= 0x01; - if (abs(loadFeet[1]) > 20) glueaxis |= 0x02; - if (abs(loadFeet[2]) > 20) glueaxis |= 0x04; - if (abs(loadFeet[3]) > 20) glueaxis |= 0x08; - send_glue_data[3] = glueaxis; - send_glue_data[4] = 0x01; - send_glue_data[5] = 0x00; - int j = 6; - for (size_t k = 0; k < 4; k++) + else { - send_glue_data[j++] = (loadFeet[k] & 0xff); - send_glue_data[j++] = ((loadFeet[k] >> 8) & 0xff); - send_glue_data[j++] = ((loadFeet[k] >> 16) & 0xff); - send_glue_data[j++] = ((loadFeet[k] >> 24) & 0xff); + GluerunCount++; + endGluepos[0] = gluePos[posIndex++]; + endGluepos[1] = gluePos[posIndex++]; + endGluepos[2] = gluePos[posIndex++]; + endGluepos[3] = gluePos[posIndex++]; + startGluepos[0] = saveGluepos[0]; + startGluepos[1] = saveGluepos[1]; + startGluepos[2] = saveGluepos[2]; + startGluepos[3] = saveGluepos[3]; + saveGluepos[0] = endGluepos[0]; + saveGluepos[1] = endGluepos[1]; + saveGluepos[2] = endGluepos[2]; + saveGluepos[3] = endGluepos[3]; + loadFeet[0] = static_cast((endGluepos[0] - startGluepos[0]) / m_Resolution[1]); + loadFeet[1] = static_cast((endGluepos[1] - startGluepos[1]) / m_Resolution[2]); + loadFeet[2] = static_cast((endGluepos[2] - startGluepos[2]) / m_Resolution[3]); + loadFeet[3] = static_cast((endGluepos[3] - startGluepos[3]) / m_Resolution[4]); + if (abs(loadFeet[0]) > 20) glueaxis |= 0x01; + if (abs(loadFeet[1]) > 20) glueaxis |= 0x02; + if (abs(loadFeet[2]) > 20) glueaxis |= 0x04; + if (abs(loadFeet[3]) > 20) glueaxis |= 0x08; + send_glue_data[3] = glueaxis; + send_glue_data[4] = 0x01; + send_glue_data[5] = 0x00; + int j = 6; + for (size_t k = 0; k < 4; k++) + { + send_glue_data[j++] = (loadFeet[k] & 0xff); + send_glue_data[j++] = ((loadFeet[k] >> 8) & 0xff); + send_glue_data[j++] = ((loadFeet[k] >> 16) & 0xff); + send_glue_data[j++] = ((loadFeet[k] >> 24) & 0xff); + } + send_glue_data[0] = CT_MOTOR; + send_glue_data[1] = CT_GLUEDISPENSER_SET; + int len = j - 3; + send_glue_data[2] = len; + m_WriteByte = Send_Command(0, (const char*)send_glue_data, m_SendDataLength); + Sleep(20); } - send_glue_data[0] = CT_MOTOR; - send_glue_data[1] = CT_GLUEDISPENSER_SET; - int len = j - 3; - send_glue_data[2] = len; - m_WriteByte = Send_Command(0, (const char*)send_glue_data, m_SendDataLength); - Sleep(20); + break; } - break; - } case 1: - { - if (i == 0) { - GluerunCount++; - endGluepos[0] = gluePos[posIndex++]; - endGluepos[1] = gluePos[posIndex++]; - endGluepos[2] = gluePos[posIndex++]; - endGluepos[3] = gluePos[posIndex++]; - saveGluepos[0] = endGluepos[0]; - saveGluepos[1] = endGluepos[1]; - saveGluepos[2] = endGluepos[2]; - saveGluepos[3] = endGluepos[3]; - loadFeet[0] = (int)(endGluepos[0] / m_Resolution[1]); - loadFeet[1] = (int)(endGluepos[1] / m_Resolution[2]); - loadFeet[2] = (int)(endGluepos[2] / m_Resolution[3]); - loadFeet[3] = (int)(endGluepos[3] / m_Resolution[4]); - if (abs(loadFeet[0]) > 20) glueaxis |= 0x01; - if (abs(loadFeet[1]) > 20) glueaxis |= 0x02; - if (abs(loadFeet[2]) > 20) glueaxis |= 0x04; - if (abs(loadFeet[3]) > 20) glueaxis |= 0x08; - send_glue_data[3] = glueaxis; - send_glue_data[4] = 0x01; - send_glue_data[5] = 0x00; - int j = 6; - for (size_t k = 0; k < 4; k++) + if (i == 0) { - send_glue_data[j++] = (loadFeet[k] & 0xff); - send_glue_data[j++] = ((loadFeet[k] >> 8) & 0xff); - send_glue_data[j++] = ((loadFeet[k] >> 16) & 0xff); - send_glue_data[j++] = ((loadFeet[k] >> 24) & 0xff); + GluerunCount++; + endGluepos[0] = gluePos[posIndex++]; + endGluepos[1] = gluePos[posIndex++]; + endGluepos[2] = gluePos[posIndex++]; + endGluepos[3] = gluePos[posIndex++]; + saveGluepos[0] = endGluepos[0]; + saveGluepos[1] = endGluepos[1]; + saveGluepos[2] = endGluepos[2]; + saveGluepos[3] = endGluepos[3]; + loadFeet[0] = static_cast(endGluepos[0] / m_Resolution[1]); + loadFeet[1] = static_cast(endGluepos[1] / m_Resolution[2]); + loadFeet[2] = static_cast(endGluepos[2] / m_Resolution[3]); + loadFeet[3] = static_cast(endGluepos[3] / m_Resolution[4]); + if (abs(loadFeet[0]) > 20) glueaxis |= 0x01; + if (abs(loadFeet[1]) > 20) glueaxis |= 0x02; + if (abs(loadFeet[2]) > 20) glueaxis |= 0x04; + if (abs(loadFeet[3]) > 20) glueaxis |= 0x08; + send_glue_data[3] = glueaxis; + send_glue_data[4] = 0x01; + send_glue_data[5] = 0x00; + int j = 6; + for (size_t k = 0; k < 4; k++) + { + send_glue_data[j++] = (loadFeet[k] & 0xff); + send_glue_data[j++] = ((loadFeet[k] >> 8) & 0xff); + send_glue_data[j++] = ((loadFeet[k] >> 16) & 0xff); + send_glue_data[j++] = ((loadFeet[k] >> 24) & 0xff); + } + GluerunCount++; + glueaxis = 0; + endGluepos[0] = gluePos[posIndex++]; + endGluepos[1] = gluePos[posIndex++]; + endGluepos[2] = gluePos[posIndex++]; + endGluepos[3] = gluePos[posIndex++]; + startGluepos[0] = saveGluepos[0]; + startGluepos[1] = saveGluepos[1]; + startGluepos[2] = saveGluepos[2]; + startGluepos[3] = saveGluepos[3]; + saveGluepos[0] = endGluepos[0]; + saveGluepos[1] = endGluepos[1]; + saveGluepos[2] = endGluepos[2]; + saveGluepos[3] = endGluepos[3]; + loadFeet[0] = static_cast((endGluepos[0] - startGluepos[0]) / m_Resolution[1]); + loadFeet[1] = static_cast((endGluepos[1] - startGluepos[1]) / m_Resolution[2]); + loadFeet[2] = static_cast((endGluepos[2] - startGluepos[2]) / m_Resolution[3]); + loadFeet[3] = static_cast((endGluepos[3] - startGluepos[3]) / m_Resolution[4]); + if (abs(loadFeet[0]) > 20) glueaxis |= 0x01; + if (abs(loadFeet[1]) > 20) glueaxis |= 0x02; + if (abs(loadFeet[2]) > 20) glueaxis |= 0x04; + if (abs(loadFeet[3]) > 20) glueaxis |= 0x08; + send_glue_data[j++] = glueaxis; + send_glue_data[j++] = 0x02; + send_glue_data[j++] = 0x01; + for (size_t k = 0; k < 4; k++) + { + send_glue_data[j++] = (loadFeet[k] & 0xff); + send_glue_data[j++] = ((loadFeet[k] >> 8) & 0xff); + send_glue_data[j++] = ((loadFeet[k] >> 16) & 0xff); + send_glue_data[j++] = ((loadFeet[k] >> 24) & 0xff); + } + send_glue_data[0] = CT_MOTOR; + send_glue_data[1] = CT_GLUEDISPENSER_SET; + int len = j - 3; + send_glue_data[2] = len; + m_WriteByte = Send_Command(0, (const char*)send_glue_data, m_SendDataLength); + Sleep(20); } - GluerunCount++; - glueaxis = 0; - endGluepos[0] = gluePos[posIndex++]; - endGluepos[1] = gluePos[posIndex++]; - endGluepos[2] = gluePos[posIndex++]; - endGluepos[3] = gluePos[posIndex++]; - startGluepos[0] = saveGluepos[0]; - startGluepos[1] = saveGluepos[1]; - startGluepos[2] = saveGluepos[2]; - startGluepos[3] = saveGluepos[3]; - saveGluepos[0] = endGluepos[0]; - saveGluepos[1] = endGluepos[1]; - saveGluepos[2] = endGluepos[2]; - saveGluepos[3] = endGluepos[3]; - loadFeet[0] = (int)((endGluepos[0] - startGluepos[0]) / m_Resolution[1]); - loadFeet[1] = (int)((endGluepos[1] - startGluepos[1]) / m_Resolution[2]); - loadFeet[2] = (int)((endGluepos[2] - startGluepos[2]) / m_Resolution[3]); - loadFeet[3] = (int)((endGluepos[3] - startGluepos[3]) / m_Resolution[4]); - if (abs(loadFeet[0]) > 20) glueaxis |= 0x01; - if (abs(loadFeet[1]) > 20) glueaxis |= 0x02; - if (abs(loadFeet[2]) > 20) glueaxis |= 0x04; - if (abs(loadFeet[3]) > 20) glueaxis |= 0x08; - send_glue_data[j++] = glueaxis; - send_glue_data[j++] = 0x02; - send_glue_data[j++] = 0x01; - for (size_t k = 0; k < 4; k++) + else { - send_glue_data[j++] = (loadFeet[k] & 0xff); - send_glue_data[j++] = ((loadFeet[k] >> 8) & 0xff); - send_glue_data[j++] = ((loadFeet[k] >> 16) & 0xff); - send_glue_data[j++] = ((loadFeet[k] >> 24) & 0xff); + GluerunCount++; + glueaxis = 0; + endGluepos[0] = gluePos[posIndex++]; + endGluepos[1] = gluePos[posIndex++]; + endGluepos[2] = gluePos[posIndex++]; + endGluepos[3] = gluePos[posIndex++]; + startGluepos[0] = saveGluepos[0]; + startGluepos[1] = saveGluepos[1]; + startGluepos[2] = saveGluepos[2]; + startGluepos[3] = saveGluepos[3]; + saveGluepos[0] = endGluepos[0]; + saveGluepos[1] = endGluepos[1]; + saveGluepos[2] = endGluepos[2]; + saveGluepos[3] = endGluepos[3]; + loadFeet[0] = static_cast((endGluepos[0] - startGluepos[0]) / m_Resolution[1]); + loadFeet[1] = static_cast((endGluepos[1] - startGluepos[1]) / m_Resolution[2]); + loadFeet[2] = static_cast((endGluepos[2] - startGluepos[2]) / m_Resolution[3]); + loadFeet[3] = static_cast((endGluepos[3] - startGluepos[3]) / m_Resolution[4]); + if (abs(loadFeet[0]) > 20) glueaxis |= 0x01; + if (abs(loadFeet[1]) > 20) glueaxis |= 0x02; + if (abs(loadFeet[2]) > 20) glueaxis |= 0x04; + if (abs(loadFeet[3]) > 20) glueaxis |= 0x08; + send_glue_data[3] = glueaxis; + send_glue_data[4] = 0x02; + send_glue_data[5] = 0x00; + int j = 6; + for (size_t k = 0; k < 4; k++) + { + send_glue_data[j++] = (loadFeet[k] & 0xff); + send_glue_data[j++] = ((loadFeet[k] >> 8) & 0xff); + send_glue_data[j++] = ((loadFeet[k] >> 16) & 0xff); + send_glue_data[j++] = ((loadFeet[k] >> 24) & 0xff); + } + GluerunCount++; + glueaxis = 0; + endGluepos[0] = gluePos[posIndex++]; + endGluepos[1] = gluePos[posIndex++]; + endGluepos[2] = gluePos[posIndex++]; + endGluepos[3] = gluePos[posIndex++]; + startGluepos[0] = saveGluepos[0]; + startGluepos[1] = saveGluepos[1]; + startGluepos[2] = saveGluepos[2]; + startGluepos[3] = saveGluepos[3]; + saveGluepos[0] = endGluepos[0]; + saveGluepos[1] = endGluepos[1]; + saveGluepos[2] = endGluepos[2]; + saveGluepos[3] = endGluepos[3]; + loadFeet[0] = static_cast((endGluepos[0] - startGluepos[0]) / m_Resolution[1]); + loadFeet[1] = static_cast((endGluepos[1] - startGluepos[1]) / m_Resolution[2]); + loadFeet[2] = static_cast((endGluepos[2] - startGluepos[2]) / m_Resolution[3]); + loadFeet[3] = static_cast((endGluepos[3] - startGluepos[3]) / m_Resolution[4]); + if (abs(loadFeet[0]) > 20) glueaxis |= 0x01; + if (abs(loadFeet[1]) > 20) glueaxis |= 0x02; + if (abs(loadFeet[2]) > 20) glueaxis |= 0x04; + if (abs(loadFeet[3]) > 20) glueaxis |= 0x08; + send_glue_data[j++] = glueaxis; + send_glue_data[j++] = 0x02; + send_glue_data[j++] = 0x01; + for (size_t k = 0; k < 4; k++) + { + send_glue_data[j++] = (loadFeet[k] & 0xff); + send_glue_data[j++] = ((loadFeet[k] >> 8) & 0xff); + send_glue_data[j++] = ((loadFeet[k] >> 16) & 0xff); + send_glue_data[j++] = ((loadFeet[k] >> 24) & 0xff); + } + send_glue_data[0] = CT_MOTOR; + send_glue_data[1] = CT_GLUEDISPENSER_SET; + int len = j - 3; + send_glue_data[2] = len; + m_WriteByte = Send_Command(0, (const char*)send_glue_data, m_SendDataLength); + Sleep(20); } - send_glue_data[0] = CT_MOTOR; - send_glue_data[1] = CT_GLUEDISPENSER_SET; - int len = j - 3; - send_glue_data[2] = len; - m_WriteByte = Send_Command(0, (const char*)send_glue_data, m_SendDataLength); - Sleep(20); + break; } - else - { - GluerunCount++; - glueaxis = 0; - endGluepos[0] = gluePos[posIndex++]; - endGluepos[1] = gluePos[posIndex++]; - endGluepos[2] = gluePos[posIndex++]; - endGluepos[3] = gluePos[posIndex++]; - startGluepos[0] = saveGluepos[0]; - startGluepos[1] = saveGluepos[1]; - startGluepos[2] = saveGluepos[2]; - startGluepos[3] = saveGluepos[3]; - saveGluepos[0] = endGluepos[0]; - saveGluepos[1] = endGluepos[1]; - saveGluepos[2] = endGluepos[2]; - saveGluepos[3] = endGluepos[3]; - loadFeet[0] = (int)((endGluepos[0] - startGluepos[0]) / m_Resolution[1]); - loadFeet[1] = (int)((endGluepos[1] - startGluepos[1]) / m_Resolution[2]); - loadFeet[2] = (int)((endGluepos[2] - startGluepos[2]) / m_Resolution[3]); - loadFeet[3] = (int)((endGluepos[3] - startGluepos[3]) / m_Resolution[4]); - if (abs(loadFeet[0]) > 20) glueaxis |= 0x01; - if (abs(loadFeet[1]) > 20) glueaxis |= 0x02; - if (abs(loadFeet[2]) > 20) glueaxis |= 0x04; - if (abs(loadFeet[3]) > 20) glueaxis |= 0x08; - send_glue_data[3] = glueaxis; - send_glue_data[4] = 0x02; - send_glue_data[5] = 0x00; - int j = 6; - for (size_t k = 0; k < 4; k++) - { - send_glue_data[j++] = (loadFeet[k] & 0xff); - send_glue_data[j++] = ((loadFeet[k] >> 8) & 0xff); - send_glue_data[j++] = ((loadFeet[k] >> 16) & 0xff); - send_glue_data[j++] = ((loadFeet[k] >> 24) & 0xff); - } - GluerunCount++; - glueaxis = 0; - endGluepos[0] = gluePos[posIndex++]; - endGluepos[1] = gluePos[posIndex++]; - endGluepos[2] = gluePos[posIndex++]; - endGluepos[3] = gluePos[posIndex++]; - startGluepos[0] = saveGluepos[0]; - startGluepos[1] = saveGluepos[1]; - startGluepos[2] = saveGluepos[2]; - startGluepos[3] = saveGluepos[3]; - saveGluepos[0] = endGluepos[0]; - saveGluepos[1] = endGluepos[1]; - saveGluepos[2] = endGluepos[2]; - saveGluepos[3] = endGluepos[3]; - loadFeet[0] = (int)((endGluepos[0] - startGluepos[0]) / m_Resolution[1]); - loadFeet[1] = (int)((endGluepos[1] - startGluepos[1]) / m_Resolution[2]); - loadFeet[2] = (int)((endGluepos[2] - startGluepos[2]) / m_Resolution[3]); - loadFeet[3] = (int)((endGluepos[3] - startGluepos[3]) / m_Resolution[4]); - if (abs(loadFeet[0]) > 20) glueaxis |= 0x01; - if (abs(loadFeet[1]) > 20) glueaxis |= 0x02; - if (abs(loadFeet[2]) > 20) glueaxis |= 0x04; - if (abs(loadFeet[3]) > 20) glueaxis |= 0x08; - send_glue_data[j++] = glueaxis; - send_glue_data[j++] = 0x02; - send_glue_data[j++] = 0x01; - for (size_t k = 0; k < 4; k++) - { - send_glue_data[j++] = (loadFeet[k] & 0xff); - send_glue_data[j++] = ((loadFeet[k] >> 8) & 0xff); - send_glue_data[j++] = ((loadFeet[k] >> 16) & 0xff); - send_glue_data[j++] = ((loadFeet[k] >> 24) & 0xff); - } - send_glue_data[0] = CT_MOTOR; - send_glue_data[1] = CT_GLUEDISPENSER_SET; - int len = j - 3; - send_glue_data[2] = len; - m_WriteByte = Send_Command(0, (const char*)send_glue_data, m_SendDataLength); - Sleep(20); - } - break; - } case 3: - { - if (i == 0) { - GluerunCount++; - endGluepos[0] = gluePos[posIndex++]; - endGluepos[1] = gluePos[posIndex++]; - endGluepos[2] = gluePos[posIndex++]; - endGluepos[3] = gluePos[posIndex++]; - saveGluepos[0] = endGluepos[0]; - saveGluepos[1] = endGluepos[1]; - saveGluepos[2] = endGluepos[2]; - saveGluepos[3] = endGluepos[3]; - loadFeet[0] = (int)(endGluepos[0] / m_Resolution[1]); - loadFeet[1] = (int)(endGluepos[1] / m_Resolution[2]); - loadFeet[2] = (int)(endGluepos[2] / m_Resolution[3]); - loadFeet[3] = (int)(endGluepos[3] / m_Resolution[4]); - if (abs(loadFeet[0]) > 20) glueaxis |= 0x01; - if (abs(loadFeet[1]) > 20) glueaxis |= 0x02; - if (abs(loadFeet[2]) > 20) glueaxis |= 0x04; - if (abs(loadFeet[3]) > 20) glueaxis |= 0x08; - send_glue_data[3] = glueaxis; - send_glue_data[4] = 0x01; - send_glue_data[5] = 0x00; - int j = 6; - for (size_t k = 0; k < 4; k++) + if (i == 0) { - send_glue_data[j++] = (loadFeet[k] & 0xff); - send_glue_data[j++] = ((loadFeet[k] >> 8) & 0xff); - send_glue_data[j++] = ((loadFeet[k] >> 16) & 0xff); - send_glue_data[j++] = ((loadFeet[k] >> 24) & 0xff); - } - GluerunCount++; - glueaxis = 0; - endGluepos[0] = gluePos[posIndex++]; - endGluepos[1] = gluePos[posIndex++]; - endGluepos[2] = gluePos[posIndex++]; - endGluepos[3] = gluePos[posIndex++]; - startGluepos[0] = saveGluepos[0]; - startGluepos[1] = saveGluepos[1]; - startGluepos[2] = saveGluepos[2]; - startGluepos[3] = saveGluepos[3]; - circlepnt[0] = (int)((gluePos[posIndex++] - startGluepos[0]) / m_Resolution[1]); - circlepnt[1] = (int)((gluePos[posIndex++] - startGluepos[1]) / m_Resolution[2]); - circlepnt[2] = (int)((gluePos[posIndex++] - startGluepos[2]) / m_Resolution[3]); - circlepnt[3] = (int)((gluePos[posIndex++] - startGluepos[3]) / m_Resolution[4]); - saveGluepos[0] = endGluepos[0]; - saveGluepos[1] = endGluepos[1]; - saveGluepos[2] = endGluepos[2]; - saveGluepos[3] = endGluepos[3]; - loadFeet[0] = (int)((endGluepos[0] - startGluepos[0]) / m_Resolution[1]); - loadFeet[1] = (int)((endGluepos[1] - startGluepos[1]) / m_Resolution[2]); - loadFeet[2] = (int)((endGluepos[2] - startGluepos[2]) / m_Resolution[3]); - loadFeet[3] = (int)((endGluepos[3] - startGluepos[3]) / m_Resolution[4]); - if (abs(loadFeet[0]) > 20) glueaxis |= 0x01; - if (abs(loadFeet[1]) > 20) glueaxis |= 0x02; - if (abs(loadFeet[2]) > 20) glueaxis |= 0x04; - if (abs(loadFeet[3]) > 20) glueaxis |= 0x08; - send_glue_data[j++] = 0x03; - if (cirdirection[i] == 0) - { - send_glue_data[j++] = 0x04; + GluerunCount++; + endGluepos[0] = gluePos[posIndex++]; + endGluepos[1] = gluePos[posIndex++]; + endGluepos[2] = gluePos[posIndex++]; + endGluepos[3] = gluePos[posIndex++]; + saveGluepos[0] = endGluepos[0]; + saveGluepos[1] = endGluepos[1]; + saveGluepos[2] = endGluepos[2]; + saveGluepos[3] = endGluepos[3]; + loadFeet[0] = static_cast(endGluepos[0] / m_Resolution[1]); + loadFeet[1] = static_cast(endGluepos[1] / m_Resolution[2]); + loadFeet[2] = static_cast(endGluepos[2] / m_Resolution[3]); + loadFeet[3] = static_cast(endGluepos[3] / m_Resolution[4]); + if (abs(loadFeet[0]) > 20) glueaxis |= 0x01; + if (abs(loadFeet[1]) > 20) glueaxis |= 0x02; + if (abs(loadFeet[2]) > 20) glueaxis |= 0x04; + if (abs(loadFeet[3]) > 20) glueaxis |= 0x08; + send_glue_data[3] = glueaxis; + send_glue_data[4] = 0x01; + send_glue_data[5] = 0x00; + int j = 6; + for (size_t k = 0; k < 4; k++) + { + send_glue_data[j++] = (loadFeet[k] & 0xff); + send_glue_data[j++] = ((loadFeet[k] >> 8) & 0xff); + send_glue_data[j++] = ((loadFeet[k] >> 16) & 0xff); + send_glue_data[j++] = ((loadFeet[k] >> 24) & 0xff); + } + GluerunCount++; + glueaxis = 0; + endGluepos[0] = gluePos[posIndex++]; + endGluepos[1] = gluePos[posIndex++]; + endGluepos[2] = gluePos[posIndex++]; + endGluepos[3] = gluePos[posIndex++]; + startGluepos[0] = saveGluepos[0]; + startGluepos[1] = saveGluepos[1]; + startGluepos[2] = saveGluepos[2]; + startGluepos[3] = saveGluepos[3]; + circlepnt[0] = static_cast((gluePos[posIndex++] - startGluepos[0]) / m_Resolution[1]); + circlepnt[1] = static_cast((gluePos[posIndex++] - startGluepos[1]) / m_Resolution[2]); + circlepnt[2] = static_cast((gluePos[posIndex++] - startGluepos[2]) / m_Resolution[3]); + circlepnt[3] = static_cast((gluePos[posIndex++] - startGluepos[3]) / m_Resolution[4]); + saveGluepos[0] = endGluepos[0]; + saveGluepos[1] = endGluepos[1]; + saveGluepos[2] = endGluepos[2]; + saveGluepos[3] = endGluepos[3]; + loadFeet[0] = static_cast((endGluepos[0] - startGluepos[0]) / m_Resolution[1]); + loadFeet[1] = static_cast((endGluepos[1] - startGluepos[1]) / m_Resolution[2]); + loadFeet[2] = static_cast((endGluepos[2] - startGluepos[2]) / m_Resolution[3]); + loadFeet[3] = static_cast((endGluepos[3] - startGluepos[3]) / m_Resolution[4]); + if (abs(loadFeet[0]) > 20) glueaxis |= 0x01; + if (abs(loadFeet[1]) > 20) glueaxis |= 0x02; + if (abs(loadFeet[2]) > 20) glueaxis |= 0x04; + if (abs(loadFeet[3]) > 20) glueaxis |= 0x08; + send_glue_data[j++] = 0x03; + if (cirdirection[i] == 0) + { + send_glue_data[j++] = 0x04; + } + else + { + send_glue_data[j++] = 0x03; + } + send_glue_data[j++] = 0x01; + for (size_t k = 0; k < 4; k++) + { + send_glue_data[j++] = (loadFeet[k] & 0xff); + send_glue_data[j++] = ((loadFeet[k] >> 8) & 0xff); + send_glue_data[j++] = ((loadFeet[k] >> 16) & 0xff); + send_glue_data[j++] = ((loadFeet[k] >> 24) & 0xff); + } + for (size_t k = 0; k < 4; k++) + { + send_glue_data[j++] = (circlepnt[k] & 0xff); + send_glue_data[j++] = ((circlepnt[k] >> 8) & 0xff); + send_glue_data[j++] = ((circlepnt[k] >> 16) & 0xff); + send_glue_data[j++] = ((circlepnt[k] >> 24) & 0xff); + } + send_glue_data[0] = CT_MOTOR; + send_glue_data[1] = CT_GLUEDISPENSER_SET; + int len = j - 3; + send_glue_data[2] = len; + m_WriteByte = Send_Command(0, (const char*)send_glue_data, m_SendDataLength); + Sleep(20); } else { + GluerunCount++; + glueaxis = 0; + endGluepos[0] = gluePos[posIndex++]; + endGluepos[1] = gluePos[posIndex++]; + endGluepos[2] = gluePos[posIndex++]; + endGluepos[3] = gluePos[posIndex++]; + startGluepos[0] = saveGluepos[0]; + startGluepos[1] = saveGluepos[1]; + startGluepos[2] = saveGluepos[2]; + startGluepos[3] = saveGluepos[3]; + saveGluepos[0] = endGluepos[0]; + saveGluepos[1] = endGluepos[1]; + saveGluepos[2] = endGluepos[2]; + saveGluepos[3] = endGluepos[3]; + loadFeet[0] = static_cast((endGluepos[0] - startGluepos[0]) / m_Resolution[1]); + loadFeet[1] = static_cast((endGluepos[1] - startGluepos[1]) / m_Resolution[2]); + loadFeet[2] = static_cast((endGluepos[2] - startGluepos[2]) / m_Resolution[3]); + loadFeet[3] = static_cast((endGluepos[3] - startGluepos[3]) / m_Resolution[4]); + if (abs(loadFeet[0]) > 20) glueaxis |= 0x01; + if (abs(loadFeet[1]) > 20) glueaxis |= 0x02; + if (abs(loadFeet[2]) > 20) glueaxis |= 0x04; + if (abs(loadFeet[3]) > 20) glueaxis |= 0x08; + send_glue_data[3] = glueaxis; + send_glue_data[4] = 0x02; + send_glue_data[5] = 0x00; + int j = 6; + for (size_t k = 0; k < 4; k++) + { + send_glue_data[j++] = (loadFeet[k] & 0xff); + send_glue_data[j++] = ((loadFeet[k] >> 8) & 0xff); + send_glue_data[j++] = ((loadFeet[k] >> 16) & 0xff); + send_glue_data[j++] = ((loadFeet[k] >> 24) & 0xff); + } + GluerunCount++; + glueaxis = 0; + endGluepos[0] = gluePos[posIndex++]; + endGluepos[1] = gluePos[posIndex++]; + endGluepos[2] = gluePos[posIndex++]; + endGluepos[3] = gluePos[posIndex++]; + startGluepos[0] = saveGluepos[0]; + startGluepos[1] = saveGluepos[1]; + startGluepos[2] = saveGluepos[2]; + startGluepos[3] = saveGluepos[3]; + circlepnt[0] = static_cast((gluePos[posIndex++] - startGluepos[0]) / m_Resolution[1]); + circlepnt[1] = static_cast((gluePos[posIndex++] - startGluepos[1]) / m_Resolution[2]); + circlepnt[2] = static_cast((gluePos[posIndex++] - startGluepos[2]) / m_Resolution[3]); + circlepnt[3] = static_cast((gluePos[posIndex++] - startGluepos[3]) / m_Resolution[4]); + saveGluepos[0] = endGluepos[0]; + saveGluepos[1] = endGluepos[1]; + saveGluepos[2] = endGluepos[2]; + saveGluepos[3] = endGluepos[3]; + loadFeet[0] = static_cast((endGluepos[0] - startGluepos[0]) / m_Resolution[1]); + loadFeet[1] = static_cast((endGluepos[1] - startGluepos[1]) / m_Resolution[2]); + loadFeet[2] = static_cast((endGluepos[2] - startGluepos[2]) / m_Resolution[3]); + loadFeet[3] = static_cast((endGluepos[3] - startGluepos[3]) / m_Resolution[4]); + if (abs(loadFeet[0]) > 20) glueaxis |= 0x01; + if (abs(loadFeet[1]) > 20) glueaxis |= 0x02; + if (abs(loadFeet[2]) > 20) glueaxis |= 0x04; + if (abs(loadFeet[3]) > 20) glueaxis |= 0x08; send_glue_data[j++] = 0x03; + if (cirdirection[i] == 0) + { + send_glue_data[j++] = 0x04; + } + else + { + send_glue_data[j++] = 0x03; + } + send_glue_data[j++] = 0x01; + for (size_t k = 0; k < 4; k++) + { + send_glue_data[j++] = (loadFeet[k] & 0xff); + send_glue_data[j++] = ((loadFeet[k] >> 8) & 0xff); + send_glue_data[j++] = ((loadFeet[k] >> 16) & 0xff); + send_glue_data[j++] = ((loadFeet[k] >> 24) & 0xff); + } + for (size_t k = 0; k < 4; k++) + { + send_glue_data[j++] = (circlepnt[k] & 0xff); + send_glue_data[j++] = ((circlepnt[k] >> 8) & 0xff); + send_glue_data[j++] = ((circlepnt[k] >> 16) & 0xff); + send_glue_data[j++] = ((circlepnt[k] >> 24) & 0xff); + } + send_glue_data[0] = CT_MOTOR; + send_glue_data[1] = CT_GLUEDISPENSER_SET; + int len = j - 3; + send_glue_data[2] = len; + m_WriteByte = Send_Command(0, (const char*)send_glue_data, m_SendDataLength); + Sleep(20); } - send_glue_data[j++] = 0x01; - for (size_t k = 0; k < 4; k++) - { - send_glue_data[j++] = (loadFeet[k] & 0xff); - send_glue_data[j++] = ((loadFeet[k] >> 8) & 0xff); - send_glue_data[j++] = ((loadFeet[k] >> 16) & 0xff); - send_glue_data[j++] = ((loadFeet[k] >> 24) & 0xff); - } - for (size_t k = 0; k < 4; k++) - { - send_glue_data[j++] = (circlepnt[k] & 0xff); - send_glue_data[j++] = ((circlepnt[k] >> 8) & 0xff); - send_glue_data[j++] = ((circlepnt[k] >> 16) & 0xff); - send_glue_data[j++] = ((circlepnt[k] >> 24) & 0xff); - } - send_glue_data[0] = CT_MOTOR; - send_glue_data[1] = CT_GLUEDISPENSER_SET; - int len = j - 3; - send_glue_data[2] = len; - m_WriteByte = Send_Command(0, (const char*)send_glue_data, m_SendDataLength); - Sleep(20); + break; } - else - { - GluerunCount++; - glueaxis = 0; - endGluepos[0] = gluePos[posIndex++]; - endGluepos[1] = gluePos[posIndex++]; - endGluepos[2] = gluePos[posIndex++]; - endGluepos[3] = gluePos[posIndex++]; - startGluepos[0] = saveGluepos[0]; - startGluepos[1] = saveGluepos[1]; - startGluepos[2] = saveGluepos[2]; - startGluepos[3] = saveGluepos[3]; - saveGluepos[0] = endGluepos[0]; - saveGluepos[1] = endGluepos[1]; - saveGluepos[2] = endGluepos[2]; - saveGluepos[3] = endGluepos[3]; - loadFeet[0] = (int)((endGluepos[0] - startGluepos[0]) / m_Resolution[1]); - loadFeet[1] = (int)((endGluepos[1] - startGluepos[1]) / m_Resolution[2]); - loadFeet[2] = (int)((endGluepos[2] - startGluepos[2]) / m_Resolution[3]); - loadFeet[3] = (int)((endGluepos[3] - startGluepos[3]) / m_Resolution[4]); - if (abs(loadFeet[0]) > 20) glueaxis |= 0x01; - if (abs(loadFeet[1]) > 20) glueaxis |= 0x02; - if (abs(loadFeet[2]) > 20) glueaxis |= 0x04; - if (abs(loadFeet[3]) > 20) glueaxis |= 0x08; - send_glue_data[3] = glueaxis; - send_glue_data[4] = 0x02; - send_glue_data[5] = 0x00; - int j = 6; - for (size_t k = 0; k < 4; k++) - { - send_glue_data[j++] = (loadFeet[k] & 0xff); - send_glue_data[j++] = ((loadFeet[k] >> 8) & 0xff); - send_glue_data[j++] = ((loadFeet[k] >> 16) & 0xff); - send_glue_data[j++] = ((loadFeet[k] >> 24) & 0xff); - } - GluerunCount++; - glueaxis = 0; - endGluepos[0] = gluePos[posIndex++]; - endGluepos[1] = gluePos[posIndex++]; - endGluepos[2] = gluePos[posIndex++]; - endGluepos[3] = gluePos[posIndex++]; - startGluepos[0] = saveGluepos[0]; - startGluepos[1] = saveGluepos[1]; - startGluepos[2] = saveGluepos[2]; - startGluepos[3] = saveGluepos[3]; - circlepnt[0] = (int)((gluePos[posIndex++] - startGluepos[0]) / m_Resolution[1]); - circlepnt[1] = (int)((gluePos[posIndex++] - startGluepos[1]) / m_Resolution[2]); - circlepnt[2] = (int)((gluePos[posIndex++] - startGluepos[2]) / m_Resolution[3]); - circlepnt[3] = (int)((gluePos[posIndex++] - startGluepos[3]) / m_Resolution[4]); - saveGluepos[0] = endGluepos[0]; - saveGluepos[1] = endGluepos[1]; - saveGluepos[2] = endGluepos[2]; - saveGluepos[3] = endGluepos[3]; - loadFeet[0] = (int)((endGluepos[0] - startGluepos[0]) / m_Resolution[1]); - loadFeet[1] = (int)((endGluepos[1] - startGluepos[1]) / m_Resolution[2]); - loadFeet[2] = (int)((endGluepos[2] - startGluepos[2]) / m_Resolution[3]); - loadFeet[3] = (int)((endGluepos[3] - startGluepos[3]) / m_Resolution[4]); - if (abs(loadFeet[0]) > 20) glueaxis |= 0x01; - if (abs(loadFeet[1]) > 20) glueaxis |= 0x02; - if (abs(loadFeet[2]) > 20) glueaxis |= 0x04; - if (abs(loadFeet[3]) > 20) glueaxis |= 0x08; - send_glue_data[j++] = 0x03; - if (cirdirection[i] == 0) - { - send_glue_data[j++] = 0x04; - } - else - { - send_glue_data[j++] = 0x03; - } - send_glue_data[j++] = 0x01; - for (size_t k = 0; k < 4; k++) - { - send_glue_data[j++] = (loadFeet[k] & 0xff); - send_glue_data[j++] = ((loadFeet[k] >> 8) & 0xff); - send_glue_data[j++] = ((loadFeet[k] >> 16) & 0xff); - send_glue_data[j++] = ((loadFeet[k] >> 24) & 0xff); - } - for (size_t k = 0; k < 4; k++) - { - send_glue_data[j++] = (circlepnt[k] & 0xff); - send_glue_data[j++] = ((circlepnt[k] >> 8) & 0xff); - send_glue_data[j++] = ((circlepnt[k] >> 16) & 0xff); - send_glue_data[j++] = ((circlepnt[k] >> 24) & 0xff); - } - send_glue_data[0] = CT_MOTOR; - send_glue_data[1] = CT_GLUEDISPENSER_SET; - int len = j - 3; - send_glue_data[2] = len; - m_WriteByte = Send_Command(0, (const char*)send_glue_data, m_SendDataLength); - Sleep(20); - } - break; - } default: break; } @@ -5158,6 +5414,7 @@ HSI_STATUS HSI_Motion::GlueDispenser(int* index, int* cirdirection, double* glue } return rStatus; } + HSI_STATUS HSI_Motion::GlueDispenserStart(double xOffset, double yOffset, double qOffset) { auto rStatus = HSI_STATUS_NORMAL; @@ -5166,7 +5423,7 @@ HSI_STATUS HSI_Motion::GlueDispenserStart(double xOffset, double yOffset, double int xSkew = xOffset / m_Resolution[1]; int ySkew = yOffset / m_Resolution[2]; int qSkew = qOffset / m_Resolution[1]; - unsigned char send_glue_data[64] = { 0 }; + unsigned char send_glue_data[64] = {0}; send_glue_data[0] = CT_MOTOR; send_glue_data[1] = CT_GLUEDISPENSER_START; send_glue_data[2] = GlueDispenserindexNum + 1; @@ -5183,7 +5440,9 @@ HSI_STATUS HSI_Motion::GlueDispenserStart(double xOffset, double yOffset, double send_glue_data[13] = ((ySkew >> 8) & 0xff); send_glue_data[14] = (qSkew & 0xff); send_glue_data[15] = ((qSkew >> 8) & 0xff); - g_pLogger->SendAndFlushWithTime(L"[GlueDispenser] m_SetPotion_StartSpeed = %d, m_SetPotion_DriveSpeed = %d,m_SetPotion_Line = %d \n", m_SetPotion_StartSpeed[1], m_SetPotion_DriveSpeed[1], m_SetPotion_Line[1]); + g_pLogger->SendAndFlushWithTime( + L"[GlueDispenser] m_SetPotion_StartSpeed = %d, m_SetPotion_DriveSpeed = %d,m_SetPotion_Line = %d \n", + m_SetPotion_StartSpeed[1], m_SetPotion_DriveSpeed[1], m_SetPotion_Line[1]); m_WriteByte = Send_Command(0, (const char*)send_glue_data, m_SendDataLength); Sleep(5); g_IsClose = false; @@ -5194,7 +5453,8 @@ HSI_STATUS HSI_Motion::GlueDispenserStart(double xOffset, double yOffset, double } return rStatus; } -void HSI_Motion::GluedispenserDone()//Ϳ + +void HSI_Motion::GluedispenserDone() //Ϳ { if (bRunGlueDispenser == HSI_THREAD_RUNNING) { @@ -5211,7 +5471,7 @@ void HSI_Motion::GluedispenserDone()//Ϳ { if ((m_SO7_Serial.m_RecvData[60] & 0x0f)) { - g_pLogger->SendAndFlushWithTime(L"[GluedispenserDone] Run End Normal\n");//Ϳ + g_pLogger->SendAndFlushWithTime(L"[GluedispenserDone] Run End Normal\n"); //Ϳ m_SO7_Serial.m_RecvData[60] = 0; break; } @@ -5223,7 +5483,8 @@ void HSI_Motion::GluedispenserDone()//Ϳ g_pLogger->SendAndFlushWithTime(L"[GluedispenserDone] Run End Abnormal\n"); break; } - } while (true); + } + while (true); bRunGlueDispenser = HSI_THREAD_PAUSED; sEvenProp.Init(); sEvenProp.EventType = HSI_EVENT_FUNCTION; @@ -5232,6 +5493,7 @@ void HSI_Motion::GluedispenserDone()//Ϳ EventCallback(sEvenProp); } } + //=========================================================================== HSI_STATUS HSI_Motion::GetPntsDistance(double& pDistance, int& spTimeCount) { @@ -5240,7 +5502,8 @@ HSI_STATUS HSI_Motion::GetPntsDistance(double& pDistance, int& spTimeCount) { if (SetPotionRunEnd) { - g_pLogger->SendAndFlushWithTime(L"[GetPntsDistance] PTPDistance = %.4f,spTimeCount = %d\n", PntToPntDistance, SpTimeCount); + g_pLogger->SendAndFlushWithTime(L"[GetPntsDistance] PTPDistance = %.4f,spTimeCount = %d\n", + PntToPntDistance, SpTimeCount); SetPotionRunEnd = false; pDistance = PntToPntDistance; spTimeCount = SpTimeCount; @@ -5253,8 +5516,10 @@ HSI_STATUS HSI_Motion::GetPntsDistance(double& pDistance, int& spTimeCount) } return rStatus; } + //========================˶Ʋȡ=================================================== -int HSI_Motion::SpeedPercent(int AxisNum, double &Speed, int &DirveSpeed, int &StartSpeed, int &AccLine, int &DecLine, int &AccCurve, int &DecCurve) +int HSI_Motion::SpeedPercent(int AxisNum, double& Speed, int& DirveSpeed, int& StartSpeed, int& AccLine, int& DecLine, + int& AccCurve, int& DecCurve) { int MovetoSpeedGear = 0; int flag = 1; @@ -5270,7 +5535,6 @@ int HSI_Motion::SpeedPercent(int AxisNum, double &Speed, int &DirveSpeed, int &S DecLine = m_JogDecLine[AxisNum][0]; AccCurve = m_JogAccCurve[AxisNum][0]; DecCurve = m_JogDecCurve[AxisNum][0]; - } else if (fabs(Speed) > 0.61) { @@ -5313,15 +5577,17 @@ int HSI_Motion::SpeedPercent(int AxisNum, double &Speed, int &DirveSpeed, int &S MovetoSpeedGear = 0; } Speed = MovetoSpeedGear * flag; - return (int)Speed; + return static_cast(Speed); } + //==========================JoyStick˶Ʋȡ================================================= -bool HSI_Motion::SpeedPercentJoyStick(int AxisNum, long &Speed, int &DirveSpeed, int &StartSpeed, int &AccLine, int &DecLine, int &AccCurve, int &DecCurve) +bool HSI_Motion::SpeedPercentJoyStick(int AxisNum, long& Speed, int& DirveSpeed, int& StartSpeed, int& AccLine, + int& DecLine, int& AccCurve, int& DecCurve) { Speed = Speed > 1000 ? 1000 : Speed; - double dSpeedRate = (double)Speed / 1000; - DirveSpeed = m_JogDriveSpeed[AxisNum][0] * (dSpeedRate*dSpeedRate); - if (DirveSpeed >m_JogDriveSpeed[AxisNum][1]) + double dSpeedRate = static_cast(Speed) / 1000; + DirveSpeed = m_JogDriveSpeed[AxisNum][0] * (dSpeedRate * dSpeedRate); + if (DirveSpeed > m_JogDriveSpeed[AxisNum][1]) { DirveSpeed = m_JogDriveSpeed[AxisNum][0]; StartSpeed = m_JogStartSpeed[AxisNum][0]; @@ -5330,7 +5596,7 @@ bool HSI_Motion::SpeedPercentJoyStick(int AxisNum, long &Speed, int &DirveSpeed, AccCurve = m_JogAccCurve[AxisNum][0]; DecCurve = m_JogDecCurve[AxisNum][0]; } - else if (DirveSpeed >m_JogDriveSpeed[AxisNum][2]) + else if (DirveSpeed > m_JogDriveSpeed[AxisNum][2]) { StartSpeed = m_JogStartSpeed[AxisNum][1]; AccLine = m_JogAccLine[AxisNum][1]; @@ -5338,7 +5604,7 @@ bool HSI_Motion::SpeedPercentJoyStick(int AxisNum, long &Speed, int &DirveSpeed, AccCurve = m_JogAccCurve[AxisNum][1]; DecCurve = m_JogDecCurve[AxisNum][1]; } - else if (DirveSpeed >m_JogDriveSpeed[AxisNum][3]) + else if (DirveSpeed > m_JogDriveSpeed[AxisNum][3]) { StartSpeed = m_JogStartSpeed[AxisNum][2]; AccLine = m_JogAccLine[AxisNum][2]; @@ -5346,7 +5612,7 @@ bool HSI_Motion::SpeedPercentJoyStick(int AxisNum, long &Speed, int &DirveSpeed, AccCurve = m_JogAccCurve[AxisNum][2]; DecCurve = m_JogDecCurve[AxisNum][2]; } - else if (DirveSpeed >m_JogDriveSpeed[AxisNum][4]) + else if (DirveSpeed > m_JogDriveSpeed[AxisNum][4]) { StartSpeed = m_JogStartSpeed[AxisNum][3]; AccLine = m_JogAccLine[AxisNum][3]; @@ -5368,13 +5634,14 @@ bool HSI_Motion::SpeedPercentJoyStick(int AxisNum, long &Speed, int &DirveSpeed, } return true; } + //=========================================================================== -HSI_STATUS HSI_Motion::GetSpeedXyz(int AxisNum, double &Speed) +HSI_STATUS HSI_Motion::GetSpeedXyz(int AxisNum, double& Speed) { g_pLogger->SendAndFlushWithTime(L"[GetSpeedXyz] In\n"); auto rStatus = HSI_STATUS_NORMAL; short AxisNumber = AxisConvertIndex(AxisNum); - if (1==m_iSpeedType) + if (1 == m_iSpeedType) { Speed = m_SetPotion_DriveSpeed[AxisNumber] * (m_Resolution[AxisNumber] * 50); } @@ -5385,6 +5652,7 @@ HSI_STATUS HSI_Motion::GetSpeedXyz(int AxisNum, double &Speed) g_pLogger->SendAndFlushWithTime(L"[GetSpeedXyz] Out\n"); return rStatus; } + //=========================================================================== HSI_STATUS HSI_Motion::SetSpeedXyz(double Speed) { @@ -5393,7 +5661,7 @@ HSI_STATUS HSI_Motion::SetSpeedXyz(double Speed) if (Speed >= -1 && Speed <= 0) { g_pLogger->SendAndFlushWithTime(L"[SetSpeedXyz] Speed = %f, m_Jog_Auto_Focus = %f\n", Speed, m_Jog_Auto_Focus); - m_JogDriveSpeed[3][4] = (int)fabs(Speed * m_Jog_Auto_Focus); + m_JogDriveSpeed[3][4] = static_cast(fabs(Speed * m_Jog_Auto_Focus)); g_pLogger->SendAndFlushWithTime(L"[SetSpeedXyz] m_Jog_SpeedZ[3][4] = %f\n", m_JogDriveSpeed[3][4]); } else @@ -5401,7 +5669,7 @@ HSI_STATUS HSI_Motion::SetSpeedXyz(double Speed) g_pLogger->SendAndFlushWithTime(L"[SetSpeedXyz] Speed = %f\n", Speed); if (1 == m_iSpeedType) { - m_SetPotion_DriveSpeed[1] = (int)(Speed / (m_Resolution[1] * 50)); + m_SetPotion_DriveSpeed[1] = static_cast(Speed / (m_Resolution[1] * 50)); if (m_SetPotion_DriveSpeed[1] > 1000 / (m_Resolution[1] * 50)) { m_SetPotion_DriveSpeed[1] = 1000 / (m_Resolution[1] * 50); @@ -5413,7 +5681,7 @@ HSI_STATUS HSI_Motion::SetSpeedXyz(double Speed) } else { - m_SetPotion_DriveSpeed[1] = (int)Speed; + m_SetPotion_DriveSpeed[1] = static_cast(Speed); if (m_SetPotion_DriveSpeed[1] > 1000 / (m_Resolution[1] * 50)) { m_SetPotion_DriveSpeed[1] = 1000 / (m_Resolution[1] * 50); @@ -5427,12 +5695,13 @@ HSI_STATUS HSI_Motion::SetSpeedXyz(double Speed) g_pLogger->SendAndFlushWithTime(L"[SetSpeedXyz] Out\n"); return rStatus; } + //=========================================================================== -HSI_STATUS HSI_Motion::GetFocusSpeed(double &Speed) +HSI_STATUS HSI_Motion::GetFocusSpeed(double& Speed) { g_pLogger->SendAndFlushWithTime(L"[GetFocusSpeed] In\n"); auto rStatus = HSI_STATUS_NORMAL; - if (1==m_iSpeedType) + if (1 == m_iSpeedType) { Speed = m_JogDriveSpeed[3][4] * (m_Resolution[3] * 50); } @@ -5443,6 +5712,7 @@ HSI_STATUS HSI_Motion::GetFocusSpeed(double &Speed) g_pLogger->SendAndFlushWithTime(L"[GetFocusSpeed] Out\n"); return rStatus; } + //=========================================================================== HSI_STATUS HSI_Motion::SetFocusSpeed(double Speed) { @@ -5450,7 +5720,7 @@ HSI_STATUS HSI_Motion::SetFocusSpeed(double Speed) g_pLogger->SendAndFlushWithTime(L"[SetFocusSpeed] In\n"); g_pLogger->SendAndFlushWithTime(L"[SetFocusSpeed] Speed = %f, m_Jog_Auto_Focus = %f\n", Speed, m_Jog_Auto_Focus); - if (1==m_iSpeedType) + if (1 == m_iSpeedType) { m_JogDriveSpeed[3][4] = Speed / (m_Resolution[3] * 50); } @@ -5461,20 +5731,23 @@ HSI_STATUS HSI_Motion::SetFocusSpeed(double Speed) g_pLogger->SendAndFlushWithTime(L"[SetFocusSpeed] m_Jog_SpeedZ[3][4] = %f\n", m_JogDriveSpeed[4][3]); return rStatus; } + //=========================================================================== -HSI_STATUS HSI_Motion::GetAccelerationXyz(double &AccelX, double &AccelY, double &AccelZ) +HSI_STATUS HSI_Motion::GetAccelerationXyz(double& AccelX, double& AccelY, double& AccelZ) { auto rStatus = HSI_STATUS_NORMAL; return rStatus; } + //=========================================================================== -HSI_STATUS HSI_Motion::SetAccelerationXyz(double AccelX, double AccelY, double AccelZ) +HSI_STATUS HSI_Motion::SetAccelerationXyz(double AccelX, double AccelY, double AccelZ) { auto rStatus = HSI_STATUS_NORMAL; return rStatus; } + //=========================================================================== -double HSI_Motion::LimitOver(UINT AxisTypes, double &LimitPos) +double HSI_Motion::LimitOver(UINT AxisTypes, double& LimitPos) { short AxisNumber = AxisConvertIndex(AxisTypes); if (g_pHSI_Motion) @@ -5482,60 +5755,60 @@ double HSI_Motion::LimitOver(UINT AxisTypes, double &LimitPos) switch (AxisNumber) { case 1: //1 - { - if (LimitPos >= m_P_Work_Limit[1]) { - LimitPos = m_P_Work_Limit[1] - 5 * m_Resolution[1]; + if (LimitPos >= m_P_Work_Limit[1]) + { + LimitPos = m_P_Work_Limit[1] - 5 * m_Resolution[1]; + } + if (LimitPos <= m_N_Work_Limit[1]) + { + LimitPos = m_N_Work_Limit[1] + 5 * m_Resolution[1]; + } + break; } - if (LimitPos <= m_N_Work_Limit[1]) - { - LimitPos = m_N_Work_Limit[1] + 5 * m_Resolution[1]; - } - break; - } case 2: - { - if (LimitPos >= m_P_Work_Limit[2]) { - LimitPos = m_P_Work_Limit[2] - 5 * m_Resolution[2]; + if (LimitPos >= m_P_Work_Limit[2]) + { + LimitPos = m_P_Work_Limit[2] - 5 * m_Resolution[2]; + } + if (LimitPos <= m_N_Work_Limit[2]) + { + LimitPos = m_N_Work_Limit[2] + 5 * m_Resolution[2]; + } + break; } - if (LimitPos <= m_N_Work_Limit[2]) - { - LimitPos = m_N_Work_Limit[2] + 5 * m_Resolution[2]; - } - break; - } case 3: - { - if (LimitPos >= m_P_Work_Limit[3]) { - LimitPos = m_P_Work_Limit[3] - 5 * m_Resolution[3]; + if (LimitPos >= m_P_Work_Limit[3]) + { + LimitPos = m_P_Work_Limit[3] - 5 * m_Resolution[3]; + } + if (LimitPos <= m_N_Work_Limit[3]) + { + LimitPos = m_N_Work_Limit[3] + 5 * m_Resolution[3]; + } + break; } - if (LimitPos <= m_N_Work_Limit[3]) - { - LimitPos = m_N_Work_Limit[3] + 5 * m_Resolution[3]; - } - break; - } case 4: - { - if (LimitPos >= m_P_Work_Limit[4]) { - LimitPos = m_P_Work_Limit[4] - 5 * m_Resolution[4]; + if (LimitPos >= m_P_Work_Limit[4]) + { + LimitPos = m_P_Work_Limit[4] - 5 * m_Resolution[4]; + } + if (LimitPos <= m_N_Work_Limit[4]) + { + LimitPos = m_N_Work_Limit[4] + 5 * m_Resolution[4]; + } + break; } - if (LimitPos <= m_N_Work_Limit[4]) - { - LimitPos = m_N_Work_Limit[4] + 5 * m_Resolution[4]; - } - break; - } default: break; } - } return LimitPos; } + //=========================================================================== short HSI_Motion::AxisConvertIndex(UINT AxisTypes) { @@ -5543,33 +5816,35 @@ short HSI_Motion::AxisConvertIndex(UINT AxisTypes) switch (AxisTypes) { case HSI_MOTION_AXIS_X: - { - AxisNumber = 0x01; - break; - } + { + AxisNumber = 0x01; + break; + } case HSI_MOTION_AXIS_Y: - { - AxisNumber = 0x02; - break; - } + { + AxisNumber = 0x02; + break; + } case HSI_MOTION_AXIS_Z: - { - AxisNumber = 0x03; - break; - } + { + AxisNumber = 0x03; + break; + } case HSI_MOTION_AXIS_R: - { - AxisNumber = 0x04; - break; - } + { + AxisNumber = 0x04; + break; + } default: - { - g_pLogger->SendAndFlushWithTime(L"AxisConvertIndex failed,AxisTypes = %d,AxisNumber = %d\n", AxisTypes, AxisNumber); - break; - } + { + g_pLogger->SendAndFlushWithTime(L"AxisConvertIndex failed,AxisTypes = %d,AxisNumber = %d\n", AxisTypes, + AxisNumber); + break; + } } return AxisNumber; } + //=========================================================================== short HSI_Motion::IndexConvertAxis(int Index) { @@ -5577,35 +5852,36 @@ short HSI_Motion::IndexConvertAxis(int Index) switch (Index) { case 1: - { - AxisNumber = AXIS_X; - break; - } + { + AxisNumber = AXIS_X; + break; + } case 2: - { - AxisNumber = AXIS_Y; - break; - } + { + AxisNumber = AXIS_Y; + break; + } case 3: - { - AxisNumber = AXIS_Z; - break; - } + { + AxisNumber = AXIS_Z; + break; + } case 4: - { - AxisNumber = AXIS_U; - break; - } + { + AxisNumber = AXIS_U; + break; + } default: - { - g_pLogger->SendAndFlushWithTime(L"IndexConvertAxis failed,Index = %d,AxisTypes = %d\n", Index, AxisNumber); - break; - } + { + g_pLogger->SendAndFlushWithTime(L"IndexConvertAxis failed,Index = %d,AxisTypes = %d\n", Index, AxisNumber); + break; + } } return AxisNumber; } + //=========================================================================== -HSI_STATUS HSI_Motion::IsSupportedEx(UINT AxisTypes, UINT &Types) +HSI_STATUS HSI_Motion::IsSupportedEx(UINT AxisTypes, UINT& Types) { auto rStatus = HSI_STATUS_NORMAL; Types = 1; @@ -5616,6 +5892,7 @@ HSI_STATUS HSI_Motion::IsSupportedEx(UINT AxisTypes, UINT &Types) } return rStatus; } + //=========================================================================== HSI_STATUS HSI_Motion::StartupEx(UINT AxisTypes, bool bHome) { @@ -5625,8 +5902,9 @@ HSI_STATUS HSI_Motion::StartupEx(UINT AxisTypes, bool bHome) g_pLogger->SendAndFlushWithTime(L"[StartupEx] Out\n"); return rStatus; } + //=========================================================================== -HSI_STATUS HSI_Motion::GetScaleResolutionEx(UINT AxisTypes, double &Scale) +HSI_STATUS HSI_Motion::GetScaleResolutionEx(UINT AxisTypes, double& Scale) { auto rStatus = HSI_STATUS_NORMAL; short AxisNumber = AxisConvertIndex(AxisTypes); @@ -5636,6 +5914,7 @@ HSI_STATUS HSI_Motion::GetScaleResolutionEx(UINT AxisTypes, double &Scale) } return rStatus; } + //=========================================================================== HSI_STATUS HSI_Motion::SetScaleResolutionEx(UINT AxisTypes, double Scale) { @@ -5643,25 +5922,27 @@ HSI_STATUS HSI_Motion::SetScaleResolutionEx(UINT AxisTypes, double Scale) short AxisNumber = AxisConvertIndex(AxisTypes); if (g_pHSI_Motion) { - m_Resolution[AxisNumber] = (int)(Scale * 10000); + m_Resolution[AxisNumber] = static_cast(Scale * 10000); } return rStatus; } + //=========================================================================== -HSI_STATUS HSI_Motion::GetPositionEx(UINT AxisTypes, double &Position, double &Time) +HSI_STATUS HSI_Motion::GetPositionEx(UINT AxisTypes, double& Position, double& Time) { auto rStatus = HSI_STATUS_NORMAL; UNREFERENCED_PARAMETER(AxisTypes); if (g_pHSI_Motion) { - double position[4] = { 0.0 }; + double position[4] = {0.0}; short AxisNumber = AxisConvertIndex(AxisTypes); Position = m_PosForAllAxis[AxisNumber]; } return rStatus; } + //=========================================================================== -HSI_STATUS HSI_Motion::SetPositionEx(UINT AxisTypes, double Position, HSI_MOTION_MOVE_TYPE eType, double dSpeedGear) +HSI_STATUS HSI_Motion::SetPositionEx(UINT AxisTypes, double Position, HSI_MOTION_MOVE_TYPE eType, double dSpeedGear) { auto rStatus = HSI_STATUS_NORMAL; UNREFERENCED_PARAMETER(AxisTypes); @@ -5670,7 +5951,7 @@ HSI_STATUS HSI_Motion::SetPositionEx(UINT AxisTypes, double Position, HSI_MOTIO g_pLogger->SendAndFlushWithTime(L"[SetPositionEx] In\n"); short AxisNumber = AxisConvertIndex(AxisTypes); double Time = 0.0; - double position[5] = { 0.0 }; + double position[5] = {0.0}; for (size_t i = 0; i < 5; i++) { position[i] = m_PosForAllAxis[i]; @@ -5681,18 +5962,19 @@ HSI_STATUS HSI_Motion::SetPositionEx(UINT AxisTypes, double Position, HSI_MOTIO } return rStatus; } + //=========================================================================== -HSI_STATUS HSI_Motion::SetPositionStep(UINT AxisTypes, double Position, HSI_MOTION_MOVE_TYPE eType, double dSpeedGear) +HSI_STATUS HSI_Motion::SetPositionStep(UINT AxisTypes, double Position, HSI_MOTION_MOVE_TYPE eType, double dSpeedGear) { auto rStatus = HSI_STATUS_NORMAL; if (g_pHSI_Motion) { - } return rStatus; } + //=========================================================================== -HSI_STATUS HSI_Motion::GetSpeedEx(UINT AxisTypes, double &Speed) +HSI_STATUS HSI_Motion::GetSpeedEx(UINT AxisTypes, double& Speed) { auto rStatus = HSI_STATUS_NORMAL; g_pLogger->SendAndFlushWithTime(L"[GetSpeedEx] In\n"); @@ -5701,7 +5983,7 @@ HSI_STATUS HSI_Motion::GetSpeedEx(UINT AxisTypes, double &Speed) { if (m_motorType == 1) { - if (1==m_iSpeedType) + if (1 == m_iSpeedType) { Speed = m_SetPotion_DriveSpeed[1] * (m_Resolution[1] * 50); } @@ -5712,7 +5994,7 @@ HSI_STATUS HSI_Motion::GetSpeedEx(UINT AxisTypes, double &Speed) } else { - if (1==m_iSpeedType) + if (1 == m_iSpeedType) { Speed = m_SetPotion_DriveSpeed[AxisNumber] * (m_Resolution[AxisNumber] * 50); } @@ -5725,6 +6007,7 @@ HSI_STATUS HSI_Motion::GetSpeedEx(UINT AxisTypes, double &Speed) g_pLogger->SendAndFlushWithTime(L"[GetSpeedEx] Out\n"); return rStatus; } + //=========================================================================== HSI_STATUS HSI_Motion::SetSpeedEx(UINT AxisTypes, double Speed) { @@ -5735,7 +6018,7 @@ HSI_STATUS HSI_Motion::SetSpeedEx(UINT AxisTypes, double Speed) { m_SetPotion_DriveSpeed[AxisNumber] = 0; } - if (1==m_iSpeedType) + if (1 == m_iSpeedType) { if (Speed >= 65000 * (m_Resolution[AxisNumber] * 50)) { @@ -5755,13 +6038,13 @@ HSI_STATUS HSI_Motion::SetSpeedEx(UINT AxisTypes, double Speed) { if (m_motorType == 1) { - if (1==m_iSpeedType) + if (1 == m_iSpeedType) { - m_SetPotion_DriveSpeed[1] = (int)Speed/(m_Resolution[1] * 50); + m_SetPotion_DriveSpeed[1] = static_cast(Speed) / (m_Resolution[1] * 50); } else { - m_SetPotion_DriveSpeed[1] = (int)Speed; + m_SetPotion_DriveSpeed[1] = static_cast(Speed); } } else @@ -5780,13 +6063,13 @@ HSI_STATUS HSI_Motion::SetSpeedEx(UINT AxisTypes, double Speed) // m_SetPotion_DriveSpeed[m_SaveAxisNum] = m_SaveAxisSpeed; // return rStatus; //} - if (1==m_iSpeedType) + if (1 == m_iSpeedType) { - m_SetPotion_DriveSpeed[AxisNumber] = (int)(Speed / (m_Resolution[AxisNumber] * 50)); + m_SetPotion_DriveSpeed[AxisNumber] = static_cast(Speed / (m_Resolution[AxisNumber] * 50)); } else { - m_SetPotion_DriveSpeed[AxisNumber] = (int)Speed; + m_SetPotion_DriveSpeed[AxisNumber] = static_cast(Speed); } g_pLogger->SendAndFlushWithTime(L"[SetSpeedEx] AxisNumber = %d\n", AxisNumber); } @@ -5795,19 +6078,20 @@ HSI_STATUS HSI_Motion::SetSpeedEx(UINT AxisTypes, double Speed) { if (m_motorType == 1) { - m_SetPotion_DriveSpeed[AxisNumber] = (int)(Speed / (m_Resolution[AxisNumber] * 50)); + m_SetPotion_DriveSpeed[AxisNumber] = static_cast(Speed / (m_Resolution[AxisNumber] * 50)); } else { - m_SetPotion_DriveSpeed[AxisNumber] = (int)(Speed / (m_Resolution[AxisNumber] * 50)); + m_SetPotion_DriveSpeed[AxisNumber] = static_cast(Speed / (m_Resolution[AxisNumber] * 50)); } } } g_pLogger->SendAndFlushWithTime(L"[SetSpeedEx] Out\n"); return rStatus; } + //=========================================================================== -HSI_STATUS HSI_Motion::GetAccelerationEx(UINT AxisTypes, double &Accel) +HSI_STATUS HSI_Motion::GetAccelerationEx(UINT AxisTypes, double& Accel) { auto rStatus = HSI_STATUS_NORMAL; short AxisNumber = AxisConvertIndex(AxisTypes); @@ -5824,6 +6108,7 @@ HSI_STATUS HSI_Motion::GetAccelerationEx(UINT AxisTypes, double &Accel) } return rStatus; } + //=========================================================================== HSI_STATUS HSI_Motion::SetAccelerationEx(UINT AxisTypes, double Accel) { @@ -5837,11 +6122,11 @@ HSI_STATUS HSI_Motion::SetAccelerationEx(UINT AxisTypes, double Accel) { if (m_motorType == 1) { - m_SetPotion_StartSpeed[AxisNumber] = (int)(Accel / (m_Resolution[AxisNumber] * 500)); + m_SetPotion_StartSpeed[AxisNumber] = static_cast(Accel / (m_Resolution[AxisNumber] * 500)); } else { - m_SetPotion_StartSpeed[AxisNumber] = (int)(Accel / (m_Resolution[AxisNumber] * 500)); + m_SetPotion_StartSpeed[AxisNumber] = static_cast(Accel / (m_Resolution[AxisNumber] * 500)); } } return rStatus; @@ -5857,24 +6142,26 @@ VOID HSI_Motion::EventCallback(sHSIEventProperties& sEventProp) } ReleaseMutex(m_Thread_Mutex); } + //=========================================================================== void HSI_Motion::CreateThread() { - if (m_Thread_Id == NULL) + if (m_Thread_Id == nullptr) { m_Thread_State = HSI_THREAD_RUNNING; - m_hTriggerEvent = CreateEvent(NULL, FALSE, NULL, NULL); + m_hTriggerEvent = CreateEvent(nullptr, FALSE, NULL, nullptr); m_Thread_Id = ::CreateThread( - (LPSECURITY_ATTRIBUTES)NULL, + nullptr, 0, (LPTHREAD_START_ROUTINE)m_Thread, - (LPVOID)this, + this, 0, - NULL); - m_Thread_Mutex = CreateMutex(NULL, FALSE, NULL); + nullptr); + m_Thread_Mutex = CreateMutex(nullptr, FALSE, nullptr); TRACE("CreateThread!\n"); } } + //=========================================================================== void HSI_Motion::CloseThread() { @@ -5895,16 +6182,16 @@ void HSI_Motion::CloseThread() m_Thread_State = HSI_THREAD_EXIT; ReleaseMutex(m_Thread_Mutex); CloseHandle(m_Thread_Mutex); - m_Thread_Id = NULL; - m_hTriggerEvent = NULL; - m_Thread_Mutex = NULL; + m_Thread_Id = nullptr; + m_hTriggerEvent = nullptr; + m_Thread_Mutex = nullptr; TRACE("CloseThread!\n"); - } + //=========================================================================== unsigned __stdcall HSI_Motion::m_Thread(LPVOID pThis) { - HSI_Motion* _This = (HSI_Motion*)pThis; + auto _This = static_cast(pThis); for (;;) { TRACE("m_Thread!\n"); @@ -5914,51 +6201,53 @@ unsigned __stdcall HSI_Motion::m_Thread(LPVOID pThis) switch (m_Thread_State) { case HSI_THREAD_RUNNING: - { - TRACE("HSI_THREAD_RUNNING.\r\n"); - if (bRunGlueDispenser == HSI_THREAD_RUNNING) - _This->GluedispenserDone(); - else { - _This->UpdateMotionState(); - _This->UpdateMotionStateEx(); + TRACE("HSI_THREAD_RUNNING.\r\n"); + if (bRunGlueDispenser == HSI_THREAD_RUNNING) + _This->GluedispenserDone(); + else + { + _This->UpdateMotionState(); + _This->UpdateMotionStateEx(); + } + break; } - break; - } case HSI_THREAD_PAUSED: - { - TRACE("HSI_THREAD_PAUSED.\r\n"); - break; - } + { + TRACE("HSI_THREAD_PAUSED.\r\n"); + break; + } case HSI_THREAD_EXIT: - { - TRACE("HSI_THREAD_EXIT.\r\n"); - ExitThread(0); - break; - } + { + TRACE("HSI_THREAD_EXIT.\r\n"); + ExitThread(0); + break; + } default: break; } } } + //=========================================================================== void HSI_Motion::CreateThreadProbe() { - if (m_Thread_IdProbe == NULL) + if (m_Thread_IdProbe == nullptr) { m_Thread_StateProbe = HSI_THREAD_RUNNING; - m_hTriggerEventProbe = CreateEvent(NULL, FALSE, NULL, NULL); + m_hTriggerEventProbe = CreateEvent(nullptr, FALSE, NULL, nullptr); m_Thread_IdProbe = ::CreateThread( - (LPSECURITY_ATTRIBUTES)NULL, + nullptr, 0, (LPTHREAD_START_ROUTINE)m_ThreadProbe, - (LPVOID)this, + this, 0, - NULL); - m_Thread_MutexProbe = CreateMutex(NULL, FALSE, NULL); + nullptr); + m_Thread_MutexProbe = CreateMutex(nullptr, FALSE, nullptr); TRACE("CreateThread!\n"); } } + //=========================================================================== void HSI_Motion::CloseThreadProbe() { @@ -5979,16 +6268,16 @@ void HSI_Motion::CloseThreadProbe() m_Thread_StateProbe = HSI_THREAD_EXIT; ReleaseMutex(m_Thread_MutexProbe); CloseHandle(m_Thread_MutexProbe); - m_Thread_IdProbe = NULL; - m_hTriggerEventProbe = NULL; - m_Thread_MutexProbe = NULL; + m_Thread_IdProbe = nullptr; + m_hTriggerEventProbe = nullptr; + m_Thread_MutexProbe = nullptr; TRACE("CloseThread!\n"); - } + //=========================================================================== unsigned __stdcall HSI_Motion::m_ThreadProbe(LPVOID pThis) { - HSI_Motion* _This = (HSI_Motion*)pThis; + auto _This = static_cast(pThis); for (;;) { TRACE("m_Thread!\n"); @@ -5998,45 +6287,47 @@ unsigned __stdcall HSI_Motion::m_ThreadProbe(LPVOID pThis) switch (m_Thread_StateProbe) { case HSI_THREAD_RUNNING: - { - TRACE("HSI_THREAD_RUNNING.\r\n"); - _This->UpdateMotionStateProbe(); - break; - } + { + TRACE("HSI_THREAD_RUNNING.\r\n"); + _This->UpdateMotionStateProbe(); + break; + } case HSI_THREAD_PAUSED: - { - TRACE("HSI_THREAD_PAUSED.\r\n"); - break; - } + { + TRACE("HSI_THREAD_PAUSED.\r\n"); + break; + } case HSI_THREAD_EXIT: - { - TRACE("HSI_THREAD_EXIT.\r\n"); - ExitThread(0); - break; - } + { + TRACE("HSI_THREAD_EXIT.\r\n"); + ExitThread(0); + break; + } default: break; } } } + //=========================================================================== void HSI_Motion::CreateThreadIO() { - if (m_Thread_IdIO == NULL) + if (m_Thread_IdIO == nullptr) { m_Thread_StateIO = HSI_THREAD_RUNNING; - m_hTriggerEventIO = CreateEvent(NULL, FALSE, NULL, NULL); + m_hTriggerEventIO = CreateEvent(nullptr, FALSE, NULL, nullptr); m_Thread_IdIO = ::CreateThread( - (LPSECURITY_ATTRIBUTES)NULL, + nullptr, 0, (LPTHREAD_START_ROUTINE)m_ThreadIO, - (LPVOID)this, + this, 0, - NULL); - m_Thread_MutexIO = CreateMutex(NULL, FALSE, NULL); + nullptr); + m_Thread_MutexIO = CreateMutex(nullptr, FALSE, nullptr); TRACE("CreateThreadIO!\n"); } } + //=========================================================================== void HSI_Motion::CloseThreadIO() { @@ -6057,16 +6348,16 @@ void HSI_Motion::CloseThreadIO() m_Thread_StateIO = HSI_THREAD_EXIT; ReleaseMutex(m_Thread_MutexIO); CloseHandle(m_Thread_MutexIO); - m_Thread_IdIO = NULL; - m_hTriggerEventIO = NULL; - m_Thread_MutexIO = NULL; + m_Thread_IdIO = nullptr; + m_hTriggerEventIO = nullptr; + m_Thread_MutexIO = nullptr; TRACE("CloseThreadIO!\n"); - } + //=========================================================================== unsigned __stdcall HSI_Motion::m_ThreadIO(LPVOID pThis) { - HSI_Motion* _This = (HSI_Motion*)pThis; + auto _This = static_cast(pThis); for (;;) { TRACE("m_ThreadIO!\n"); @@ -6076,45 +6367,47 @@ unsigned __stdcall HSI_Motion::m_ThreadIO(LPVOID pThis) switch (m_Thread_StateIO) { case HSI_THREAD_RUNNING: - { - TRACE("HSI_THREAD_RUNNING.\r\n"); - _This->UpdateMotionStateIO(); - break; - } + { + TRACE("HSI_THREAD_RUNNING.\r\n"); + _This->UpdateMotionStateIO(); + break; + } case HSI_THREAD_PAUSED: - { - TRACE("HSI_THREAD_PAUSED.\r\n"); - break; - } + { + TRACE("HSI_THREAD_PAUSED.\r\n"); + break; + } case HSI_THREAD_EXIT: - { - TRACE("HSI_THREAD_EXIT.\r\n"); - ExitThread(0); - break; - } + { + TRACE("HSI_THREAD_EXIT.\r\n"); + ExitThread(0); + break; + } default: break; } } } + //=========================================================================== void HSI_Motion::CreateThreadData() { - if (m_Thread_IdData == NULL) + if (m_Thread_IdData == nullptr) { m_Thread_StateData = HSI_THREAD_RUNNING; - m_hTriggerEventData = CreateEvent(NULL, FALSE, NULL, NULL); + m_hTriggerEventData = CreateEvent(nullptr, FALSE, NULL, nullptr); m_Thread_IdData = ::CreateThread( - (LPSECURITY_ATTRIBUTES)NULL, + nullptr, 0, (LPTHREAD_START_ROUTINE)m_ThreadData, - (LPVOID)this, + this, 0, - NULL); - m_Thread_MutexData = CreateMutex(NULL, FALSE, NULL); + nullptr); + m_Thread_MutexData = CreateMutex(nullptr, FALSE, nullptr); TRACE("CreateThreadData!\n"); } } + //=========================================================================== void HSI_Motion::CloseThreadData() { @@ -6135,53 +6428,58 @@ void HSI_Motion::CloseThreadData() m_Thread_StateData = HSI_THREAD_EXIT; ReleaseMutex(m_Thread_MutexData); CloseHandle(m_Thread_MutexData); - m_Thread_IdData = NULL; - m_hTriggerEventData = NULL; - m_Thread_MutexData = NULL; + m_Thread_IdData = nullptr; + m_hTriggerEventData = nullptr; + m_Thread_MutexData = nullptr; TRACE("CloseThreadData!\n"); - } + //=========================================================================== unsigned __stdcall HSI_Motion::m_ThreadData(LPVOID pThis) { - HSI_Motion* _This = (HSI_Motion*)pThis; + auto _This = static_cast(pThis); for (;;) { TRACE("m_ThreadData!\n"); if (m_Thread_StateData == THREAD_EXIT) ExitThread(0); + //WaitForSingleObjecthHandle¼ź״̬ + //ijһ߳еøúʱ߳ʱ + //ڹdwMillisecondsڣ߳ȴĶΪź״̬úأ + //ʱѾdwMilliseconds룬hHandleָĶûбź״̬ء WaitForSingleObject(m_hTriggerEventData, INFINITE); switch (m_Thread_StateData) { case HSI_THREAD_RUNNING: - { - TRACE("HSI_THREAD_RUNNING.\r\n"); - _This->UpdateMotionStateData();//ȡλ - break; - } + { + TRACE("HSI_THREAD_RUNNING.\r\n"); + //_This->UpdateMotionStateData();//ȡ˶״̬ + break; + } case HSI_THREAD_PAUSED: - { - TRACE("HSI_THREAD_PAUSED.\r\n"); - break; - } + { + TRACE("HSI_THREAD_PAUSED.\r\n"); + break; + } case HSI_THREAD_EXIT: - { - TRACE("HSI_THREAD_EXIT.\r\n"); - ExitThread(0); - break; - } + { + TRACE("HSI_THREAD_EXIT.\r\n"); + ExitThread(0); + break; + } default: break; } } } + //=========================================================================== //JOGеλ˶ //=========================================================================== void HSI_Motion::UpdateMotionStateJOGStop() { - unsigned char send_JogLimt_data[64] = { 0 }; + unsigned char send_JogLimt_data[64] = {0}; UINT axis = 0; double posx = 0.0; double posy = 0.0; @@ -6198,97 +6496,100 @@ void HSI_Motion::UpdateMotionStateJOGStop() switch (jogAxisNum) { case 1: - { - if (jogDirFlag) { - double limitx = m_P_Work_Limit[1]; - if ((limitx - posx) / m_Resolution[1] < slowdowndistance) + if (jogDirFlag) { - send_JogLimt_data[0] = 0x01; - send_JogLimt_data[1] = 0x14; - send_JogLimt_data[2] = 0x01; - m_WriteByte = Send_Command(0, (const char*)send_JogLimt_data, m_SendDataLength); - Sleep(5); - jogMoving = false; + double limitx = m_P_Work_Limit[1]; + if ((limitx - posx) / m_Resolution[1] < slowdowndistance) + { + send_JogLimt_data[0] = 0x01; + send_JogLimt_data[1] = 0x14; + send_JogLimt_data[2] = 0x01; + m_WriteByte = Send_Command(0, (const char*)send_JogLimt_data, m_SendDataLength); + Sleep(5); + jogMoving = false; + } + } + else + { + double limitx = m_N_Work_Limit[1]; + if ((posx - limitx) / m_Resolution[1] < slowdowndistance) + { + send_JogLimt_data[0] = 0x01; + send_JogLimt_data[1] = 0x14; + send_JogLimt_data[2] = 0x01; + m_WriteByte = Send_Command(0, (const char*)send_JogLimt_data, m_SendDataLength); + Sleep(5); + jogMoving = false; + } } } - else - { - double limitx = m_N_Work_Limit[1]; - if ((posx - limitx) / m_Resolution[1] < slowdowndistance) - { - send_JogLimt_data[0] = 0x01; - send_JogLimt_data[1] = 0x14; - send_JogLimt_data[2] = 0x01; - m_WriteByte = Send_Command(0, (const char*)send_JogLimt_data, m_SendDataLength); - Sleep(5); - jogMoving = false; - } - } - } break; + break; case 2: - { - if (jogDirFlag) { - double limity = m_P_Work_Limit[2]; - if ((limity - posy) / m_Resolution[2] < slowdowndistance) + if (jogDirFlag) { - send_JogLimt_data[0] = 0x01; - send_JogLimt_data[1] = 0x14; - send_JogLimt_data[2] = 0x02; - m_WriteByte = Send_Command(0, (const char*)send_JogLimt_data, m_SendDataLength); - Sleep(5); - jogMoving = false; + double limity = m_P_Work_Limit[2]; + if ((limity - posy) / m_Resolution[2] < slowdowndistance) + { + send_JogLimt_data[0] = 0x01; + send_JogLimt_data[1] = 0x14; + send_JogLimt_data[2] = 0x02; + m_WriteByte = Send_Command(0, (const char*)send_JogLimt_data, m_SendDataLength); + Sleep(5); + jogMoving = false; + } + } + else + { + double limity = m_N_Work_Limit[2]; + if ((posy - limity) / m_Resolution[2] < slowdowndistance) + { + send_JogLimt_data[0] = 0x01; + send_JogLimt_data[1] = 0x14; + send_JogLimt_data[2] = 0x02; + m_WriteByte = Send_Command(0, (const char*)send_JogLimt_data, m_SendDataLength); + Sleep(5); + jogMoving = false; + } } } - else - { - double limity = m_N_Work_Limit[2]; - if ((posy - limity) / m_Resolution[2] < slowdowndistance) - { - send_JogLimt_data[0] = 0x01; - send_JogLimt_data[1] = 0x14; - send_JogLimt_data[2] = 0x02; - m_WriteByte = Send_Command(0, (const char*)send_JogLimt_data, m_SendDataLength); - Sleep(5); - jogMoving = false; - } - } - } break; + break; case 3: - { - if (jogDirFlag) { - double limitz = m_P_Work_Limit[3]; - if ((limitz - posz) / m_Resolution[3] < slowdowndistance) + if (jogDirFlag) { - send_JogLimt_data[0] = 0x01; - send_JogLimt_data[1] = 0x14; - send_JogLimt_data[2] = 0x04; - m_WriteByte = Send_Command(0, (const char*)send_JogLimt_data, m_SendDataLength); - Sleep(5); - jogMoving = false; + double limitz = m_P_Work_Limit[3]; + if ((limitz - posz) / m_Resolution[3] < slowdowndistance) + { + send_JogLimt_data[0] = 0x01; + send_JogLimt_data[1] = 0x14; + send_JogLimt_data[2] = 0x04; + m_WriteByte = Send_Command(0, (const char*)send_JogLimt_data, m_SendDataLength); + Sleep(5); + jogMoving = false; + } + } + else + { + double limitz = m_N_Work_Limit[3]; + if ((posz - limitz) / m_Resolution[3] < slowdowndistance) + { + send_JogLimt_data[0] = 0x01; + send_JogLimt_data[1] = 0x14; + send_JogLimt_data[2] = 0x04; + m_WriteByte = Send_Command(0, (const char*)send_JogLimt_data, m_SendDataLength); + Sleep(5); + jogMoving = false; + } } } - else - { - double limitz = m_N_Work_Limit[3]; - if ((posz - limitz) / m_Resolution[3] < slowdowndistance) - { - send_JogLimt_data[0] = 0x01; - send_JogLimt_data[1] = 0x14; - send_JogLimt_data[2] = 0x04; - m_WriteByte = Send_Command(0, (const char*)send_JogLimt_data, m_SendDataLength); - Sleep(5); - jogMoving = false; - } - } - } break; + break; case 4: - { - - //δ - } break; + { + //δ + } + break; default: break; } @@ -6296,24 +6597,26 @@ void HSI_Motion::UpdateMotionStateJOGStop() Sleep(2); } } + //=========================================================================== void HSI_Motion::CreateThreadJOGStop() //JOGеλ˶ { - if (m_Thread_IdJOGStop == NULL) + if (m_Thread_IdJOGStop == nullptr) { m_Thread_StateJOGStop = HSI_THREAD_RUNNING; - m_hTriggerEventJOGStop = CreateEvent(NULL, FALSE, NULL, NULL); + m_hTriggerEventJOGStop = CreateEvent(nullptr, FALSE, NULL, nullptr); m_Thread_IdJOGStop = ::CreateThread( - (LPSECURITY_ATTRIBUTES)NULL, + nullptr, 0, (LPTHREAD_START_ROUTINE)m_ThreadJOGStop, - (LPVOID)this, + this, 0, - NULL); - m_Thread_MutexJOGStop = CreateMutex(NULL, FALSE, NULL); + nullptr); + m_Thread_MutexJOGStop = CreateMutex(nullptr, FALSE, nullptr); TRACE("CreateThreadJOGStop!\n"); } } + //=========================================================================== void HSI_Motion::CloseThreadJOGStop() { @@ -6334,16 +6637,16 @@ void HSI_Motion::CloseThreadJOGStop() m_Thread_StateJOGStop = HSI_THREAD_EXIT; ReleaseMutex(m_Thread_MutexJOGStop); CloseHandle(m_Thread_MutexJOGStop); - m_Thread_IdJOGStop = NULL; - m_hTriggerEventJOGStop = NULL; - m_Thread_MutexJOGStop = NULL; + m_Thread_IdJOGStop = nullptr; + m_hTriggerEventJOGStop = nullptr; + m_Thread_MutexJOGStop = nullptr; TRACE("CloseThreadJOGStop!\n"); - } + //=========================================================================== unsigned __stdcall HSI_Motion::m_ThreadJOGStop(LPVOID pThis) //JOGеλ˶ { - HSI_Motion* _This = (HSI_Motion*)pThis; + auto _This = static_cast(pThis); for (;;) { TRACE("m_ThreadJOGStop!\n"); @@ -6353,27 +6656,28 @@ unsigned __stdcall HSI_Motion::m_ThreadJOGStop(LPVOID pThis) //JOG switch (m_Thread_StateJOGStop) { case HSI_THREAD_RUNNING: - { - TRACE("HSI_THREAD_RUNNING.\r\n"); - _This->UpdateMotionStateJOGStop(); - break; - } + { + TRACE("HSI_THREAD_RUNNING.\r\n"); + _This->UpdateMotionStateJOGStop(); + break; + } case HSI_THREAD_PAUSED: - { - TRACE("HSI_THREAD_PAUSED.\r\n"); - break; - } + { + TRACE("HSI_THREAD_PAUSED.\r\n"); + break; + } case HSI_THREAD_EXIT: - { - TRACE("HSI_THREAD_EXIT.\r\n"); - ExitThread(0); - break; - } + { + TRACE("HSI_THREAD_EXIT.\r\n"); + ExitThread(0); + break; + } default: break; } } } + //=========================================================================== // HSI_STATUS HSI_Motion::IOStep(bool RunSts) @@ -6384,8 +6688,8 @@ HSI_STATUS HSI_Motion::IOStep(bool RunSts) { } return rStatus; - } + //=========================================================================== HSI_STATUS HSI_Motion::IOprogram(byte* SendData, int length) { @@ -6395,24 +6699,23 @@ HSI_STATUS HSI_Motion::IOprogram(byte* SendData, int length) Send_Command(0, (const char*)SendData, m_SendDataLength); } return rStatus; - } HSI_STATUS HSI_Motion::FindOriginTest(bool type) { auto rStatus = HSI_STATUS_NORMAL; - byte findorigdata[64] = { 0 }; + byte findorigdata[64] = {0}; findorigdata[0] = 0x04; if (type == true) { findorigdata[1] = 0x18; - findorigdata[2] = (byte)(m_Resolution[1] * 10000); + findorigdata[2] = static_cast(m_Resolution[1] * 10000); Send_Command(0, (const char*)findorigdata, 64); } else { findorigdata[1] = 0x19; - findorigdata[2] = (byte)(m_Resolution[1] * 10000); + findorigdata[2] = static_cast(m_Resolution[1] * 10000); Send_Command(0, (const char*)findorigdata, 64); } return rStatus; @@ -6425,7 +6728,7 @@ BOOL HSI_Motion::Send_Command(int com, const char* _SendData, DWORD SendDataLeng WaitForSingleObject(g_RW_Data_Mutex, INFINITE); if (m_bConnected && (m_IsUseEF3 == 1) && (com == 0)) { - int iWriteByte = m_SO7_Serial.Send(_SendData, 64); + int iWriteByte = m_SO7_Serial.Send(_SendData, SendDataLength); if (iWriteByte == 0) { int iError = GetLastError(); @@ -6481,7 +6784,7 @@ TCPIP_RETURN_CODE HSI_Motion::TCPConnect(int index, char* Address, u_short port) { int iMode = 1; int i = 0; - int retVal = ioctlsocket(m_socket[index], FIONBIO, (u_long FAR*)&iMode);// + int retVal = ioctlsocket(m_socket[index], FIONBIO, (u_long FAR*)&iMode); // if (retVal == SOCKET_ERROR) { closesocket(m_socket[index]); @@ -6506,22 +6809,19 @@ TCPIP_RETURN_CODE HSI_Motion::TCPConnect(int index, char* Address, u_short port) Sleep(5); continue; } - else if (errorCode == WSAEISCONN) + if (errorCode == WSAEISCONN) { break; } - else - { - first = true; - closesocket(m_socket[index]); - WSACleanup(); - rCode = (TCPIP_RETURN_CODE)errorCode; - return rCode; - } + first = true; + closesocket(m_socket[index]); + WSACleanup(); + rCode = static_cast(errorCode); + return rCode; } } iMode = 0; - retVal = ioctlsocket(m_socket[index], FIONBIO, (u_long FAR*)&iMode);// + retVal = ioctlsocket(m_socket[index], FIONBIO, (u_long FAR*)&iMode); // if (retVal == SOCKET_ERROR) { closesocket(m_socket[index]); @@ -6554,7 +6854,7 @@ void HSI_Motion::DisConnect() unsigned __stdcall HSI_Motion::m_ThreadSendTCP(LPVOID pThis) { - HSI_Motion* _This = (HSI_Motion*)pThis; + auto _This = static_cast(pThis); for (;;) { TRACE("m_Thread!\n"); @@ -6564,24 +6864,24 @@ unsigned __stdcall HSI_Motion::m_ThreadSendTCP(LPVOID pThis) switch (m_ThreadTCP_State) { case TCPIP_THREAD_RUNNING: - { - TRACE("TCPIP_THREAD_RUNNING.\r\n"); - _This->TCPSend(); - break; - } + { + TRACE("TCPIP_THREAD_RUNNING.\r\n"); + _This->TCPSend(); + break; + } case TCPIP_THREAD_PAUSED: - { - break; - } + { + break; + } case TCPIP_THREAD_EXIT: - { - ExitThread(0); - break; - } + { + ExitThread(0); + break; + } default: break; } - }; + } } @@ -6593,7 +6893,8 @@ TCPIP_RETURN_CODE HSI_Motion::TCPSend() int bytesSend = 0; if (LightSend > 0) { - g_pLogger->SendAndFlushWithTime(L"[TCPSend] LightSend = %d,m_selectedIndex = %d\n", LightSend, m_selectedIndex); + g_pLogger->SendAndFlushWithTime(L"[TCPSend] LightSend = %d,m_selectedIndex = %d\n", LightSend, + m_selectedIndex); LightSend--; bytesSend = send(m_socket[m_selectedIndex], (const char*)lightdata, 64, 0); for (size_t i = 0; i < 64; i++) @@ -6650,7 +6951,6 @@ TCPIP_RETURN_CODE HSI_Motion::TCPSend() } else { - g_pLogger->SendAndFlushWithTime(L"[TCPSend] ERROR1 bytesSend = %d\n", bytesSend); sEvenProp.Init(); sEvenProp.EventType = HSI_EVENT_ERROR; @@ -6667,14 +6967,14 @@ TCPIP_RETURN_CODE HSI_Motion::TCPSend() //ZeroMemory(tReciveData, TCPIP_MAX_DAT_SIZE); int bytesReceived = 0; int num = 0; - bytesReceived = recv(m_socket[m_selectedIndex], (char *)tReciveData, TCPIP_MAX_DAT_SIZE, 0); + bytesReceived = recv(m_socket[m_selectedIndex], (char*)tReciveData, TCPIP_MAX_DAT_SIZE, 0); if (bytesReceived == SOCKET_ERROR) { bytesReceived = WSAGetLastError(); if (bytesReceived == WSAEWOULDBLOCK || bytesReceived == WSAENOTSOCK) { //ZeroMemory(tReciveData, TCPIP_MAX_DAT_SIZE); - bytesReceived = recv(m_socket[m_selectedIndex], (char *)tReciveData, TCPIP_MAX_DAT_SIZE, 0); + bytesReceived = recv(m_socket[m_selectedIndex], (char*)tReciveData, TCPIP_MAX_DAT_SIZE, 0); if (bytesReceived == SOCKET_ERROR) { recvFlag = false; @@ -6727,14 +7027,14 @@ TCPIP_RETURN_CODE HSI_Motion::TCPSend() //have to wait for the next receive event } } - bytesReceived = recv(m_socket[m_selectedIndex], (char *)tReciveData, TCPIP_MAX_DAT_SIZE, 0); + bytesReceived = recv(m_socket[m_selectedIndex], (char*)tReciveData, TCPIP_MAX_DAT_SIZE, 0); if (bytesReceived == SOCKET_ERROR) { bytesReceived = WSAGetLastError(); if (bytesReceived == WSAEWOULDBLOCK) { //ZeroMemory(tReciveData, TCPIP_MAX_DAT_SIZE); - bytesReceived = recv(m_socket[m_selectedIndex], (char *)tReciveData, TCPIP_MAX_DAT_SIZE, 0); + bytesReceived = recv(m_socket[m_selectedIndex], (char*)tReciveData, TCPIP_MAX_DAT_SIZE, 0); if (bytesReceived == SOCKET_ERROR) { g_pLogger->SendAndFlushWithTime(L"[TCPReceived] ERROR2\n"); @@ -6753,8 +7053,8 @@ void HSI_Motion::Create_Thread() if (!m_ThreadTCP_Id) { m_ThreadTCP_State = TCPIP_THREAD_RUNNING; - m_ThreadTCP_Id = ::CreateThread((LPSECURITY_ATTRIBUTES)NULL, 0, (LPTHREAD_START_ROUTINE)m_ThreadSendTCP, (LPVOID)this, 0, NULL); - + m_ThreadTCP_Id = ::CreateThread(nullptr, 0, (LPTHREAD_START_ROUTINE)m_ThreadSendTCP, + this, 0, nullptr); } } @@ -6771,7 +7071,7 @@ void HSI_Motion::Exit_Thread() } } m_ThreadTCP_State = TCPIP_THREAD_EXIT; - m_ThreadTCP_Id = NULL; + m_ThreadTCP_Id = nullptr; } int HSI_Motion::Init_Winsock() @@ -6779,7 +7079,7 @@ int HSI_Motion::Init_Winsock() int nRet; if (first) { - WSADATA stWSAData; /* WinSock DLL Info */ + WSADATA stWSAData; /* WinSock DLL Info */ nRet = WSAStartup(WSA_VERSION, &stWSAData); if (nRet) { @@ -6797,7 +7097,7 @@ HSI_STATUS HSI_Motion::CollectPos(bool isEnable, MOTOR_AXISCHOOES_CMD axis, shor auto rStatus = HSI_STATUS_NORMAL; if (g_pHSI_Motion) { - unsigned char send_glue_data[64] = { 0 }; + unsigned char send_glue_data[64] = {0}; send_glue_data[0] = 0x01; send_glue_data[1] = 0x1E; send_glue_data[2] = isEnable ? 1 : 2; @@ -6806,10 +7106,10 @@ HSI_STATUS HSI_Motion::CollectPos(bool isEnable, MOTOR_AXISCHOOES_CMD axis, shor send_glue_data[5] = axis; Send_Command(0, (const char*)send_glue_data, 64); - } return rStatus; } + //=========================================================================== HSI_STATUS HSI_Motion::SetAllGears() { @@ -6818,10 +7118,10 @@ HSI_STATUS HSI_Motion::SetAllGears() { for (size_t i = 1; i < 5; i++) { - unsigned char send_glue_data[64] = { 0 }; + unsigned char send_glue_data[64] = {0}; send_glue_data[0] = 0x01; send_glue_data[1] = 0x01; - send_glue_data[2] = 0x01 << (i - 1); // + send_glue_data[2] = 0x01 << (i - 1); // send_glue_data[3] = 0x08; for (size_t j = 0; j < 5; j++) @@ -6839,4 +7139,5 @@ HSI_STATUS HSI_Motion::SetAllGears() } return rStatus; } + //=========================================================================== diff --git a/HSI_HexagonMI_EF3/HSI_Motion.h b/HSI_HexagonMI_EF3/HSI_Motion.h index d8a4585..ed509bf 100644 --- a/HSI_HexagonMI_EF3/HSI_Motion.h +++ b/HSI_HexagonMI_EF3/HSI_Motion.h @@ -3,7 +3,7 @@ #pragma once #include "logger.h" -#include "SevenOcean\CMMIO_SERIAL.H" +#include "SevenOcean/CMMIO_SERIAL.H" #define TCPIP_THREAD_RUNNING 0 #define TCPIP_THREAD_PAUSED 1 @@ -16,114 +16,129 @@ const double SCALE_UNITS = 1000.0; static CLogger* g_pLogger; static CLogger* g_pLogger2; -static bool g_IsClose;//DoEvents()˳쳣 +static bool g_IsClose; //DoEvents()˳쳣 enum E_SO7_MOTION_TYPE { - E_SO7_MOTION_NONE, - E_SO7_MOTION_JOG, - E_SO7_MOTION_MOVETO, - E_SO7_MOTION + E_SO7_MOTION_NONE, + E_SO7_MOTION_JOG, + E_SO7_MOTION_MOVETO, + E_SO7_MOTION }; + enum E_EF3_HOME_STATUS { - E_EF3_HOME_NONE,//0ʾδعԭ - E_EF3_HOME_ING,//1ʾڻԭ - E_EF3_HOME_FINISHED,//2ʾѾعԭ + E_EF3_HOME_NONE, + //0ʾδعԭ + E_EF3_HOME_ING, + //1ʾڻԭ + E_EF3_HOME_FINISHED, + //2ʾѾعԭ }; -enum FUN_CMD //һָ +enum FUN_CMD //һָ { - CT_MOTOR = 0x01, //MOTOR - CT_LIGHT, //LIGHT - CT_PORT, //PORT - CT_ORDER, //ORDER - CT_SOFTSTOP, //STOP - CT_GLUEDISPENSER, //㽺 - CT_TURNTABLE, + CT_MOTOR = 0x01, + //MOTOR + CT_LIGHT, + //LIGHT + CT_PORT, + //PORT + CT_ORDER, + //ORDER + CT_SOFTSTOP, + //STOP + CT_GLUEDISPENSER, + //㽺 + CT_TURNTABLE, }; -enum MOTOR_CMD //ڶָ +enum MOTOR_CMD //ڶָ { - CT_MOTOR_SET = 0x01, - CT_START_JOG_POS, // - CT_START_JOG_NEG, - CT_START_POSITION, //_POS, - CT_STOP, - CT_GOHOME, - CT_TRIGGER_DATA, - CT_SIX_LIGHT, - CT_MDATA_INIT, - CT_MDATA_COM, - CT_POSFLAG_CLEAR, - CT_START_LATCH, - CT_ROCKER, - CT_CIRCLERUN_POSITION, - CT_GLUEDISPENSER_SET, - CT_GLUEDISPENSER_CLEAR, - CT_GLUEDISPENSER_START, - CT_GLUEDISPENSER_STOP, - //תʱ - CT_RTSET, - CT_BINSDATA, - CT_RTSTOP, - // CT_MOTOR_UPDATE, // up date all the aixs + CT_MOTOR_SET = 0x01, + CT_START_JOG_POS, + // + CT_START_JOG_NEG, + CT_START_POSITION, + //_POS, + CT_STOP, + CT_GOHOME, + CT_TRIGGER_DATA, + CT_SIX_LIGHT, + CT_MDATA_INIT, + CT_MDATA_COM, + CT_POSFLAG_CLEAR, + CT_START_LATCH, + CT_ROCKER, + CT_CIRCLERUN_POSITION, + CT_GLUEDISPENSER_SET, + CT_GLUEDISPENSER_CLEAR, + CT_GLUEDISPENSER_START, + CT_GLUEDISPENSER_STOP, + //תʱ + CT_RTSET, + CT_BINSDATA, + CT_RTSTOP, + // CT_MOTOR_UPDATE, // up date all the aixs }; -enum MOTOR_START_POSOTION // +enum MOTOR_START_POSOTION // { - INTERPOLATION = 0x61,//岹 - GANGED = 0x41,// - CIRCLER = 0x64, - CIRCLEL = 0x65, + INTERPOLATION = 0x61, + //岹 + GANGED = 0x41, + // + CIRCLER = 0x64, + CIRCLEL = 0x65, }; -enum MOTOR_AXISCHOOES_CMD //ָ +enum MOTOR_AXISCHOOES_CMD //ָ { - AXIS_X = 0x01, - AXIS_Y = 0x02, - AXIS_Z = 0x04, - AXIS_U = 0x08, - AXIS_XY = 0x03, - AXIS_XZ = 0x05, - AXIS_XU = 0x09, - AXIS_YZ = 0x06, - AXIS_YU = 0x0a, - AXIS_ZU = 0x0c, - AXIS_XYZ = 0x07, - AXIS_XYU = 0x0b, - AXIS_XZU = 0x0d, - AXIS_YZU = 0x0e, - AXIS_XYZU = 0x0f, + AXIS_X = 0x01, + AXIS_Y = 0x02, + AXIS_Z = 0x04, + AXIS_U = 0x08, + AXIS_XY = 0x03, + AXIS_XZ = 0x05, + AXIS_XU = 0x09, + AXIS_YZ = 0x06, + AXIS_YU = 0x0a, + AXIS_ZU = 0x0c, + AXIS_XYZ = 0x07, + AXIS_XYU = 0x0b, + AXIS_XZU = 0x0d, + AXIS_YZU = 0x0e, + AXIS_XYZU = 0x0f, }; -enum MOTOR_SET_KIND //ļָ +enum MOTOR_SET_KIND //ļָ { - JOG_SPEED_ACC_DEC, - POSITION_SPEED_ACC_DEC_POS, - HOME_LIMIT_SPEED_ACC_DEC, - HOME_ORG_SPEED_ACC_DEC, - SOFT_LIMIT_POS_NEG, - POS_CLEAR, - HOME_CLEAR, - ENC_POS_DIR, + JOG_SPEED_ACC_DEC, + POSITION_SPEED_ACC_DEC_POS, + HOME_LIMIT_SPEED_ACC_DEC, + HOME_ORG_SPEED_ACC_DEC, + SOFT_LIMIT_POS_NEG, + POS_CLEAR, + HOME_CLEAR, + ENC_POS_DIR, }; enum CMD_ORDER { - IOSTATE, - MOTORPOSITION, - MOTORSTATE + IOSTATE, + MOTORPOSITION, + MOTORSTATE }; enum E_SO7_MOTION_READ_TYPE { - E_DATA_TYPE_NONE, - E_DATA_TYPE_GET_POS, - E_DATA_TYPE_IO, + E_DATA_TYPE_NONE, + E_DATA_TYPE_GET_POS, + E_DATA_TYPE_IO, }; -typedef enum { +using TCPIP_RETURN_CODE = enum +{ TCPIP_CONNECT_OK = 0, TCPIP_INIT_WINSOCK_ERROR, TCPIP_INVAILD_SOCKET, @@ -134,59 +149,58 @@ typedef enum { TCPIP_TIMEOUT, TCPIP_WSAEWOULDBLOCK = 10035, TCPIP_CONNECT_STATUS_UNKNOWN - -} TCPIP_RETURN_CODE; +}; class HSI_Motion : public HSI { public: HSI_Motion(); - ~HSI_Motion(); - HSI_STATUS IsSupported(UINT &Types); - - virtual HSI_STATUS Startup(HWND _hWnd, bool _bOfflineOnly); - - HSI_STATUS GetFirmwareVersion(byte *version); + ~HSI_Motion() override; + HSI_STATUS IsSupported(UINT& Types) override; + HSI_STATUS Startup(HWND _hWnd, bool _bOfflineOnly) override; + HSI_STATUS GetFirmwareVersion(byte* version); HSI_STATUS HomeMachine(bool bHomed); HSI_STATUS HomeJog(short AxisNumber, short Dir, bool Wait = false); HSI_STATUS HomeFindIndex(); HSI_STATUS ZeroPos(bool bZeroPos); - HSI_STATUS IsHomed(bool &bHomed); - HSI_STATUS GetSpeedXyz(int AxisNum, double &Speed); - HSI_STATUS SetSpeedXyz(double Speed); - HSI_STATUS GetFocusSpeed(double &Speed); + HSI_STATUS IsHomed(bool& bHomed); + HSI_STATUS GetSpeedXyz(int AxisNum, double& Speed); + HSI_STATUS SetSpeedXyz(double Speed); + HSI_STATUS GetFocusSpeed(double& Speed); HSI_STATUS SetFocusSpeed(double Speed); - HSI_STATUS GetAccelerationXyz(double &AccelX, double &AccelY, double &AccelZ); - HSI_STATUS SetAccelerationXyz(double AccelX, double AccelY, double AccelZ); - HSI_STATUS GetSpeedR(double &Speed); - HSI_STATUS SetSpeedR(double Speed); + HSI_STATUS GetAccelerationXyz(double& AccelX, double& AccelY, double& AccelZ); + HSI_STATUS SetAccelerationXyz(double AccelX, double AccelY, double AccelZ); + HSI_STATUS GetSpeedR(double& Speed); + HSI_STATUS SetSpeedR(double Speed); - HSI_STATUS GetScaleResolution(double &_ScaleX, double &_ScaleY, double &_ScaleZ); + HSI_STATUS GetScaleResolution(double& _ScaleX, double& _ScaleY, double& _ScaleZ); HSI_STATUS SetScaleResolution(double _ScaleX, double _ScaleY, double _ScaleZ); - HSI_STATUS GetDeadBand(double &DeadbandX, double &DeadbandY, double &DeadbandZ, double &DeadbandR); - HSI_STATUS GetRefreshDeadBand(double &Deadband); + HSI_STATUS GetDeadBand(double& DeadbandX, double& DeadbandY, double& DeadbandZ, double& DeadbandR); + HSI_STATUS GetRefreshDeadBand(double& Deadband); HSI_STATUS Jog(UINT AxisTypes, double Speed); HSI_STATUS JoyStick(UINT AxisTypes, long Speed); HSI_STATUS StopJog(); - HSI_STATUS StopJogEx(UINT AxisTypes); - HSI_STATUS GetPositionEncPrfMulti(UINT AxisTypes, double *EncPos, double *PrfPos, int Count); - HSI_STATUS GetPositionXyz(UINT AxisTypes, double &PositionX, double &PositionY, double &PositionZ, double &Time); - HSI_STATUS GetPositionXyzaProbe(UINT AxisTypes, double &PositionX, double &PositionY, double &PositionZ, double &PositionA); - HSI_STATUS GetEncoderXyz(long *lEncoderVal); + HSI_STATUS GetPositionEncPrfMulti(UINT AxisTypes, double* EncPos, double* PrfPos, int Count); + HSI_STATUS GetPositionXyz(UINT AxisTypes, double& PositionX, double& PositionY, double& PositionZ, double& Time); + HSI_STATUS GetPositionXyzaProbe(UINT AxisTypes, double& PositionX, double& PositionY, double& PositionZ, + double& PositionA); + HSI_STATUS GetEncoderXyz(long* lEncoderVal); HSI_STATUS JogProbe(UINT AxisTypes, double Speed); void ProbeRetractManDist(int RetractManDist); int CaculateStepMotorACC(int pos, int maxacc, int minacc); - HSI_STATUS SetPositionXyz(UINT AxisTypes, double PositionX, double PositionY, double PositionZ, HSI_MOTION_MOVE_TYPE eType, double dFlyRadius); - HSI_STATUS SetPositionXyza(UINT AxisTypes, double PositionX, double PositionY, double PositionZ, double PositionA, HSI_MOTION_MOVE_TYPE eType, double dFlyRadius); - HSI_STATUS SetPositionXyzCache(UINT AxisTypes, HSI_MOTION_MOVE_TYPE eType, int DataCount, Point *CacheData); - HSI_STATUS GetPositionR(UINT AxisTypes, double &PositionR, double &Time); - HSI_STATUS SetPositionR(UINT AxisTypes, double PositionR, HSI_MOTION_AXIS_R_MOVE_TYPE DirectionType, bool bWait); - HSI_STATUS SetCircleInterpolate(double PositionX, double PositionY, double PositionZ); + HSI_STATUS SetPositionXyz(UINT AxisTypes, double PositionX, double PositionY, double PositionZ, + HSI_MOTION_MOVE_TYPE eType, double dFlyRadius); + HSI_STATUS SetPositionXyza(UINT AxisTypes, double PositionX, double PositionY, double PositionZ, double PositionA, + HSI_MOTION_MOVE_TYPE eType, double dFlyRadius); + HSI_STATUS SetPositionXyzCache(UINT AxisTypes, HSI_MOTION_MOVE_TYPE eType, int DataCount, Point* CacheData); + HSI_STATUS GetPositionR(UINT AxisTypes, double& PositionR, double& Time); + HSI_STATUS SetPositionR(UINT AxisTypes, double PositionR, HSI_MOTION_AXIS_R_MOVE_TYPE DirectionType, bool bWait); + HSI_STATUS SetCircleInterpolate(double PositionX, double PositionY, double PositionZ); HSI_STATUS Load_EF3_Motion_Inifile(CString GoogolIniFile); HSI_STATUS Load_EF3_Config_Inifile(CString GoogolIniFile); HSI_STATUS AbortMotion(); @@ -194,280 +208,283 @@ public: HSI_STATUS GetDIO(UINT IOChannel, UINT& _Status); HSI_STATUS SetDIO(UINT IOChannel, UINT _Status); HSI_STATUS GetAxisStatus(int* _Status); - HSI_STATUS GetAppPath(CString &Path); - virtual HSI_STATUS Shutdown(); + HSI_STATUS GetAppPath(CString& Path); + HSI_STATUS Shutdown() override; - HSI_STATUS IsSupportedEx(UINT AxisTypes, UINT &Types); + HSI_STATUS IsSupportedEx(UINT AxisTypes, UINT& Types); HSI_STATUS StartupEx(UINT AxisTypes, bool bHome); - HSI_STATUS GetScaleResolutionEx(UINT AxisTypes, double &Scale); + HSI_STATUS GetScaleResolutionEx(UINT AxisTypes, double& Scale); HSI_STATUS SetScaleResolutionEx(UINT AxisTypes, double Scale); - HSI_STATUS GetPositionEx(UINT AxisTypes, double &Position, double &Time); - HSI_STATUS SetPositionStep(UINT AxisTypes, double Position, HSI_MOTION_MOVE_TYPE eType, double dSpeedGear); - HSI_STATUS SetPositionEx(UINT AxisTypes, double Position, HSI_MOTION_MOVE_TYPE eType, double dSpeedGear); - HSI_STATUS GetSpeedEx(UINT AxisTypes, double &Speed); + HSI_STATUS GetPositionEx(UINT AxisTypes, double& Position, double& Time); + HSI_STATUS SetPositionStep(UINT AxisTypes, double Position, HSI_MOTION_MOVE_TYPE eType, double dSpeedGear); + HSI_STATUS SetPositionEx(UINT AxisTypes, double Position, HSI_MOTION_MOVE_TYPE eType, double dSpeedGear); + HSI_STATUS GetSpeedEx(UINT AxisTypes, double& Speed); HSI_STATUS SetSpeedEx(UINT AxisTypes, double Speed); - HSI_STATUS GetAccelerationEx(UINT AxisTypes, double &Accel); + HSI_STATUS GetAccelerationEx(UINT AxisTypes, double& Accel); HSI_STATUS SetAccelerationEx(UINT AxisTypes, double Accel); - HSI_STATUS SetTriggerLight(int triggleNum, int delayLighting, int delayLightBefor,int triggleMode, double* Intensities); - HSI_STATUS DCCPPStartPoint(double *startPoint); + HSI_STATUS SetTriggerLight(int triggleNum, int delayLighting, int delayLightBefor, int triggleMode, + double* Intensities); + HSI_STATUS DCCPPStartPoint(double* startPoint); HSI_STATUS DCCScanSetData(UINT AxisTypes, HSI_SCAN_MOTION_TYPE eType, UINT lTrigNumber, double* dTrigDis); HSI_STATUS DCCScanStart(); HSI_STATUS DCCScanStop(); HSI_STATUS DCCForLightPlate(); HSI_STATUS IOStep(bool RunSts); - HSI_STATUS IOprogram(byte* SendData,int length); + HSI_STATUS IOprogram(byte* SendData, int length); HSI_STATUS FindOriginTest(bool state); - HSI_STATUS StartPlcJob(int* CamerasDis, int* BinsDis, int SubArea,int filterTime1, int filterTime2,int pluseSumDis); + HSI_STATUS StartPlcJob(int* CamerasDis, int* BinsDis, int SubArea, int filterTime1, int filterTime2, + int pluseSumDis); HSI_STATUS SendBinResult(int* BinResult); HSI_STATUS GetTriggleCount(int* nCount, int& nArea); - HSI_STATUS GluePPSpnts(int* ppsDir, double* gluePPSPos, int* delayLightBefore, int* lightTime, double* lightData, int num); - HSI_STATUS GlueDispenser(int* index, int* cirdirection , double* gluePos, int num); + HSI_STATUS GluePPSpnts(int* ppsDir, double* gluePPSPos, int* delayLightBefore, int* lightTime, double* lightData, + int num); + HSI_STATUS GlueDispenser(int* index, int* cirdirection, double* gluePos, int num); HSI_STATUS GlueDispenserStart(double xOffset, double yOffset, double qOffset); - HSI_STATUS GetPntsDistance(double& ptpDistance,int& spTimeCount); + HSI_STATUS GetPntsDistance(double& ptpDistance, int& spTimeCount); public: - static int m_Thread_State; - static HANDLE m_Thread_Id; - static HANDLE m_Thread_Mutex; - static HANDLE m_hTriggerEvent; - //IOϢ߳ - static int m_Thread_StateIO; - static HANDLE m_Thread_IdIO; - static HANDLE m_Thread_MutexIO; - static HANDLE m_hTriggerEventIO; + static int m_Thread_State; + static HANDLE m_Thread_Id; + static HANDLE m_Thread_Mutex; + static HANDLE m_hTriggerEvent; + //IOϢ߳ + static int m_Thread_StateIO; + static HANDLE m_Thread_IdIO; + static HANDLE m_Thread_MutexIO; + static HANDLE m_hTriggerEventIO; - //ȡEF3״̬ - static int m_Thread_StateData; - static HANDLE m_Thread_IdData; - static HANDLE m_Thread_MutexData; - static HANDLE m_hTriggerEventData; + //ȡEF3״̬ + static int m_Thread_StateData; + static HANDLE m_Thread_IdData; + static HANDLE m_Thread_MutexData; + static HANDLE m_hTriggerEventData; - //ȡEF3̽״̬ - static int m_Thread_StateProbe; - static HANDLE m_Thread_IdProbe; - static HANDLE m_Thread_MutexProbe; - static HANDLE m_hTriggerEventProbe; + //ȡEF3̽״̬ + static int m_Thread_StateProbe; + static HANDLE m_Thread_IdProbe; + static HANDLE m_Thread_MutexProbe; + static HANDLE m_hTriggerEventProbe; - //㽺״̬ - static int bRunGlueDispenser; + //㽺״̬ + static int bRunGlueDispenser; - //ȡEF3JOG stop ״̬ - static int m_Thread_StateJOGStop; - static HANDLE m_Thread_IdJOGStop; - static HANDLE m_Thread_MutexJOGStop; - static HANDLE m_hTriggerEventJOGStop; + //ȡEF3JOG stop ״̬ + static int m_Thread_StateJOGStop; + static HANDLE m_Thread_IdJOGStop; + static HANDLE m_Thread_MutexJOGStop; + static HANDLE m_hTriggerEventJOGStop; - static HANDLE g_RW_Data_Mutex; - static HANDLE g_WR_ToMove_Mutex; - static HANDLE g_Lock_JogAndTrigger; + static HANDLE g_RW_Data_Mutex; + static HANDLE g_WR_ToMove_Mutex; + static HANDLE g_Lock_JogAndTrigger; - double m_Resolution[5];//1ʼ,0 - double m_N_Work_Limit[5]; //λ - double m_P_Work_Limit[5]; //λ + double m_Resolution[5]; //1ʼ,0 + double m_N_Work_Limit[5]; //λ + double m_P_Work_Limit[5]; //λ - int m_Home_AddJogGears[5]; - int m_Home_DecJogGears[5]; - int m_Home_Time[5]; - int m_SetPotion_Count[5]; + int m_Home_AddJogGears[5]; + int m_Home_DecJogGears[5]; + int m_Home_Time[5]; + int m_SetPotion_Count[5]; - //λ - int m_SetPotion_StartSpeed[5]; - int m_SetPotion_DriveSpeed[5]; - int m_SetPotion_Line[5]; - int m_SetPotion_Buffer[5]; - int m_SetPotion_AccCurve[5]; - int m_SetPotion_DecCurve[5]; - int m_SpeedAdjustPeriod[5]; - int m_SpeedMax[5]; - int m_stepPosition_L_speed[10]; - int m_stepPosition_H_speed[10]; - int m_stepPosition_Load[10]; - int m_stepPosition_acc[10]; - double m_PositionA;//ĵλλ + //λ + int m_SetPotion_StartSpeed[5]; + int m_SetPotion_DriveSpeed[5]; + int m_SetPotion_Line[5]; + int m_SetPotion_Buffer[5]; + int m_SetPotion_AccCurve[5]; + int m_SetPotion_DecCurve[5]; + int m_SpeedAdjustPeriod[5]; + int m_SpeedMax[5]; + int m_stepPosition_L_speed[10]; + int m_stepPosition_H_speed[10]; + int m_stepPosition_Load[10]; + int m_stepPosition_acc[10]; + double m_PositionA; //ĵλλ - //jog - int m_JogDriveSpeed[5][5];//5,1ʼ5λ - int m_JogStartSpeed[5][5]; - int m_JogAccLine[5][5]; - int m_JogDecLine[5][5]; - int m_JogAccCurve[5][5]; - int m_JogDecCurve[5][5]; - int m_Jog_Auto_Focus;//佹ʹõٶ + //jog + int m_JogDriveSpeed[5][5]; //5,1ʼ5λ + int m_JogStartSpeed[5][5]; + int m_JogAccLine[5][5]; + int m_JogDecLine[5][5]; + int m_JogAccCurve[5][5]; + int m_JogDecCurve[5][5]; + int m_Jog_Auto_Focus; //佹ʹõٶ - int m_LogIsOpen[5];//Ƿ򿪼¼0Ϊ򿪣0Ϊر + int m_LogIsOpen[5]; //Ƿ򿪼¼0Ϊ򿪣0Ϊر - unsigned int m_precisionCount[5]; - unsigned int m_precisionTime[5]; - int m_StopJogMode[5];//JOGģʽüͣƽֹͣ - double m_PosThread[5];//SetpositionXyzĿλ - int m_PosNow[5];//SetpositionXyzʱȡǰλ + unsigned int m_precisionCount[5]; //ؼ + unsigned int m_precisionTime[5]; //ʱʱ(0.1ms) + int m_StopJogMode[5]; //JOGģʽüͣƽֹͣ + double m_PosThread[5]; //SetpositionXyzĿλ + int m_PosNow[5]; //SetpositionXyzʱȡǰλ - double targetpos_n[5]; - double targetpos_l[5]; + double targetpos_n[5]; + double targetpos_l[5]; - short m_AxisThread; - int m_IsExMotion; //0xyzõģ1ǵõģ2 - int m_Home_Machine_Axis[5];//ʱҪԭѡ - int m_Home_Pos_Axis[5];//סرյԴʱλãжǷҪԭ - int m_IsHomeEncPos; //ǷʵλжǷؼңĬ01ã0ر - int m_IsHomePrfPos; //Ƿ滮λжǷؼңĬ11ã0ر + short m_AxisThread; + int m_IsExMotion; //0xyzõģ1ǵõģ2 + int m_Home_Machine_Axis[5]; //ʱҪԭѡ + int m_Home_Pos_Axis[5]; //סرյԴʱλãжǷҪԭ + int m_IsHomeEncPos; //ǷʵλжǷؼңĬ01ã0ر + int m_IsHomePrfPos; //Ƿ滮λжǷؼңĬ11ã0ر - int m_IsIOFuntion;//ǷIOܣ1Ϊ򿪣0Ϊر - int m_IsStartInput;//Ƿý̤عܣ1Ϊã0ΪرգĬ0 - UINT m_StartInputPort;//ⲿ밴ť - UINT m_InputStatus; - UINT m_ForStatus; - int m_Set_XYZA_Reserve;//XYZA᷽ - int m_motorType;// 1Ϊŷ 0Ϊ - int m_setPositionDelay;//öλʱ - int m_setPositionPrecision;//öλ - int m_setPositionNum; - CString m_AppPath; - //MSTб־trueMSTѾfalseMSTֹͣ - bool m_MSTRunFlag; - int m_IsUse_HSICompensation;//ǷHSIжλ 0Ϊ 1Ϊ ĬΪ0 - int m_Compensation_Pluse;// - int m_IsHardLimit; //豸Ӳλ Ϊ0ʾᶼΪλ 1ΪXΪӲλ 2ΪY 3ΪXY 4ΪZ 7ΪXYZ ĬΪ7 - int m_IsEnableAxis; //豸 Ϊ0ʾ᲻ 1ΪX 2ΪY 3ΪXY 4ΪZ 7ΪXYZ ĬΪ7 - int m_IsUseExternalTrigger; //Ƿⴥ 0Ϊ 1Ϊ ĬΪ1 - int m_IsUseSixRingEightArea; //Ƿƹ 0Ϊ 1Ϊ 2Ϊ ĬΪ0 - int m_SixEightSubArea[8]; // - int m_IsUseTwentySixLight;//Ƿ26·ƹ 0Ϊ 1λ ĬΪ0 - int m_IsUseEF3;//ǷEF3 - int m_DeviceType;//豸ͣ0Ϊͨ豸1Ϊ, 2ΪҰ3Ϊת豸 ĬΪ0 - int m_UseAxisNum;//ת豸ʹ - int m_IbinCount;//¼ȡķbin - bool m_IsUsePPS; - int m_iJoyStick;//ңͣ0 1ʽҡ - int m_bISUseMoreLights; - int m_EF3LightType; - int m_LightType; - int m_IsUseFourthSpeed; - CString m_IsOpenTCPIP[4];//ṩtcpͨŵip - bool m_tcpCntFlag[4]; - int m_selectedIndex; - bool m_Led8MotionFlag[4];//ǷΪ8·Դ - int m_IsHavePattern;//Ƿйդ - int m_AxisHomeDirection;//ؼʱķ - int m_IsUseJerk;//Ƿüͣ 0Ϊ 1Ϊ - DWORD t_start;//ȡjogеĿʼʱ - DWORD t_end;//ȡjogеĽʱ - DWORD set_start;//ȡλпʼʱ - DWORD set_end;//ȡλнʱ - //Ƿ̽벶ܣ1ãĬ0ر - int m_IsProbe; - //̽봥ʱţĬ3ʾXYZ3ᣬ4ʾXYZA4 - int m_ProbeAllAxis; - long m_ProbeCapturePos[5];//λ - double m_ProbeReturnPos;//̽봥ʱʱصľmmťʱ,Ĭ10.0mm - int m_ProbeReturnSpeed;//̽봥Ļٶ - int m_isOKGlint; //Ƿok/ng ˸ - int m_ETIPort;//ⲿ˿ں - int m_axisStatus;//˶״̬ - int m_axisAlarmStatus;//ᱨ״̬ - int m_EF3COMPort;//EF3comڣĬΪ2 - int m_ForSoft;//ʹ 0ΪMST 1ΪMetus - int m_IsUseManualRunin;//Ƿֶ岹ֻԲ + int m_IsIOFuntion; //ǷIOܣ1Ϊ򿪣0Ϊر + int m_IsStartInput; //Ƿý̤عܣ1Ϊã0ΪرգĬ0 + UINT m_StartInputPort; //ⲿ밴ť + UINT m_InputStatus; + UINT m_ForStatus; + int m_Set_XYZA_Reserve; //XYZA᷽ + int m_motorType; // 1Ϊŷ 0Ϊ + int m_setPositionDelay; //öλʱ + int m_setPositionPrecision; //öλ + int m_setPositionNum; + CString m_AppPath; + //MSTб־trueMSTѾfalseMSTֹͣ + bool m_MSTRunFlag; + int m_IsUse_HSICompensation; //ǷHSIжλ 0Ϊ 1Ϊ ĬΪ0 + int m_Compensation_Pluse; // + int m_IsHardLimit; //豸Ӳλ Ϊ0ʾᶼΪλ 1ΪXΪӲλ 2ΪY 3ΪXY 4ΪZ 7ΪXYZ ĬΪ7 + int m_IsEnableAxis; //豸 Ϊ0ʾ᲻ 1ΪX 2ΪY 3ΪXY 4ΪZ 7ΪXYZ ĬΪ7 + int m_IsUseExternalTrigger; //Ƿⴥ 0Ϊ 1Ϊ ĬΪ1 + int m_IsUseSixRingEightArea; //Ƿƹ 0Ϊ 1Ϊ 2Ϊ ĬΪ0 + int m_SixEightSubArea[8]; // + int m_IsUseTwentySixLight; //Ƿ26·ƹ 0Ϊ 1λ ĬΪ0 + int m_IsUseEF3; //ǷEF3 + int m_DeviceType; //豸ͣ0Ϊͨ豸1Ϊ, 2ΪҰ3Ϊת豸 ĬΪ0 + int m_UseAxisNum; //ת豸ʹ + int m_IbinCount; //¼ȡķbin + bool m_IsUsePPS; + int m_iJoyStick; //ҡͣ0 1ʽҡ + int m_bISUseMoreLights; //ƹ + int m_EF3LightType; + int m_LightType; + int m_IsUseFourthSpeed; + CString m_IsOpenTCPIP[4]; //ṩtcpͨŵip + bool m_tcpCntFlag[4]; + int m_selectedIndex; + bool m_Led8MotionFlag[4]; //ǷΪ8·Դ + int m_IsHavePattern; //Ƿйդ + int m_AxisHomeDirection; //ؼʱķ + int m_IsUseJerk; //Ƿüͣ 0Ϊ 1Ϊ + DWORD t_start; //ȡjogеĿʼʱ + DWORD t_end; //ȡjogеĽʱ + DWORD set_start; //ȡλпʼʱ + DWORD set_end; //ȡλнʱ + //Ƿ̽벶ܣ1ãĬ0ر + int m_IsProbe; + //̽봥ʱţĬ3ʾXYZ3ᣬ4ʾXYZA4 + int m_ProbeAllAxis; + long m_ProbeCapturePos[5]; //λ + double m_ProbeReturnPos; //̽봥ʱʱصľmmťʱ,Ĭ10.0mm + int m_ProbeReturnSpeed; //̽봥Ļٶ + int m_isOKGlint; //Ƿok/ng ˸ + int m_ETIPort; //ⲿ˿ں + int m_axisStatus; //˶״̬ + int m_axisAlarmStatus; //ᱨ״̬ + int m_EF3COMPort; //EF3comڣĬΪ2 + int m_ForSoft; //ʹ 0ΪMST 1ΪMetus + int m_IsUseManualRunin; //Ƿֶ岹ֻԲ int m_IsUseRocker; //Ƿҡ 0Ϊ 1Ϊþҡˣ2Ϊҡˣ ĬΪ0 int m_IsCollectPos; //Ƿͨڴӡλãҡ2 - int m_IsCloseRocker; - int m_IsLightDebug;//Ƿ񲻻ؼҲܵԵƹ 0Ϊ 1Ϊ ĬΪ0 - int m_rockerHStartSpeed[4];//ҡXYZ߳ʼٶ - int m_rockerHDriveSpeed[4];//ҡXYZٶ - int m_rockerLStartSpeed[4];//ҡXYZͳʼٶ - int m_rockerLDriveSpeed[4];//ҡXYZٶ - int m_rockerASpeed[4]; //XYZӼ1 - int m_rockerDSpeed[4]; //XYZӼ2 - int m_SaveAxisNum;// - int m_SaveAxisSpeed;//ٶ - bool bSaveSpeedFlag; - bool fourthAxisFlag; - bool bCircleRun;//Բ岹 - int iCircleRunPnt[5];//Բ岹ʱԲλ - int jogAxisNum;//jog˶ - int jogspeed; - bool jogMoving; - bool jogDirFlag; - bool m_bEmergencyState; - bool bUseGlueDispenser;//Ƿ㽺 - int m_iGlueStartSpeed; - int m_iGlueDriveSpeed; - int m_iGlueAccSpeed; - int GlueDispenserindexNum;//㽺 - int GluerunCount; + int m_IsCloseRocker; + int m_IsLightDebug; //Ƿ񲻻ؼҲܵԵƹ 0Ϊ 1Ϊ ĬΪ0 + int m_rockerHStartSpeed[4]; //ҡXYZ߳ʼٶ + int m_rockerHDriveSpeed[4]; //ҡXYZٶ + int m_rockerLStartSpeed[4]; //ҡXYZͳʼٶ + int m_rockerLDriveSpeed[4]; //ҡXYZٶ + int m_rockerASpeed[4]; //XYZӼ1 + int m_rockerDSpeed[4]; //XYZӼ2 + int m_SaveAxisNum; // + int m_SaveAxisSpeed; //ٶ + bool bSaveSpeedFlag; + bool fourthAxisFlag; + bool bCircleRun; //Բ岹 + int iCircleRunPnt[5]; //Բ岹ʱԲλ + int jogAxisNum; //jog˶ + int jogspeed; + bool jogMoving; + bool jogDirFlag; + bool m_bEmergencyState; + bool bUseGlueDispenser; //Ƿ㽺 + int m_iGlueStartSpeed; + int m_iGlueDriveSpeed; + int m_iGlueAccSpeed; + int GlueDispenserindexNum; //㽺 + int GluerunCount; int m_iSpeedType; - int m_axisDirX;//̽˶ʱX˶ - int m_axisDirY;//̽˶ʱY˶ - int m_axisDirZ;//̽˶ʱZ˶ - int m_probeSeekSpeed; + int m_axisDirX; //̽˶ʱX˶ + int m_axisDirY; //̽˶ʱY˶ + int m_axisDirZ; //̽˶ʱZ˶ + int m_probeSeekSpeed; - int m_isUseAport;//A - int m_portAnum; - int m_isUseBport;//B - int m_portBnum; + int m_isUseAport; //A + int m_portAnum; + int m_isUseBport; //B + int m_portBnum; - int SpCompleteTStart; - int SpCompleteTEnd; - int SpTimeCount; - bool SetPotionRunEnd; - double PntToPntDistance; + int SpCompleteTStart; + int SpCompleteTEnd; + int SpTimeCount; + bool SetPotionRunEnd; + double PntToPntDistance; - double m_LockPos[5]; - double m_ijk[5]; - int m_AxisHex[5]; - bool setLightFlag; + double m_LockPos[5]; + double m_ijk[5]; + int m_AxisHex[5]; + bool setLightFlag; - double m_EncPos[5]; - double m_PrfPos[5]; - double m_PosForAllAxis[5];//¼4λ - bool m_bConnected; - int m_SendDataLength; - unsigned char m_cSendData[64]; - unsigned char m_direct_pos; - unsigned char axis_start; + double m_EncPos[5]; + double m_PrfPos[5]; + double m_PosForAllAxis[5]; //¼4λ + bool m_bConnected; + int m_SendDataLength; + unsigned char m_cSendData[64]; + unsigned char m_direct_pos; + unsigned char axis_start; - CPSerial m_SO7_Serial; - DWORD m_WriteByte; - BOOL Send_Command(int com, const char* _SendData, DWORD _SendDataLength); - BOOL Receive_Data(); - bool PortInit(int iSerialComPort, int iBuadRate); - char m_RecvData[MAX_RECIEVE_BUFFER_SIZE]; - DWORD m_RecvDataSize; - E_EF3_HOME_STATUS CurrentHomeMachineState; + CPSerial m_SO7_Serial; + DWORD m_WriteByte; + BOOL Send_Command(int com, const char* _SendData, DWORD _SendDataLength); + BOOL Receive_Data(); + bool PortInit(int iSerialComPort, int iBuadRate); + char m_RecvData[MAX_RECIEVE_BUFFER_SIZE]; + DWORD m_RecvDataSize; + E_EF3_HOME_STATUS CurrentHomeMachineState; - //ˢ̽״̬ - static unsigned __stdcall m_ThreadProbe(LPVOID pThis); - void CreateThreadProbe(); - void CloseThreadProbe(); - void UpdateMotionStateProbe(); + //ˢ̽״̬ + static unsigned __stdcall m_ThreadProbe(LPVOID pThis); + void CreateThreadProbe(); + void CloseThreadProbe(); + void UpdateMotionStateProbe(); - //ˢλ״̬ - static unsigned __stdcall m_Thread(LPVOID pThis); - void CreateThread(); - void CloseThread(); - void UpdateMotionState(); - void UpdateMotionStateEx(); - void GluedispenserDone(); + //ˢλ״̬ + static unsigned __stdcall m_Thread(LPVOID pThis); + void CreateThread(); + void CloseThread(); + void UpdateMotionState(); + void UpdateMotionStateEx(); + void GluedispenserDone(); - //IOϢʹ - static unsigned __stdcall m_ThreadIO(LPVOID pThis); - void CreateThreadIO(); - void CloseThreadIO(); - void UpdateMotionStateIO(); + //IOϢʹ + static unsigned __stdcall m_ThreadIO(LPVOID pThis); + void CreateThreadIO(); + void CloseThreadIO(); + void UpdateMotionStateIO(); - //ȡEF3״̬ - static unsigned __stdcall m_ThreadData(LPVOID pThis); - void CreateThreadData(); - void CloseThreadData(); - void UpdateMotionStateData(); + //ȡEF3״̬ + static unsigned __stdcall m_ThreadData(LPVOID pThis); + void CreateThreadData(); + void CloseThreadData(); + void UpdateMotionStateData(); - //ȡEF3JOGλ ԱֹͣJOG˶ + //ȡEF3JOGλ ԱֹͣJOG˶ static unsigned __stdcall m_ThreadJOGStop(LPVOID pThis); void CreateThreadJOGStop(); void CloseThreadJOGStop(); @@ -476,12 +493,15 @@ public: void SendMsgMotionFinished(); void SendMsgProbeFinished(); VOID EventCallback(sHSIEventProperties& sEventProp); - int SpeedPercent(int AxisNum, double &Speed,int &DriveSpeed,int &StartSpeed, int &AccLine, int &DecLine,int &AccCurve,int &DecCurve); - bool SpeedPercentJoyStick(int AxisNum, long &Speed, int &DriveSpeed, int &StartSpeed, int &AccLine, int &DecLine, int &AccCurve, int &DecCurve); - void HomeJogGearsChoice(int AxisType, int JogGears, int &DriveSpeed, int &StartSpeed, int &AccLine, int &DecLine, int &AccCurve, int &DecCurve); + int SpeedPercent(int AxisNum, double& Speed, int& DriveSpeed, int& StartSpeed, int& AccLine, int& DecLine, + int& AccCurve, int& DecCurve); + bool SpeedPercentJoyStick(int AxisNum, long& Speed, int& DriveSpeed, int& StartSpeed, int& AccLine, int& DecLine, + int& AccCurve, int& DecCurve); + void HomeJogGearsChoice(int AxisType, int JogGears, int& DriveSpeed, int& StartSpeed, int& AccLine, int& DecLine, + int& AccCurve, int& DecCurve); short AxisConvertIndex(UINT AxisTypes); short IndexConvertAxis(int Index); - double LimitOver(UINT AxisTypes, double &LimitPos); + double LimitOver(UINT AxisTypes, double& LimitPos); int P2P(short AxisNumber, long Pos, double Speed, double Acc); void DoEvents(); HSI_STATUS DriverAlarmStatus(); @@ -490,46 +510,44 @@ public: HSI_STATUS SpecialMotorMove(short AxisNum, double Position); private: - UINT ActiveAxis; - int iaxisNum; - int iScanMotionType; - int iTriggleNum; - int iMotionDirection; - int begin_position[5]; //ⴥʼҪ͵ - HINSTANCE m_Hinst; - E_SO7_MOTION_TYPE CurrentMotionState; - E_SO7_MOTION_READ_TYPE CurrentReadDataType; - - //ͨ + UINT ActiveAxis; + int iaxisNum; + int iScanMotionType; + int iTriggleNum; + int iMotionDirection; + int begin_position[5]; //ⴥʼҪ͵ + HINSTANCE m_Hinst; + E_SO7_MOTION_TYPE CurrentMotionState; + E_SO7_MOTION_READ_TYPE CurrentReadDataType; + + //ͨ private: - TCPIP_RETURN_CODE TCPConnect(int index,char* Address, u_short port); - void DisConnect(); - static unsigned __stdcall m_ThreadSendTCP(LPVOID pThis); - static HANDLE m_ThreadTCP_Id; - static int m_ThreadTCP_State; - TCPIP_RETURN_CODE TCPSend(); - unsigned char tReciveData[TCPIP_MAX_DAT_SIZE]; - bool first; - unsigned char IOdata[64]; - unsigned char Orderdata[64]; - unsigned char IOCheck[64]; - unsigned char TempData[64]; - int OrderSend; - int IOSend; + TCPIP_RETURN_CODE TCPConnect(int index, char* Address, u_short port); + void DisConnect(); + static unsigned __stdcall m_ThreadSendTCP(LPVOID pThis); + static HANDLE m_ThreadTCP_Id; + static int m_ThreadTCP_State; + TCPIP_RETURN_CODE TCPSend(); + unsigned char tReciveData[TCPIP_MAX_DAT_SIZE]; + bool first; + unsigned char IOdata[64]; + unsigned char Orderdata[64]; + unsigned char IOCheck[64]; + unsigned char TempData[64]; + int OrderSend; + int IOSend; private: void Create_Thread(); void Exit_Thread(); int Init_Winsock(); - public: - unsigned char lightdata[64]; - int LightSend; public: - HSI_STATUS CollectPos(bool isEnable, MOTOR_AXISCHOOES_CMD axis, short cycle); //λòɼ/ر + unsigned char lightdata[64]; + int LightSend; +public: + HSI_STATUS CollectPos(bool isEnable, MOTOR_AXISCHOOES_CMD axis, short cycle); //λòɼ/ر private: - HSI_STATUS SetAllGears(); //·еλ + HSI_STATUS SetAllGears(); //·еλ }; -extern HSI_Motion *g_pHSI_Motion; +extern HSI_Motion* g_pHSI_Motion; #endif - - diff --git a/HSI_HexagonMI_EF3/HSI_Sevenocean_EF3.cpp b/HSI_HexagonMI_EF3/HSI_Sevenocean_EF3.cpp index e023c44..4d82cc0 100644 --- a/HSI_HexagonMI_EF3/HSI_Sevenocean_EF3.cpp +++ b/HSI_HexagonMI_EF3/HSI_Sevenocean_EF3.cpp @@ -11,23 +11,24 @@ #endif - //=========================================================================== -HSI_Sevenocean_EF3 *g_pHSI_Sevenocean_EF3 = nullptr; +HSI_Sevenocean_EF3* g_pHSI_Sevenocean_EF3 = nullptr; pEventCallback HSI_Sevenocean_EF3::m_pEventCallback = nullptr; //=========================================================================== HSI_Sevenocean_EF3::HSI_Sevenocean_EF3() { - hWnd = NULL; - bOfflineOnly = false; - TRACE0("HSI_Sevenocean_EF3 Constructor!\n"); + hWnd = nullptr; + bOfflineOnly = false; + TRACE0("HSI_Sevenocean_EF3 Constructor!\n"); } + //=========================================================================== HSI_Sevenocean_EF3::~HSI_Sevenocean_EF3() { - TRACE0("HSI_Sevenocean_EF3 Destructor!\n"); + TRACE0("HSI_Sevenocean_EF3 Destructor!\n"); } + //=========================================================================== /** * HSI ʼ @@ -38,45 +39,50 @@ HSI_Sevenocean_EF3::~HSI_Sevenocean_EF3() */ HSI_STATUS HSI_Sevenocean_EF3::Startup(HWND _hWnd, bool _bOfflineOnly) { - auto rStatus = HSI_STATUS_NORMAL; - hWnd = _hWnd; - bOfflineOnly = _bOfflineOnly; - return rStatus; + auto rStatus = HSI_STATUS_NORMAL; + hWnd = _hWnd; + bOfflineOnly = _bOfflineOnly; + return rStatus; } + //=========================================================================== -HSI_STATUS HSI_Sevenocean_EF3::GetMachineInfo(int &_NumMachineTypes) +HSI_STATUS HSI_Sevenocean_EF3::GetMachineInfo(int& _NumMachineTypes) { - auto rStatus = HSI_STATUS_NORMAL; - _NumMachineTypes = HSI_MACHINE_EF3; - return rStatus; + auto rStatus = HSI_STATUS_NORMAL; + _NumMachineTypes = HSI_MACHINE_EF3; //EF3 + return rStatus; } + //=========================================================================== HSI_STATUS HSI_Sevenocean_EF3::SetEventCallback(pEventCallback _pCallback) { - auto rStatus = HSI_STATUS_NORMAL; - if (_pCallback) - { - m_pEventCallback = _pCallback; - //sEvenProp.EventType = HSI_EVENT_FUNCTION; - //sEvenProp.EventID = HSI_EVENT_DEBUG_LOG; - //sEvenProp.EventCallbackID = 0; - //sEvenProp.EventResponse = HSI_EVENT_FUNCTION_OK; - //strcpy_s(sEvenProp.EventData, HSI_MaxStringLength, "Set callback succeed!"); - //EventCallback(sEvenProp); - } - return rStatus; + auto rStatus = HSI_STATUS_NORMAL; + if (_pCallback) + { + m_pEventCallback = _pCallback; + //sEvenProp.EventType = HSI_EVENT_FUNCTION; + //sEvenProp.EventID = HSI_EVENT_DEBUG_LOG; + //sEvenProp.EventCallbackID = 0; + //sEvenProp.EventResponse = HSI_EVENT_FUNCTION_OK; + //strcpy_s(sEvenProp.EventData, HSI_MaxStringLength, "Set callback succeed!"); + //EventCallback(sEvenProp); + } + return rStatus; } + //=========================================================================== VOID HSI_Sevenocean_EF3::EventCallback(sHSIEventProperties& _sEventProp) { - if (m_pEventCallback) - { - m_pEventCallback(_sEventProp.EventType, _sEventProp.EventResponse, _sEventProp.EventID, _sEventProp.EventData, _sEventProp.EventCallbackID); - } + if (m_pEventCallback) + { + m_pEventCallback(_sEventProp.EventType, _sEventProp.EventResponse, _sEventProp.EventID, _sEventProp.EventData, + _sEventProp.EventCallbackID); + } } + //=========================================================================== HSI_STATUS HSI_Sevenocean_EF3::Shutdown() { - auto rStatus = HSI_STATUS_NORMAL; - return rStatus; + auto rStatus = HSI_STATUS_NORMAL; + return rStatus; } diff --git a/HSI_HexagonMI_EF3/HSI_Sevenocean_EF3.h b/HSI_HexagonMI_EF3/HSI_Sevenocean_EF3.h index 076a614..6c48457 100644 --- a/HSI_HexagonMI_EF3/HSI_Sevenocean_EF3.h +++ b/HSI_HexagonMI_EF3/HSI_Sevenocean_EF3.h @@ -11,20 +11,18 @@ #include -class HSI_Sevenocean_EF3 :public HSI +class HSI_Sevenocean_EF3 : public HSI { public: - HSI_Sevenocean_EF3(); - ~HSI_Sevenocean_EF3(); - virtual HSI_STATUS Startup(HWND _hWnd, bool _bOfflineOnly); - HSI_STATUS GetMachineInfo(int &_NumMachineTypes); - HSI_STATUS SetEventCallback(pEventCallback _pCallback); - virtual HSI_STATUS Shutdown(); - static VOID EventCallback(sHSIEventProperties& sEventProp); + HSI_Sevenocean_EF3(); + ~HSI_Sevenocean_EF3() override; + HSI_STATUS Startup(HWND _hWnd, bool _bOfflineOnly) override; + HSI_STATUS GetMachineInfo(int& _NumMachineTypes); + HSI_STATUS SetEventCallback(pEventCallback _pCallback); + HSI_STATUS Shutdown() override; + static VOID EventCallback(sHSIEventProperties& sEventProp); private: - static pEventCallback m_pEventCallback; + static pEventCallback m_pEventCallback; }; -extern HSI_Sevenocean_EF3 *g_pHSI_Sevenocean_EF3; - - +extern HSI_Sevenocean_EF3* g_pHSI_Sevenocean_EF3; diff --git a/HSI_HexagonMI_EF3/SevenOcean/CMMIO_BASE.CPP b/HSI_HexagonMI_EF3/SevenOcean/CMMIO_BASE.CPP index 3299fd8..490ee55 100644 --- a/HSI_HexagonMI_EF3/SevenOcean/CMMIO_BASE.CPP +++ b/HSI_HexagonMI_EF3/SevenOcean/CMMIO_BASE.CPP @@ -14,244 +14,247 @@ ///////////////////////////////////////////////////////////////////////////// void CMMIO::Init() { - m_RXTempPtr = NULL; - m_RXHead=NULL; - m_RXTail=NULL; - m_SXTempPtr = NULL; - m_SXHead=NULL; - m_SXTail=NULL; - CurrentPointer=0; - m_iNbMsgWaiting=0; - m_terminator='\0'; - m_usesTerminator=FALSE; - m_pReceiveNotify = NULL; + m_RXTempPtr = nullptr; + m_RXHead = nullptr; + m_RXTail = nullptr; + m_SXTempPtr = nullptr; + m_SXHead = nullptr; + m_SXTail = nullptr; + CurrentPointer = 0; + m_iNbMsgWaiting = 0; + m_terminator = '\0'; + m_usesTerminator = FALSE; + m_pReceiveNotify = nullptr; } -void CMMIO::SetCallback(CMMIO::p_fstr ptr) +void CMMIO::SetCallback(p_fstr ptr) { - m_pReceiveNotify = ptr; + m_pReceiveNotify = ptr; } DWORD CMMIO::Send(CString buffer, BOOL needsResponse/*=FALSE*/) { - //ZH 12-12-05 EnterCriticalSection(&m_QueueLock); //ZH-122904 + //ZH 12-12-05 EnterCriticalSection(&m_QueueLock); //ZH-122904 - char LocBuffer[MAX_OUTPUT_BUFFER_SIZE]; - int length = buffer.GetLength (); - if (length >MAX_OUTPUT_BUFFER_SIZE) - { - length = MAX_OUTPUT_BUFFER_SIZE; - } + char LocBuffer[MAX_OUTPUT_BUFFER_SIZE]; + int length = buffer.GetLength(); + if (length > MAX_OUTPUT_BUFFER_SIZE) + { + length = MAX_OUTPUT_BUFFER_SIZE; + } - unsigned short* ptr = (unsigned short*)buffer.GetBuffer (MAX_OUTPUT_BUFFER_SIZE); + auto ptr = (unsigned short*)buffer.GetBuffer(MAX_OUTPUT_BUFFER_SIZE); - for (int i=0;i(ptr[i] & 0xff); + } + DWORD res = Send(LocBuffer, length, needsResponse); - //ZH 12-12-05 LeaveCriticalSection( &m_QueueLock ); //ZH-122904 + //ZH 12-12-05 LeaveCriticalSection( &m_QueueLock ); //ZH-122904 - return res; + return res; } // GetNextReceived() : Helper function, rreturns receives messages placed in the queue // by LineReceive() // -int CMMIO::GetNextReceived(char *inputBuf) +int CMMIO::GetNextReceived(char* inputBuf) { - struct SerialList *Free; - int cnt=0; + struct SerialList* Free; + int cnt = 0; - // If there is a previous block then delete it - if (NULL != m_RXTempPtr) - delete[] m_RXTempPtr; - m_RXTempPtr = NULL; + // If there is a previous block then delete it + if (nullptr != m_RXTempPtr) + delete[] m_RXTempPtr; + m_RXTempPtr = nullptr; - // We are messing with pointers so use the CriticalSection - // EnterCriticalSection(&m_QueueLock); + // We are messing with pointers so use the CriticalSection + // EnterCriticalSection(&m_QueueLock); - // If there any more to return - if( m_RXHead ) - { - Free = m_RXHead; - m_RXHead = m_RXHead->Next; + // If there any more to return + if (m_RXHead) + { + Free = m_RXHead; + m_RXHead = m_RXHead->Next; - // Point the temp pointer at the block - m_RXTempPtr = Free->Buffer; - cnt = Free->Bytes; - // delete the list entry - delete Free; - --m_iNbMsgWaiting; // mp + // Point the temp pointer at the block + m_RXTempPtr = Free->Buffer; + cnt = Free->Bytes; + // delete the list entry + delete Free; + --m_iNbMsgWaiting; // mp - // move over the data to the user's buffer - if (NULL != inputBuf) - memcpy (inputBuf, m_RXTempPtr, cnt); - } + // move over the data to the user's buffer + if (nullptr != inputBuf) + memcpy(inputBuf, m_RXTempPtr, cnt); + } - if( m_RXHead == NULL ) - m_RXTail = NULL; + if (m_RXHead == nullptr) + m_RXTail = nullptr; - // All done so out of the CriticalSection - // LeaveCriticalSection( &m_QueueLock ); + // All done so out of the CriticalSection + // LeaveCriticalSection( &m_QueueLock ); - return(cnt); + return (cnt); } -int CMMIO::AddReceived( const char *Buffer,DWORD Bytes) +int CMMIO::AddReceived(const char* Buffer, DWORD Bytes) { - DWORD index = 0; //primary buffer index - struct SerialList *Ptr; - static char Buffer2[MAX_RECIEVE_BUFFER_SIZE]; // result buffer - static char* pBuffer2 = &Buffer2[0]; - unsigned char c; - bool bArmed; - /************************************************************************/ - /* Greg Guilbeau - 2011/08/23 */ - /* The following line(s) have been modified to handle x64 conversion */ - /************************************************************************/ - /* int count; */ - INT_PTR count; - static int escape = 0; - static int tilde = 0; - static int tildeseqcount = 0; + DWORD index = 0; //primary buffer index + struct SerialList* Ptr; + static char Buffer2[MAX_RECIEVE_BUFFER_SIZE]; // result buffer + static char* pBuffer2 = &Buffer2[0]; + unsigned char c; + bool bArmed; + /************************************************************************/ + /* Greg Guilbeau - 2011/08/23 */ + /* The following line(s) have been modified to handle x64 conversion */ + /************************************************************************/ + /* int count; */ + INT_PTR count; + static int escape = 0; + static int tilde = 0; + static int tildeseqcount = 0; - bool bDone = false; - bool bEventRequest = false; + bool bDone = false; + bool bEventRequest = false; - //TRACE(_T("AddReceived> pBuffer2 = %x\n"),pBuffer2); - // TRACE(_T("Content %s\n"),Buffer); - if (FALSE /*Bytes==0*/) - { - TRACE(_T("CMMIO> Exiting , no real input")); - return TRUE; - } - do - { - bArmed = false; + //TRACE(_T("AddReceived> pBuffer2 = %x\n"),pBuffer2); + // TRACE(_T("Content %s\n"),Buffer); + if (FALSE /*Bytes==0*/) + { + TRACE(_T("CMMIO> Exiting , no real input")); + return TRUE; + } + do + { + bArmed = false; - for (;indexBuffer = new char[count + 1 ]; - /************************************************************************/ - /* Greg Guilbeau - 2011/08/23 */ - /* The following line(s) have been modified to handle x64 conversion */ - /************************************************************************/ - /* Ptr->Bytes = count; */ + // We are messing with pointers so use the CriticalSection + if (bArmed) + { + // EnterCriticalSection(&m_QueueLock); + //Allocate a new list and add it in + count = pBuffer2 - (&Buffer2[0]); + if (m_pReceiveNotify) + { + // send a string to callback or, + auto pLocalBuffer = new char[count + 1]; + if (pLocalBuffer) + { + memcpy(pLocalBuffer, Buffer2, count); + pLocalBuffer[count] = 0; + CString LocalStr(pLocalBuffer); + (*m_pReceiveNotify)(LocalStr); + delete pLocalBuffer; + } + } + else + { + // add it as before to received data .... + Ptr = new struct SerialList; + Ptr->Buffer = new char[count + 1]; + /************************************************************************/ + /* Greg Guilbeau - 2011/08/23 */ + /* The following line(s) have been modified to handle x64 conversion */ + /************************************************************************/ + /* Ptr->Bytes = count; */ #ifdef _WIN64 - Ptr->Bytes = WAI64bit::to32bit(count,__FILE__,__LINE__); + Ptr->Bytes = WAI64bit::to32bit(count,__FILE__,__LINE__); #else Ptr->Bytes = count,__FILE__,__LINE__; #endif - Ptr->Next = NULL; - memcpy( Ptr->Buffer, Buffer2, count ); - Ptr->Buffer[count] = 0; + Ptr->Next = nullptr; + memcpy(Ptr->Buffer, Buffer2, count); + Ptr->Buffer[count] = 0; - memcpy(m_sLastMessage,Buffer2,count); //copy to last message - m_sLastMessage[count]=0; + memcpy(m_sLastMessage, Buffer2, count); //copy to last message + m_sLastMessage[count] = 0; - if( m_RXTail ) - m_RXTail->Next = Ptr; - else - m_RXHead = Ptr; - m_RXTail = Ptr; + if (m_RXTail) + m_RXTail->Next = Ptr; + else + m_RXHead = Ptr; + m_RXTail = Ptr; - // All done so out of the CriticalSection - ++m_iNbMsgWaiting; - } - // LeaveCriticalSection( &m_QueueLock ); - pBuffer2=&Buffer2[0]; // reset out buffer - count = 0; - bEventRequest = true; - } - } - while (!bDone); - //TRACE (_T("CMMIO> Done\n")); + // All done so out of the CriticalSection + ++m_iNbMsgWaiting; + } + // LeaveCriticalSection( &m_QueueLock ); + pBuffer2 = &Buffer2[0]; // reset out buffer + count = 0; + bEventRequest = true; + } + } + while (!bDone); + //TRACE (_T("CMMIO> Done\n")); - return(TRUE); + return (TRUE); } void CMMIO::LineReceive(char* s, int nbCharAvail, BOOL ignoreDelimiter /*= FALSE*/) { - if (nbCharAvail != -1) - { - //TRACE(_T("LineReceive got %d chars \n"),nbCharAvail); - char c; - for (int i=0 ; iNext; - delete[] Free->Buffer; - delete Free; - } - m_RXHead = NULL; + // Clear down all internal lists + // EnterCriticalSection( &m_QueueLock ); + while (m_RXHead) + { + Free = m_RXHead; + m_RXHead = m_RXHead->Next; + delete[] Free->Buffer; + delete Free; + } + m_RXHead = nullptr; - // for now we are not using the Transmit list + // for now we are not using the Transmit list #if 0 while( m_TXHead ) @@ -263,11 +266,10 @@ DWORD CMMIO::Close() } m_TXHead = NULL; #endif - // LeaveCriticalSection( &m_QueueLock ); - return(TRUE); - + // LeaveCriticalSection( &m_QueueLock ); + return (TRUE); } + /////////////////////////////////////////////////////////////////////////////// // END OF BASE CLASS CMMIO /////////////////////////////////////////////////////////////////////////////// - diff --git a/HSI_HexagonMI_EF3/SevenOcean/CMMIO_BASE.H b/HSI_HexagonMI_EF3/SevenOcean/CMMIO_BASE.H index 34e02d9..d91198a 100644 --- a/HSI_HexagonMI_EF3/SevenOcean/CMMIO_BASE.H +++ b/HSI_HexagonMI_EF3/SevenOcean/CMMIO_BASE.H @@ -7,109 +7,120 @@ #define MAX_OUTPUT_BUFFER_SIZE 2048 #define MAX_RECIEVE_BUFFER_SIZE 3000 + // TCP, serial style routines struct SerialList { - struct SerialList *Next; - DWORD Bytes; - int Item; - char *Buffer; + struct SerialList* Next; + DWORD Bytes; + int Item; + char* Buffer; }; class CMMIO { private: - // For now we are not using the transmit list - // struct SerialList *m_TXHead; - char m_terminator; - BOOL m_usesTerminator; - char m_InputBuffer[MAX_RECIEVE_BUFFER_SIZE]; - int CurrentPointer; - char m_sLastMessage[MAX_RECIEVE_BUFFER_SIZE]; + // For now we are not using the transmit list + // struct SerialList *m_TXHead; + char m_terminator; + BOOL m_usesTerminator; + char m_InputBuffer[MAX_RECIEVE_BUFFER_SIZE]; + int CurrentPointer; + char m_sLastMessage[MAX_RECIEVE_BUFFER_SIZE]; - struct SerialList *m_RXHead; - struct SerialList *m_RXTail; - char *m_RXTempPtr; - CString m_LastError; - BOOL m_hasError; + struct SerialList* m_RXHead; + struct SerialList* m_RXTail; + char* m_RXTempPtr; + CString m_LastError; + BOOL m_hasError; protected: - CString m_lastErrMsg; - int m_iNbMsgWaiting; - BOOL m_UseBuffferedSend; - CRITICAL_SECTION m_QueueLock; - CRITICAL_SECTION m_ReadLock; - CRITICAL_SECTION m_WriteLock; + CString m_lastErrMsg; + int m_iNbMsgWaiting; + BOOL m_UseBuffferedSend; + CRITICAL_SECTION m_QueueLock; //ٽ + CRITICAL_SECTION m_ReadLock; + CRITICAL_SECTION m_WriteLock; - struct SerialList *m_SXHead; - struct SerialList *m_SXTail; - char *m_SXTempPtr; + struct SerialList* m_SXHead; + struct SerialList* m_SXTail; + char* m_SXTempPtr; protected: - virtual void Init(); - int AddReceived( const char *Buffer,DWORD Bytes); // [7/30/2004] - void Error(CString sErr) { - TRACE(sErr); - m_LastError = sErr; - m_hasError = TRUE; - } + virtual void Init(); + int AddReceived(const char* Buffer, DWORD Bytes); // [7/30/2004] + void Error(CString sErr) + { + TRACE(sErr); + m_LastError = sErr; + m_hasError = TRUE; + } - virtual DWORD Close(); + virtual DWORD Close(); public: - CMMIO() - { - InitializeCriticalSection( &m_QueueLock ); // Sean Flynn mutex needs to be initialized prior to attempting to lock otherwise it will core - InitializeCriticalSection( &m_ReadLock ); // initializing here will ensure the mutex is always initialized - InitializeCriticalSection( &m_WriteLock ); - Init(); - }; + CMMIO() + { + InitializeCriticalSection(&m_QueueLock); + // Sean Flynn mutex needs to be initialized prior to attempting to lock otherwise it will core + InitializeCriticalSection(&m_ReadLock); // initializing here will ensure the mutex is always initialized + InitializeCriticalSection(&m_WriteLock); + Init(); + }; - virtual ~CMMIO() - { - DeleteCriticalSection( &m_QueueLock ); // Clean up the mutexes resources when the destructor is called. - DeleteCriticalSection( &m_ReadLock ); - DeleteCriticalSection( &m_WriteLock ); - }; + virtual ~CMMIO() + { + DeleteCriticalSection(&m_QueueLock); // Clean up the mutexes resources when the destructor is called. + DeleteCriticalSection(&m_ReadLock); + DeleteCriticalSection(&m_WriteLock); + }; - virtual DWORD Open() { - return 0; - } + virtual DWORD Open() + { + return 0; + } - BOOL getError(CString& sErr) { - BOOL hasError = m_hasError; - if (m_hasError) - { - sErr = m_LastError; - m_hasError = FALSE; - } - return (hasError); - } + BOOL getError(CString& sErr) + { + BOOL hasError = m_hasError; + if (m_hasError) + { + sErr = m_LastError; + m_hasError = FALSE; + } + return (hasError); + } - virtual int GetNextReceived(char *inputBuf=NULL); + virtual int GetNextReceived(char* inputBuf = nullptr); - virtual int HasNextReceived(void) { - return (m_RXHead ? m_RXHead->Bytes : FALSE); - } - virtual void SetTerminateChar(char ch) { - m_terminator=ch; - m_usesTerminator=TRUE; - } - virtual void LineReceive(char* s, int nbCharAvail, BOOL ignoreDelimiter = FALSE); - virtual CString GetLastErrStr() { - return m_lastErrMsg; - } + virtual int HasNextReceived(void) + { + return (m_RXHead ? m_RXHead->Bytes : FALSE); + } - typedef void(*p_fstr)(CString); - void SetCallback(p_fstr); + virtual void SetTerminateChar(char ch) + { + m_terminator = ch; + m_usesTerminator = TRUE; + } - virtual DWORD Send(LPCSTR buffer, int l, BOOL needsResponse=FALSE) = 0; // [8/11/2004] - virtual DWORD Send(CString buffer, BOOL needsResponse=FALSE); // [8/11/2004] + virtual void LineReceive(char* s, int nbCharAvail, BOOL ignoreDelimiter = FALSE); - virtual bool IsValid() = 0; // pure virtual function + virtual CString GetLastErrStr() + { + return m_lastErrMsg; + } + + using p_fstr = void(*)(CString); + void SetCallback(p_fstr); + + virtual DWORD Send(LPCSTR buffer, int l, BOOL needsResponse = FALSE) = 0; // [8/11/2004] + virtual DWORD Send(CString buffer, BOOL needsResponse = FALSE); // [8/11/2004] + + virtual bool IsValid() = 0; // pure virtual function protected: - p_fstr m_pReceiveNotify; + p_fstr m_pReceiveNotify; }; -#endif // CMMIO_BASE_H \ No newline at end of file +#endif // CMMIO_BASE_H diff --git a/HSI_HexagonMI_EF3/SevenOcean/CMMIO_SERIAL.CPP b/HSI_HexagonMI_EF3/SevenOcean/CMMIO_SERIAL.CPP index 5617e2d..7642e67 100644 --- a/HSI_HexagonMI_EF3/SevenOcean/CMMIO_SERIAL.CPP +++ b/HSI_HexagonMI_EF3/SevenOcean/CMMIO_SERIAL.CPP @@ -29,67 +29,88 @@ static char Codes[][6] = unsigned int WINAPI CSerialTask(LPVOID CSerialPtr) { - TRACE( TEXT("Serial task has started \n") ); - // Call the ControlTask function in the specified plugin - ((CPSerial *)CSerialPtr)->ReceiveTask(); + TRACE(TEXT("Serial task has started \n")); + // Call the ControlTask function in the specified plugin + static_cast(CSerialPtr)->ReceiveTask(); - TRACE( TEXT("Serial task has completed \n") ); + TRACE(TEXT("Serial task has completed \n")); - _endthreadex(0); + _endthreadex(0); - return(0); + return (0); } CPSerial::CPSerial() { - // Serial port is not open - m_PortHandle = INVALID_HANDLE_VALUE; - m_IsWrtingData=FALSE; - // Default port settings - m_Port = 1; - m_Baud = CBR_115200; - m_Parity ='N'; - m_Bits = 8; - m_StopBits = 1; - m_HandShake =CS_HANDSHAKE_FOR_SO7; - m_RXTimeout = CS_DEFAULT_RX_TIMEOUT; - m_TXTimeout = CS_DEFAULT_TX_TIMEOUT; - m_iRecvState=FALSE; - m_iRecvBytes=0; - memset(m_RecvData,0,MAX_RECIEVE_BUFFER_SIZE); - // Everything else set to NULL - m_ThreadHandle = NULL; - //m_TXHead = NULL; - //m_TXTail = NULL; - //m_RXHead = NULL; - //m_RXTail =NULL; - memset( &m_ReceiveOLap, 0, sizeof( OVERLAPPED )); - memset( &m_TransmitOLap, 0, sizeof( OVERLAPPED )); - memset( &m_ReadOLap, 0, sizeof( OVERLAPPED )); - memset( &m_WriteOLap, 0, sizeof( OVERLAPPED )); + // Serial port is not open + m_PortHandle = INVALID_HANDLE_VALUE; + m_IsWrtingData = FALSE; + // Default port settings + m_Port = 1; + m_Baud = CBR_115200; + m_Parity = 'N'; + m_Bits = 8; + m_StopBits = 1; + m_HandShake = CS_HANDSHAKE_FOR_SO7; + m_RXTimeout = CS_DEFAULT_RX_TIMEOUT; + m_TXTimeout = CS_DEFAULT_TX_TIMEOUT; + m_iRecvState = FALSE; + m_iRecvBytes = 0; + memset(m_RecvData, 0,MAX_RECIEVE_BUFFER_SIZE); + // Everything else set to NULL + m_ThreadHandle = nullptr; + //m_TXHead = NULL; + //m_TXTail = NULL; + //m_RXHead = NULL; + //m_RXTail =NULL; + memset(&m_ReceiveOLap, 0, sizeof(OVERLAPPED)); + memset(&m_TransmitOLap, 0, sizeof(OVERLAPPED)); + memset(&m_ReadOLap, 0, sizeof(OVERLAPPED)); + memset(&m_WriteOLap, 0, sizeof(OVERLAPPED)); - m_hWaitCMMResponse = CreateEvent( NULL, TRUE, FALSE, NULL ); - m_hNewRx = CreateEvent( NULL, TRUE, FALSE, NULL ); // to trigger OnRx - m_ReadOLap.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL); + //¼ڶ߳ͬơ + //1HANDLE CreateEvent( + // + // LPSECURITY_ATTRIBUTES lpEventAttributes,// SECURITY_ATTRIBUTESṹָ룬ΪNULL + // BOOL bManualReset, // ֶ/Զ + // // TRUEʾֶWaitForSingleObjectֶResetEventź + // // FALSEʾԶWaitForSingleObjectϵͳԶ¼ź + // BOOL bInitialState, //ʼ״̬FALSEΪźţTRUEΪź + // LPCTSTR lpName //¼ + //); + // + //2SetEventΪ״̬ + // + //3ResetEventΪδ״̬ + // + //4WaitForSingleObjectźţδͻᴦڹ״ִ̬С + // + // + //ȨΪCSDNAIơԭ£ѭCC 4.0 BY - SAȨЭ飬ת븽ԭijӼ + //ԭӣhttps ://blog.csdn.net/hhhhhhhhhhwwwwwwwwww/article/details/108380956 - //m_RXTempPtr = NULL; - m_DebugInPtr = 0; - m_DebugCount = 0; - m_Item = 0; - m_MaxTXRetries = 5; - m_iRecvCount=252; - /* - // CriticalSection for locking lists - InitializeCriticalSection( &m_QueueLock ); - InitializeCriticalSection( &m_WriteLock ); - InitializeCriticalSection( &m_ReadLock ); - */ - // IsValidBuffer = FALSE; - CurrentPointer = 0; + m_hWaitCMMResponse = CreateEvent(nullptr, TRUE, FALSE, nullptr); + m_hNewRx = CreateEvent(nullptr, TRUE, FALSE, nullptr); // to trigger OnRx + m_ReadOLap.hEvent = CreateEvent(nullptr, TRUE, FALSE, nullptr); - m_hWaitCMMResponse = CreateEvent( NULL, TRUE, FALSE, NULL ); - m_hNewRx = CreateEvent( NULL, TRUE, FALSE, NULL ); // to trigger OnRx - // pParent = NULL; + //m_RXTempPtr = NULL; + m_DebugInPtr = 0; + m_DebugCount = 0; + m_Item = 0; + m_MaxTXRetries = 5; + m_iRecvCount = 252; + /* + // CriticalSection for locking lists + InitializeCriticalSection( &m_QueueLock ); + InitializeCriticalSection( &m_WriteLock ); + InitializeCriticalSection( &m_ReadLock ); + */ + // IsValidBuffer = FALSE; + CurrentPointer = 0; + + m_hWaitCMMResponse = CreateEvent(nullptr, TRUE, FALSE, nullptr); + m_hNewRx = CreateEvent(nullptr, TRUE, FALSE, nullptr); // to trigger OnRx + // pParent = NULL; } @@ -98,24 +119,23 @@ CPSerial::CPSerial() CPSerial::~CPSerial() { - if( IsOpen( ) ) - { - TRACE(TEXT("Warning : closing serial port in destructor\n")); - Close(); - } - while(GetNextReceived()) - ; // mp 3/3/99 prevents leaks - /* - DeleteCriticalSection( &m_QueueLock ); - DeleteCriticalSection( &m_ReadLock ); - DeleteCriticalSection( &m_WriteLock ); - */ - // close the overlapped io event - CloseHandle( m_ReadOLap.hEvent ); - CloseHandle( m_WriteOLap.hEvent ); - // - CloseHandle( m_hWaitCMMResponse ); - CloseHandle( m_hNewRx); + if (IsOpen()) + { + TRACE(TEXT("Warning : closing serial port in destructor\n")); + Close(); + } + while (GetNextReceived()); // mp 3/3/99 prevents leaks + /* + DeleteCriticalSection( &m_QueueLock ); + DeleteCriticalSection( &m_ReadLock ); + DeleteCriticalSection( &m_WriteLock ); + */ + // close the overlapped io event + CloseHandle(m_ReadOLap.hEvent); + CloseHandle(m_WriteOLap.hEvent); + // + CloseHandle(m_hWaitCMMResponse); + CloseHandle(m_hNewRx); } @@ -125,76 +145,76 @@ CPSerial::~CPSerial() DWORD CPSerial::Open() { - CString PortName; - COMMTIMEOUTS CommTimeOut; - int Ok; - unsigned int ThreadID; + CString PortName; + COMMTIMEOUTS CommTimeOut; + int Ok; + unsigned int ThreadID; - // Ensure the debug window is registered - // RegisterDebugWindow( ); + // Ensure the debug window is registered + // RegisterDebugWindow( ); - // Close the port incase it is already open - Close( ); + // Close the port incase it is already open + Close(); - // Start of assuming the worst - Ok = FALSE; + // Start of assuming the worst + Ok = FALSE; - // Format the file name and open it - // COM opens ports from 1..9 for two-difit ports it's becessary to use \\\\.\\COM + // Format the file name and open it + // COM opens ports from 1..9 for two-difit ports it's becessary to use \\\\.\\COM #if 0 PortName.Format( TEXT("\\\\.\\COM%d"), m_Port ); #else - PortName.Format( TEXT("COM%d"), m_Port ); + PortName.Format(TEXT("COM%d"), m_Port); #endif - m_PortHandle = CreateFile( PortName, GENERIC_WRITE | GENERIC_READ, 0, NULL, - OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED, - NULL ); - if( IsOpen( ) ) - { - // Setup the port according to the stored parameters - if( ProgramPort( m_Port, m_Baud, m_Parity, m_Bits, m_StopBits, m_HandShake ) ) - { - // Setup the timeouts - CommTimeOut.ReadIntervalTimeout = 25; - CommTimeOut.ReadTotalTimeoutMultiplier = 1; - CommTimeOut.ReadTotalTimeoutConstant = 1; - CommTimeOut.WriteTotalTimeoutMultiplier = 1; - CommTimeOut.WriteTotalTimeoutConstant = m_TXTimeout; - if( SetCommTimeouts( m_PortHandle, &CommTimeOut ) ) - { - // Setup the buffer sizes - if( SetupComm( m_PortHandle, 2048, 2048 ) ) - { - // Setup the event masks for the monitoring task - if( SetCommMask( m_PortHandle, EV_RXCHAR | EV_TXEMPTY | EV_BREAK | - EV_CTS | EV_DSR | EV_ERR | EV_RLSD ) ) - { - // Initialize the Overlapping structures and start the - // monitoring task - m_ReceiveOLap.hEvent = CreateEvent( NULL, TRUE, FALSE, NULL ); - m_TransmitOLap.hEvent = CreateEvent( NULL, TRUE, FALSE, NULL ); - m_ThreadHandle = (HANDLE)_beginthreadex( NULL, 0, CSerialTask, this, - 0, &ThreadID ); - //Sleep(1000); - Ok = TRUE; - } - } - } - // clear msg waiting - m_iNbMsgWaiting = 0; - } + m_PortHandle = CreateFile(PortName, GENERIC_WRITE | GENERIC_READ, 0, nullptr, + OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED, + nullptr); + if (IsOpen()) + { + // Setup the port according to the stored parameters + if (ProgramPort(m_Port, m_Baud, m_Parity, m_Bits, m_StopBits, m_HandShake)) + { + // Setup the timeouts + CommTimeOut.ReadIntervalTimeout = 25; + CommTimeOut.ReadTotalTimeoutMultiplier = 1; + CommTimeOut.ReadTotalTimeoutConstant = 1; + CommTimeOut.WriteTotalTimeoutMultiplier = 1; + CommTimeOut.WriteTotalTimeoutConstant = m_TXTimeout; + if (SetCommTimeouts(m_PortHandle, &CommTimeOut)) + { + // Setup the buffer sizes + if (SetupComm(m_PortHandle, 2048, 2048)) + { + // Setup the event masks for the monitoring task + if (SetCommMask(m_PortHandle, EV_RXCHAR | EV_TXEMPTY | EV_BREAK | + EV_CTS | EV_DSR | EV_ERR | EV_RLSD)) + { + // Initialize the Overlapping structures and start the + // monitoring task + m_ReceiveOLap.hEvent = CreateEvent(nullptr, TRUE, FALSE, nullptr); + m_TransmitOLap.hEvent = CreateEvent(nullptr, TRUE, FALSE, nullptr); + m_ThreadHandle = (HANDLE)_beginthreadex(nullptr, 0, CSerialTask, this, + 0, &ThreadID); + //Sleep(1000); + Ok = TRUE; + } + } + } + // clear msg waiting + m_iNbMsgWaiting = 0; + } - // Things have gone wrong so close the port - if( Ok == FALSE ) - { - TRACE(_T("CmmIO> Port OPEN issue -> CLOSED\n"),Ok); - Close( ); - } - } - TRACE(_T("CmmIO> Port OPEN = %d \n"),Ok); - // Return the state - return( IsOpen( ) ); + // Things have gone wrong so close the port + if (Ok == FALSE) + { + TRACE(_T("CmmIO> Port OPEN issue -> CLOSED\n"), Ok); + Close(); + } + } + TRACE(_T("CmmIO> Port OPEN = %d \n"), Ok); + // Return the state + return (IsOpen()); } @@ -202,9 +222,9 @@ DWORD CPSerial::Open() // IsOpen() : returns true if the serial port is open // -int CPSerial::IsOpen( ) +int CPSerial::IsOpen() { - return( m_PortHandle != INVALID_HANDLE_VALUE ); + return (m_PortHandle != INVALID_HANDLE_VALUE); } @@ -212,34 +232,34 @@ int CPSerial::IsOpen( ) // SetPort() : Store the serial settings. If the port is open then these // settings are applied now -int CPSerial::SetPort(int Port,int Baud,char Parity,int Bits,int StopBits,int HandShake) +int CPSerial::SetPort(int Port, int Baud, char Parity, int Bits, int StopBits, int HandShake) { - // Use the current settings if the value has the default of 0 - m_Port = Port; - if(Baud == 0) - Baud = m_Baud; - if(Parity == 0) - Parity = m_Parity; - if(Bits == 0) - Bits = m_Bits; - if(StopBits == 0) - StopBits = m_StopBits; - if (HandShake==0) - HandShake=m_HandShake; + // Use the current settings if the value has the default of 0 + m_Port = Port; + if (Baud == 0) + Baud = m_Baud; + if (Parity == 0) + Parity = m_Parity; + if (Bits == 0) + Bits = m_Bits; + if (StopBits == 0) + StopBits = m_StopBits; + if (HandShake == 0) + HandShake = m_HandShake; - // If the values are ok then store them - if( ProgramPort( Port, Baud, Parity, Bits, StopBits, HandShake ) ) - { - m_Port = Port; - m_Baud = Baud; - m_Parity = Parity; - m_Bits = Bits; - m_StopBits = StopBits; - m_HandShake = HandShake; - return(TRUE); - } - return(FALSE); + // If the values are ok then store them + if (ProgramPort(Port, Baud, Parity, Bits, StopBits, HandShake)) + { + m_Port = Port; + m_Baud = Baud; + m_Parity = Parity; + m_Bits = Bits; + m_StopBits = StopBits; + m_HandShake = HandShake; + return (TRUE); + } + return (FALSE); } @@ -247,30 +267,30 @@ int CPSerial::SetPort(int Port,int Baud,char Parity,int Bits,int StopBits,int Ha // GetPortData() : return the current settings // -void CPSerial::GetPortData(int *Port,int *Baud,char *Parity,int *Bits,int *StopBits,int *HandShake) +void CPSerial::GetPortData(int* Port, int* Baud, char* Parity, int* Bits, int* StopBits, int* HandShake) { - // return the requested settings - if( Port ) - *Port = m_Port; - if( m_Baud ) - *Baud = m_Baud; - if( Parity ) - *Parity = m_Parity; - if( Bits ) - *Bits = m_Bits; - if( StopBits ) - *StopBits = m_StopBits; - if( HandShake ) - *HandShake = m_HandShake; + // return the requested settings + if (Port) + *Port = m_Port; + if (m_Baud) + *Baud = m_Baud; + if (Parity) + *Parity = m_Parity; + if (Bits) + *Bits = m_Bits; + if (StopBits) + *StopBits = m_StopBits; + if (HandShake) + *HandShake = m_HandShake; } -DWORD CPSerial::SendWriteFile(const char *Buffer, DWORD Bytes) +DWORD CPSerial::SendWriteFile(const char* Buffer, DWORD Bytes) { - DWORD BytesWritten; - BOOL WriteState; - WriteState = WriteFile(m_PortHandle, &Buffer[0], Bytes, &BytesWritten, - &m_WriteOLap); - return WriteState; + DWORD BytesWritten; + BOOL WriteState; + WriteState = WriteFile(m_PortHandle, &Buffer[0], Bytes, &BytesWritten, + &m_WriteOLap); + return WriteState; } ///////////////////////////////////////////////////////////////////////////// @@ -279,51 +299,51 @@ DWORD CPSerial::SendWriteFile(const char *Buffer, DWORD Bytes) DWORD CPSerial::Close() { - //struct SerialList *Free; - HANDLE Port; + //struct SerialList *Free; + HANDLE Port; - // If the port is open then close it - if( IsOpen( ) ) - { - Port = m_PortHandle; - m_PortHandle = INVALID_HANDLE_VALUE; - CloseHandle( Port ); - if( WaitForSingleObject( m_ThreadHandle, (5 * LONG_TIMEOUT) ) != WAIT_OBJECT_0 ) - TRACE( TEXT("ERR:Serial port thread failed to terminate\n") ); - m_ThreadHandle = NULL; - CloseHandle( m_ReceiveOLap.hEvent ); - CloseHandle( m_TransmitOLap.hEvent ); - } + // If the port is open then close it + if (IsOpen()) + { + Port = m_PortHandle; + m_PortHandle = INVALID_HANDLE_VALUE; + CloseHandle(Port); + if (WaitForSingleObject(m_ThreadHandle, (5 * LONG_TIMEOUT)) != WAIT_OBJECT_0) + TRACE(TEXT("ERR:Serial port thread failed to terminate\n")); + m_ThreadHandle = nullptr; + CloseHandle(m_ReceiveOLap.hEvent); + CloseHandle(m_TransmitOLap.hEvent); + } - CMMIO::Close(); - //ZH - /* - // Delete the contents of the temp rx pointer if any - delete[] m_RXTempPtr; - m_RXTempPtr = NULL; - - // Clear down all internal lists - EnterCriticalSection( &m_QueueLock ); - while( m_RXHead ) - { - Free = m_RXHead; - m_RXHead = m_RXHead->Next; - delete[] Free->Buffer; - delete Free; - } - m_RXHead = NULL; - while( m_TXHead ) - { - Free = m_TXHead; - m_TXHead = m_TXHead->Next; - delete[] Free->Buffer; - delete Free; - } - m_TXHead = NULL; - - LeaveCriticalSection( &m_QueueLock ); - */ - return(TRUE); + CMMIO::Close(); + //ZH + /* + // Delete the contents of the temp rx pointer if any + delete[] m_RXTempPtr; + m_RXTempPtr = NULL; + + // Clear down all internal lists + EnterCriticalSection( &m_QueueLock ); + while( m_RXHead ) + { + Free = m_RXHead; + m_RXHead = m_RXHead->Next; + delete[] Free->Buffer; + delete Free; + } + m_RXHead = NULL; + while( m_TXHead ) + { + Free = m_TXHead; + m_TXHead = m_TXHead->Next; + delete[] Free->Buffer; + delete Free; + } + m_TXHead = NULL; + + LeaveCriticalSection( &m_QueueLock ); + */ + return (TRUE); } @@ -333,10 +353,10 @@ DWORD CPSerial::Close() DWORD CPSerial::Send(LPCSTR buffer, int l, BOOL /*needsResponse=FALSE*/) { - m_IsWrtingData=TRUE; - - return ( WritePort ((const char*) buffer, (DWORD) l)); + m_IsWrtingData = TRUE; + return (WritePort(buffer, static_cast(l))); } + /* DWORD CPSerial::Send(CString buffer) { @@ -360,88 +380,87 @@ return res; // WritePort() : Writes the specifed bytes to the serial port // -DWORD CPSerial::WritePort(const char *Buffer,DWORD Bytes) +DWORD CPSerial::WritePort(const char* Buffer, DWORD Bytes) { - DWORD BytesWritten, TotalWritten, Error; - BOOL WriteState; - int Retrys; + DWORD BytesWritten, TotalWritten, Error; + BOOL WriteState; + int Retrys; - TotalWritten=0; + TotalWritten = 0; - // Check that the port is open - if( IsOpen( ) ) - { - // Enter a critical section incase this is been used from multiple threads - //EnterCriticalSection(&m_WriteLock); + // Check that the port is open + if (IsOpen()) + { + // Enter a critical section incase this is been used from multiple threads + //EnterCriticalSection(&m_WriteLock); - // The following retry loop is required because a TRACE output from NT running - // in remote debug mode will kill any tranmission on any serial port !!!!!!! - // don`t you just love NT. - Retrys = 0; - do - { - Retrys++; - BytesWritten = 0; - // Write the data - WriteState = WriteFile( m_PortHandle, &Buffer[TotalWritten], - Bytes-TotalWritten, &BytesWritten, - &m_WriteOLap ); - if( !WriteState ) - { - Sleep(5); - // Ensure the write is going on in the background - if( GetLastError() == ERROR_IO_PENDING ) - { - // And wait for it to finish - WaitForSingleObject( m_WriteOLap.hEvent, LONG_TIMEOUT ); // GER - GetOverlappedResult( m_PortHandle, &m_WriteOLap, &BytesWritten, - FALSE ); - } - else - { - // Gone wrong so clear any erros - ClearCommError( m_PortHandle, &Error, NULL ); - BytesWritten= 0 ; - } - } - TotalWritten += BytesWritten; - - } - while( Retrys <= m_MaxTXRetries && TotalWritten < Bytes ); + // The following retry loop is required because a TRACE output from NT running + // in remote debug mode will kill any tranmission on any serial port !!!!!!! + // don`t you just love NT. + Retrys = 0; + do + { + Retrys++; + BytesWritten = 0; + // Write the data + WriteState = WriteFile(m_PortHandle, &Buffer[TotalWritten], + Bytes - TotalWritten, &BytesWritten, + &m_WriteOLap); + if (!WriteState) + { + Sleep(5); + // Ensure the write is going on in the background + if (GetLastError() == ERROR_IO_PENDING) + { + // And wait for it to finish + WaitForSingleObject(m_WriteOLap.hEvent, LONG_TIMEOUT); // GER + GetOverlappedResult(m_PortHandle, &m_WriteOLap, &BytesWritten, + FALSE); + } + else + { + // Gone wrong so clear any erros + ClearCommError(m_PortHandle, &Error, nullptr); + BytesWritten = 0; + } + } + TotalWritten += BytesWritten; + } + while (Retrys <= m_MaxTXRetries && TotalWritten < Bytes); - //ZH - /* - // Written some bytes so add then to the debug list - if( BytesWritten ) - AddToDebug( Buffer, BytesWritten, 2 ); - */ - // Remember to leave the critical section - //LeaveCriticalSection( &m_WriteLock ); - } + //ZH + /* + // Written some bytes so add then to the debug list + if( BytesWritten ) + AddToDebug( Buffer, BytesWritten, 2 ); + */ + // Remember to leave the critical section + //LeaveCriticalSection( &m_WriteLock ); + } - return( TotalWritten ); + return (TotalWritten); } //========================================================================== -int CPSerial::ReadBlock(BYTE *abIn, int MaxLength) +int CPSerial::ReadBlock(BYTE* abIn, int MaxLength) { BOOL JudgeRead; COMSTAT ComStat; DWORD dwErrorFlags, dwLength; ClearCommError(m_PortHandle, &dwErrorFlags, &ComStat); - if (dwErrorFlags>0) + if (dwErrorFlags > 0) { PurgeComm(m_PortHandle, PURGE_RXABORT | PURGE_RXCLEAR); return 0; } - dwLength = ((DWORD)MaxLength(MaxLength) < ComStat.cbInQue ? MaxLength : ComStat.cbInQue); memset(abIn, 0, MaxLength); //ַ if (dwLength) { - JudgeRead = ReadFile(m_PortHandle, abIn, dwLength, &dwLength, &m_ReceiveOLap);//ַabIn + JudgeRead = ReadFile(m_PortHandle, abIn, dwLength, &dwLength, &m_ReceiveOLap); //ַabIn if (!JudgeRead) { //صδ,ȴֱ @@ -463,76 +482,75 @@ int CPSerial::ReadBlock(BYTE *abIn, int MaxLength) // ReceiveTask() : Internal function, this runs as a thread and provides the // OnRecieve and OnTransmit events -void CPSerial::ReceiveTask( void ) +void CPSerial::ReceiveTask(void) { - //DWORD BytesWritten; - DWORD Events; - unsigned long State; + //DWORD BytesWritten; + DWORD Events; + unsigned long State; - do - { - Sleep(2); - BYTE abIn[MAXBLOCK]; - int len; - len = ReadBlock(abIn, MAXBLOCK); - if ((len>0) && (lenBuffer, BytesWritten, 2 ); - // OnTransmit( 0, BytesWritten ); - // SendBuffer(TRUE); - // } - // } - // */ - // if(Events & EV_BREAK) - // TRACE(_T("Break detected\n")); - // if(Events & EV_CTS) - // TRACE(_T("CTS Changed State\n")); - // if(Events & EV_DSR) - // TRACE(_T("DSR Changed State\n")); - // if(Events & EV_ERR) - // TRACE(_T("Line error\n")); - // if(Events & EV_RLSD) - // TRACE(_T("EV_RLSD error\n")); - // } - - // Go round while the port is open - } - while( IsOpen( ) ); + do + { + Sleep(2); + BYTE abIn[MAXBLOCK]; + int len; + len = ReadBlock(abIn, MAXBLOCK); + if ((len > 0) && (len < MAX_RECIEVE_BUFFER_SIZE)) + { + //memset(m_RecvData, 0, m_iRecvBytes); + memcpy(m_RecvData, abIn, len); + m_iRecvBytes = len; + m_iRecvState = TRUE; + } + // Events=0; + // + // // Wait for a comm event + // State=WaitCommEvent(m_PortHandle,&Events,&m_ReceiveOLap); + // if(!State) + // { + // // Since we are using overlapping IO we may have to wait + // // for the result + // if(GetLastError() == ERROR_IO_PENDING) + // GetOverlappedResult(m_PortHandle,&m_ReceiveOLap,&State,TRUE); + // } + ////m_iRecvState=FALSE; + // // If we have a result then OK otherwise the event was probable + // // the serial port being closed and we shall exit the loop + // if( State && IsOpen( ) ) + // { + // // Check the events and act accordingly + // if( Events & EV_RXCHAR ) + // { + // OnReceive( ); + // } + // //ZH + // /* + // if( Events & EV_TXEMPTY ) + // { + // if( m_TXHead ) + // { + // GetOverlappedResult(m_PortHandle,&m_TransmitOLap,&BytesWritten,TRUE); + // if( BytesWritten ) + // AddToDebug( m_TXHead->Buffer, BytesWritten, 2 ); + // OnTransmit( 0, BytesWritten ); + // SendBuffer(TRUE); + // } + // } + // */ + // if(Events & EV_BREAK) + // TRACE(_T("Break detected\n")); + // if(Events & EV_CTS) + // TRACE(_T("CTS Changed State\n")); + // if(Events & EV_DSR) + // TRACE(_T("DSR Changed State\n")); + // if(Events & EV_ERR) + // TRACE(_T("Line error\n")); + // if(Events & EV_RLSD) + // TRACE(_T("EV_RLSD error\n")); + // } + // Go round while the port is open + } + while (IsOpen()); } ///////////////////////////////////////////////////////////////////////////// @@ -541,44 +559,44 @@ void CPSerial::ReceiveTask( void ) void CPSerial::OnReceive() { - // Dummy OnReceieve if not used - char s[MAX_RECIEVE_BUFFER_SIZE]={0}; - s[1]='\0'; - CurrentPointer = 0; - if (m_HandShake==CS_HANDSHAKE_FOR_TRESASTR_E) - { - int num = ReadPort(s, MAX_RECIEVE_BUFFER_SIZE); - if ((num>0) && (num0) && (num 0) && (num < MAX_RECIEVE_BUFFER_SIZE)) + { + if (m_IsWrtingData) + { + memset(m_RecvData, 0,MAX_RECIEVE_BUFFER_SIZE); + m_IsWrtingData = FALSE; + m_iRecvBytes = 0; + } + TRACE1("----RECV%d----\r\n", num); + TRACE3("%02X %02X %02X ", s[0], s[1], s[2]); + TRACE3("%02X %02X %02X ", s[3], s[4], s[5]); + TRACE3("%02X %02X %02X\r\n", s[6], s[7], s[8]); + for (int i = 0; i < num; i++) + { + m_RecvData[m_iRecvBytes++] = s[i]; + } + m_iRecvState = TRUE; + } + } + else + { + int num = ReadPort(s, m_iRecvCount); + if ((num > 0) && (num < MAX_RECIEVE_BUFFER_SIZE)) + { + // memset(m_RecvData,0,m_iRecvBytes); + memcpy(m_RecvData, s, num); + m_iRecvBytes = num; + m_iRecvState = TRUE; + } + } + //LineReceive(s, num); } @@ -586,56 +604,55 @@ void CPSerial::OnReceive() // ReadPort() : Read the specifed number of bytes. // -DWORD CPSerial::ReadPort(char *Buffer,DWORD Bytes) +DWORD CPSerial::ReadPort(char* Buffer, DWORD Bytes) { - DWORD BytesRead,Error; - BOOL ReadState; + DWORD BytesRead, Error; + BOOL ReadState; - BytesRead = 0; - // Check the port is open - if( IsOpen( ) ) - { - // Enter a critical section incase this is been used from multiple threads - // EnterCriticalSection(&m_ReadLock); - // Start the read - ReadState = ReadFile(m_PortHandle,Buffer,Bytes,&BytesRead,&m_ReadOLap); - if( !ReadState ) - { - Sleep(3); - // the specifed number of bytes were not available so - // the read will continue in the background aslong as - // GetLastError() returns ERROR_IO_PENDING - if( GetLastError() == ERROR_IO_PENDING ) - { - // Wait for the read to complete - WaitForSingleObject( m_ReadOLap.hEvent, LONG_TIMEOUT ); // GER + BytesRead = 0; + // Check the port is open + if (IsOpen()) + { + // Enter a critical section incase this is been used from multiple threads + // EnterCriticalSection(&m_ReadLock); + // Start the read + ReadState = ReadFile(m_PortHandle, Buffer, Bytes, &BytesRead, &m_ReadOLap); + if (!ReadState) + { + Sleep(3); + // the specifed number of bytes were not available so + // the read will continue in the background aslong as + // GetLastError() returns ERROR_IO_PENDING + if (GetLastError() == ERROR_IO_PENDING) + { + // Wait for the read to complete + WaitForSingleObject(m_ReadOLap.hEvent, LONG_TIMEOUT); // GER - // get the result of the read - if( GetOverlappedResult( m_PortHandle, &m_ReadOLap, &BytesRead, FALSE ) == 0 ) - Error = GetLastError(); - } - else - { - // Gone wrong so clear any erros - ClearCommError( m_PortHandle, &Error, NULL ); - BytesRead = 0 ; - } + // get the result of the read + if (GetOverlappedResult(m_PortHandle, &m_ReadOLap, &BytesRead, FALSE) == 0) + Error = GetLastError(); + } + else + { + // Gone wrong so clear any erros + ClearCommError(m_PortHandle, &Error, nullptr); + BytesRead = 0; + } + } + + //ZH + /* + // Read some bytes so add then to the debug list + if( BytesRead ) + AddToDebug( Buffer, BytesRead, 1 ); + */ + // LeaveCriticalSection( &m_ReadLock ); } - //ZH - /* - // Read some bytes so add then to the debug list - if( BytesRead ) - AddToDebug( Buffer, BytesRead, 1 ); - */ - // LeaveCriticalSection( &m_ReadLock ); - } - - return(BytesRead); + return (BytesRead); } - ///////////////////////////////////////////////////////////////////////////// // ReadPort() : Read the specifed number of bytes into a CString class. // @@ -657,35 +674,35 @@ DWORD CPSerial::ReadPort(CString &Buffer,DWORD Bytes) // ProgramPort() : Internal function to setup the serial port // -int CPSerial::ProgramPort(int Port,int Baud,char Parity,int Bits,int StopBits,int HandShake) +int CPSerial::ProgramPort(int Port, int Baud, char Parity, int Bits, int StopBits, int HandShake) { - CString Param,Params; + CString Param, Params; DCB SerialDCB; int Ok; // Build up the serial port settings - Params.Format( TEXT("com%d"), Port ); - Param.Format( TEXT(" baud=%d"), Baud ); + Params.Format(TEXT("com%d"), Port); + Param.Format(TEXT(" baud=%d"), Baud); Params += Param; - Param.Format( TEXT(" parity=%c"), Parity ); + Param.Format(TEXT(" parity=%c"), Parity); Params += Param; - Param.Format( TEXT(" data=%d"), Bits ); + Param.Format(TEXT(" data=%d"), Bits); Params += Param; - Param.Format( TEXT(" stop=%d"), StopBits ); + Param.Format(TEXT(" stop=%d"), StopBits); Params += Param; Ok = FALSE; - memset( (void *)&SerialDCB, 0, sizeof(SerialDCB) ); + memset(&SerialDCB, 0, sizeof(SerialDCB)); SerialDCB.DCBlength = sizeof(SerialDCB); // Place them in the DCB structure, this also validates them if the // serial port is not open - if( BuildCommDCB( Params, &SerialDCB ) ) + if (BuildCommDCB(Params, &SerialDCB)) { // If the port is open - if( IsOpen( ) ) + if (IsOpen()) { // Set the handshake bits - switch(HandShake) + switch (HandShake) { case CS_HANDSHAKE_RTSCTS: SerialDCB.fOutxCtsFlow = TRUE; @@ -696,7 +713,7 @@ int CPSerial::ProgramPort(int Port,int Baud,char Parity,int Bits,int StopBits,in SerialDCB.fOutxCtsFlow = TRUE; SerialDCB.fRtsControl = RTS_CONTROL_HANDSHAKE; SerialDCB.fOutxDsrFlow = TRUE; - SerialDCB.fDtrControl = DTR_CONTROL_HANDSHAKE; + SerialDCB.fDtrControl = DTR_CONTROL_HANDSHAKE; break; case CS_HANDSHAKE_XONXOFF: SerialDCB.fOutX = TRUE; @@ -709,65 +726,64 @@ int CPSerial::ProgramPort(int Port,int Baud,char Parity,int Bits,int StopBits,in case CS_HANDSHAKE_NONE: SerialDCB.fRtsControl = RTS_CONTROL_ENABLE; SerialDCB.fDtrControl = DTR_CONTROL_ENABLE; - break; + break; case CS_HANDSHAKE_FOR_SO7: - SerialDCB.fDsrSensitivity=FALSE; - SerialDCB.XonChar = 17; - SerialDCB.XoffChar = 19; - SerialDCB.fOutX=FALSE; - SerialDCB.fInX=FALSE; - SerialDCB.fErrorChar=FALSE; - SerialDCB.fRtsControl=RTS_CONTROL_ENABLE; - SerialDCB.fDtrControl = DTR_CONTROL_ENABLE; - SerialDCB.fOutxCtsFlow=FALSE; - SerialDCB.fOutxDsrFlow=FALSE; - SerialDCB.XonLim=2048; - SerialDCB.XoffLim=512; - break; - case CS_HANDSHAKE_FOR_TRESASTR_E: - SerialDCB.EofChar = 26; - SerialDCB.XonChar = 17; - SerialDCB.XoffChar = 19; - SerialDCB.fOutX=TRUE; - SerialDCB.fInX=TRUE; - SerialDCB.fRtsControl=RTS_CONTROL_DISABLE; - SerialDCB.fDtrControl = DTR_CONTROL_ENABLE; - SerialDCB.fDsrSensitivity=FALSE; - SerialDCB.XonLim=256; - SerialDCB.XoffLim=256; - break; + SerialDCB.fDsrSensitivity = FALSE; + SerialDCB.XonChar = 17; + SerialDCB.XoffChar = 19; + SerialDCB.fOutX = FALSE; + SerialDCB.fInX = FALSE; + SerialDCB.fErrorChar = FALSE; + SerialDCB.fRtsControl = RTS_CONTROL_ENABLE; + SerialDCB.fDtrControl = DTR_CONTROL_ENABLE; + SerialDCB.fOutxCtsFlow = FALSE; + SerialDCB.fOutxDsrFlow = FALSE; + SerialDCB.XonLim = 2048; + SerialDCB.XoffLim = 512; + break; + case CS_HANDSHAKE_FOR_TRESASTR_E: + SerialDCB.EofChar = 26; + SerialDCB.XonChar = 17; + SerialDCB.XoffChar = 19; + SerialDCB.fOutX = TRUE; + SerialDCB.fInX = TRUE; + SerialDCB.fRtsControl = RTS_CONTROL_DISABLE; + SerialDCB.fDtrControl = DTR_CONTROL_ENABLE; + SerialDCB.fDsrSensitivity = FALSE; + SerialDCB.XonLim = 256; + SerialDCB.XoffLim = 256; + break; default: break; } // Finally apply the params to the port - if(SetCommState( m_PortHandle, &SerialDCB ) ) + if (SetCommState(m_PortHandle, &SerialDCB)) { Ok = TRUE; } else { GetCommState(m_PortHandle, &SerialDCB); - SerialDCB.BaudRate = Baud; // set the baud rate - SerialDCB.ByteSize = (BYTE)Bits; // data size, xmit, and rcv - SerialDCB.StopBits = (BYTE)StopBits; // one stop bit - switch(Parity) + SerialDCB.BaudRate = Baud; // set the baud rate + SerialDCB.ByteSize = static_cast(Bits); // data size, xmit, and rcv + SerialDCB.StopBits = static_cast(StopBits); // one stop bit + switch (Parity) { case 'O': case 'o': - SerialDCB.Parity = ODDPARITY; // odd parity bit + SerialDCB.Parity = ODDPARITY; // odd parity bit break; case 'E': case 'e': - SerialDCB.Parity = EVENPARITY; // even parity bit + SerialDCB.Parity = EVENPARITY; // even parity bit break; default: - SerialDCB.Parity = NOPARITY; // no parity bit + SerialDCB.Parity = NOPARITY; // no parity bit break; - } // Set the handshake bits - switch(HandShake) + switch (HandShake) { case CS_HANDSHAKE_RTSCTS: SerialDCB.fOutxCtsFlow = TRUE; @@ -785,39 +801,39 @@ int CPSerial::ProgramPort(int Port,int Baud,char Parity,int Bits,int StopBits,in case CS_HANDSHAKE_NONE: SerialDCB.fRtsControl = RTS_CONTROL_ENABLE; SerialDCB.fDtrControl = DTR_CONTROL_ENABLE; - break; + break; case CS_HANDSHAKE_FOR_SO7: - SerialDCB.fDsrSensitivity=FALSE; - SerialDCB.XonChar = 17; - SerialDCB.XoffChar = 19; - SerialDCB.fOutX=FALSE; - SerialDCB.fInX=FALSE; - SerialDCB.fErrorChar=FALSE; - SerialDCB.fRtsControl=RTS_CONTROL_ENABLE; - SerialDCB.fDtrControl = DTR_CONTROL_ENABLE; - SerialDCB.fOutxCtsFlow=FALSE; - SerialDCB.fOutxDsrFlow=FALSE; - SerialDCB.XonLim=2048; - SerialDCB.XoffLim=512; - break; - case CS_HANDSHAKE_FOR_TRESASTR_E: - SerialDCB.EofChar = 26; - SerialDCB.XonChar = 17; - SerialDCB.XoffChar = 19; - SerialDCB.fOutX=TRUE; - SerialDCB.fInX=TRUE; - SerialDCB.fRtsControl=RTS_CONTROL_DISABLE; - SerialDCB.fDtrControl = DTR_CONTROL_ENABLE; - SerialDCB.fDsrSensitivity=FALSE; - SerialDCB.XonLim=256; - SerialDCB.XoffLim=256; - break; + SerialDCB.fDsrSensitivity = FALSE; + SerialDCB.XonChar = 17; + SerialDCB.XoffChar = 19; + SerialDCB.fOutX = FALSE; + SerialDCB.fInX = FALSE; + SerialDCB.fErrorChar = FALSE; + SerialDCB.fRtsControl = RTS_CONTROL_ENABLE; + SerialDCB.fDtrControl = DTR_CONTROL_ENABLE; + SerialDCB.fOutxCtsFlow = FALSE; + SerialDCB.fOutxDsrFlow = FALSE; + SerialDCB.XonLim = 2048; + SerialDCB.XoffLim = 512; + break; + case CS_HANDSHAKE_FOR_TRESASTR_E: + SerialDCB.EofChar = 26; + SerialDCB.XonChar = 17; + SerialDCB.XoffChar = 19; + SerialDCB.fOutX = TRUE; + SerialDCB.fInX = TRUE; + SerialDCB.fRtsControl = RTS_CONTROL_DISABLE; + SerialDCB.fDtrControl = DTR_CONTROL_ENABLE; + SerialDCB.fDsrSensitivity = FALSE; + SerialDCB.XonLim = 256; + SerialDCB.XoffLim = 256; + break; default: break; } // Finally apply the params to the port - if(SetCommState( m_PortHandle, &SerialDCB ) ) + if (SetCommState(m_PortHandle, &SerialDCB)) { Ok = TRUE; } @@ -830,7 +846,7 @@ int CPSerial::ProgramPort(int Port,int Baud,char Parity,int Bits,int StopBits,in Ok = TRUE; } } - return(Ok); + return (Ok); } ///////////////////////////////////////////////////////////////////////////// @@ -839,7 +855,7 @@ int CPSerial::ProgramPort(int Port,int Baud,char Parity,int Bits,int StopBits,in void CPSerial::OnTransmit(int /*Item*/, DWORD /*Error*/) { - // Dummy OnTransmit if not used + // Dummy OnTransmit if not used } @@ -847,25 +863,25 @@ void CPSerial::OnTransmit(int /*Item*/, DWORD /*Error*/) // SetTimeouts() : Sets the rx and tx timeouts // -void CPSerial::SetTimeouts( int RXTimeout, int TXTimeout ) +void CPSerial::SetTimeouts(int RXTimeout, int TXTimeout) { - COMMTIMEOUTS CommTimeOut; + COMMTIMEOUTS CommTimeOut; - // Store the timeouts - m_RXTimeout = RXTimeout; - m_TXTimeout = TXTimeout; + // Store the timeouts + m_RXTimeout = RXTimeout; + m_TXTimeout = TXTimeout; - // If the port is open then configure the port also - // Currently we only use the Fixed timeouts - if( IsOpen( ) ) - { - CommTimeOut.ReadIntervalTimeout = 25; - CommTimeOut.ReadTotalTimeoutMultiplier = 1; - CommTimeOut.ReadTotalTimeoutConstant = 0; - CommTimeOut.WriteTotalTimeoutMultiplier = 0; - CommTimeOut.WriteTotalTimeoutConstant = m_TXTimeout; - SetCommTimeouts( m_PortHandle, &CommTimeOut ); - } + // If the port is open then configure the port also + // Currently we only use the Fixed timeouts + if (IsOpen()) + { + CommTimeOut.ReadIntervalTimeout = 25; + CommTimeOut.ReadTotalTimeoutMultiplier = 1; + CommTimeOut.ReadTotalTimeoutConstant = 0; + CommTimeOut.WriteTotalTimeoutMultiplier = 0; + CommTimeOut.WriteTotalTimeoutConstant = m_TXTimeout; + SetCommTimeouts(m_PortHandle, &CommTimeOut); + } } @@ -873,9 +889,9 @@ void CPSerial::SetTimeouts( int RXTimeout, int TXTimeout ) // AddToDebug() : Add the data to the debug output. State is 1 = rx 2 = tx // 3 = user -void CPSerial::AddToDebug( const char * /*Ptr*/, DWORD /*BytesToCopy*/, int /*State*/ ) +void CPSerial::AddToDebug(const char* /*Ptr*/, DWORD /*BytesToCopy*/, int /*State*/) { - //ZH + //ZH #if 0 // We are messing with pointers so use the CriticalSection EnterCriticalSection(&m_QueueLock); @@ -990,8 +1006,8 @@ return(BytesTotal); int CPSerial::MaxPort() { - // return the max port, :-) - return(8); + // return the max port, :-) + return (8); } @@ -1001,58 +1017,58 @@ int CPSerial::MaxPort() // data sent. // -int CPSerial::Transmit(const char * /*Buffer*/,DWORD /*Bytes*/) +int CPSerial::Transmit(const char* /*Buffer*/, DWORD /*Bytes*/) { - /* - struct SerialList *Ptr; - int Start; + /* + struct SerialList *Ptr; + int Start; + + // Is the port open + if( IsOpen( ) ) + { + TRACE(_T("CmmIo> Port OPEN ... transmitting %d bytes \n"),Bytes); + // Yes so CriticalSection again + EnterCriticalSection(&m_QueueLock); + // Create a new list entry structure for the block of data + Ptr = new struct SerialList; + Ptr->Buffer = new char[Bytes]; + Ptr->Bytes = Bytes; + Ptr->Next = NULL; + Ptr->Item = m_Item++; + if(Ptr->Item == 0 ) + Ptr->Item = m_Item++; + memcpy( Ptr->Buffer, Buffer, Bytes ); + + // Add it into the list + if( m_TXTail ) + { + Start = FALSE; + m_TXTail->Next = Ptr; + } + else + { + Start = TRUE; + m_TXHead = Ptr; + } + m_TXTail = Ptr; + + // If the list was empty then start sending the data, otherwise + // it will be sentout when the previous data has been sent + if(Start) + SendBuffer(FALSE); + + // All done so out of the CriticalSection + LeaveCriticalSection(&m_QueueLock); + + //return the ID for this block + return( Ptr->Item ); + } + else{ + TRACE(_T("CmmIo> Port NOT OPEN ... FAILED TO TRANSMIT %d bytes \n"),Bytes); + } + */ - // Is the port open - if( IsOpen( ) ) - { - TRACE(_T("CmmIo> Port OPEN ... transmitting %d bytes \n"),Bytes); - // Yes so CriticalSection again - EnterCriticalSection(&m_QueueLock); - // Create a new list entry structure for the block of data - Ptr = new struct SerialList; - Ptr->Buffer = new char[Bytes]; - Ptr->Bytes = Bytes; - Ptr->Next = NULL; - Ptr->Item = m_Item++; - if(Ptr->Item == 0 ) - Ptr->Item = m_Item++; - memcpy( Ptr->Buffer, Buffer, Bytes ); - - // Add it into the list - if( m_TXTail ) - { - Start = FALSE; - m_TXTail->Next = Ptr; - } - else - { - Start = TRUE; - m_TXHead = Ptr; - } - m_TXTail = Ptr; - - // If the list was empty then start sending the data, otherwise - // it will be sentout when the previous data has been sent - if(Start) - SendBuffer(FALSE); - - // All done so out of the CriticalSection - LeaveCriticalSection(&m_QueueLock); - - //return the ID for this block - return( Ptr->Item ); - } - else{ - TRACE(_T("CmmIo> Port NOT OPEN ... FAILED TO TRANSMIT %d bytes \n"),Bytes); - } - */ - - return(0); + return (0); } ///////////////////////////////////////////////////////////////////////////// @@ -1229,24 +1245,24 @@ return( m_RXTempPtr ); // ascii hex // -int CPSerial::HexToInt(char *Data, int Bytes) +int CPSerial::HexToInt(char* Data, int Bytes) { - int Byte; - int HexChar, Value; + int Byte; + int HexChar, Value; - Value = 0; - for( Byte = 0; Byte < Bytes; Byte++ ) - { - Value <<= 4; - HexChar = *Data++ -= '0'; - if( HexChar > 32 ) - HexChar -= 39; - else if( HexChar > 9 ) - HexChar -= 7; - Value += HexChar; - } + Value = 0; + for (Byte = 0; Byte < Bytes; Byte++) + { + Value <<= 4; + HexChar = *Data++ -= '0'; + if (HexChar > 32) + HexChar -= 39; + else if (HexChar > 9) + HexChar -= 7; + Value += HexChar; + } - return( Value ); + return (Value); } @@ -1275,7 +1291,6 @@ AfxRegisterClass( &wndcls ); */ - #if 0 ///////////////////////////////////////////////////////////////////////////// // SendBuffer() : Internal function, this writes the next block of data diff --git a/HSI_HexagonMI_EF3/SevenOcean/CMMIO_SERIAL.H b/HSI_HexagonMI_EF3/SevenOcean/CMMIO_SERIAL.H index 0495138..63d1eda 100644 --- a/HSI_HexagonMI_EF3/SevenOcean/CMMIO_SERIAL.H +++ b/HSI_HexagonMI_EF3/SevenOcean/CMMIO_SERIAL.H @@ -31,166 +31,166 @@ unsigned int WINAPI CSerialTask(LPVOID CSerialPtr); /////////////////////////////////////////////////////////////////////////////// // Useful serial codes -const char CS_NUL = 0; -const char CS_SOH = 1; -const char CS_STX = 2; -const char CS_ETX = 3; -const char CS_EOT = 4; -const char CS_ENQ = 5; -const char CS_ACK = 6; -const char CS_BEL = 7; -const char CS_LF = 10; -const char CS_DLE = 16; -const char CS_X_ON = 17; -const char CS_X_OFF = 19; -const char CS_NAK = 21; -const char CS_ETB = 23; -const char CS_CAN = 24; -const char CS_ESC = 27; +const char CS_NUL = 0; +const char CS_SOH = 1; +const char CS_STX = 2; +const char CS_ETX = 3; +const char CS_EOT = 4; +const char CS_ENQ = 5; +const char CS_ACK = 6; +const char CS_BEL = 7; +const char CS_LF = 10; +const char CS_DLE = 16; +const char CS_X_ON = 17; +const char CS_X_OFF = 19; +const char CS_NAK = 21; +const char CS_ETB = 23; +const char CS_CAN = 24; +const char CS_ESC = 27; /////////////////////////////////////////////////////////////////////////////// // Handshake settings -const int CS_HANDSHAKE_RTSCTS = 1; -const int CS_HANDSHAKE_XONXOFF = 2; -const int CS_HANDSHAKE_NONE = 3; -const int CS_HANDSHAKE_RTSCTS_DTRDSR = 4; -const int CS_HANDSHAKE_FOR_SO7 = 5; -const int CS_HANDSHAKE_FOR_TRESASTR_E = 6; - +const int CS_HANDSHAKE_RTSCTS = 1; +const int CS_HANDSHAKE_XONXOFF = 2; +const int CS_HANDSHAKE_NONE = 3; +const int CS_HANDSHAKE_RTSCTS_DTRDSR = 4; +const int CS_HANDSHAKE_FOR_SO7 = 5; +const int CS_HANDSHAKE_FOR_TRESASTR_E = 6; /////////////////////////////////////////////////////////////////////////////// // Debug constants -const int CS_DEBUG_SIZE = 1024; +const int CS_DEBUG_SIZE = 1024; /////////////////////////////////////////////////////////////////////////////// // Timeouts (ms) -const int CS_DEFAULT_RX_TIMEOUT = 25; -const int CS_DEFAULT_TX_TIMEOUT = 1000; +const int CS_DEFAULT_RX_TIMEOUT = 25; +const int CS_DEFAULT_TX_TIMEOUT = 1000; /////////////////////////////////////////////////////////////////////////////// // The CPSerial class class CPSerial : public CMMIO { - // Construction + // Construction public: - CPSerial(); + CPSerial(); - // Implementation + // Implementation public: - virtual ~CPSerial(); + ~CPSerial() override; - // Attributes + // Attributes public: - - // Operations + // Operations public: - // Open the serial port ( if possible ) using the parameters set by SetPort() - DWORD Open(); - // Setup the serial port prior to opening it - int SetPort( int Port, int Baud = 0, char Parity = 0, int Bits = 0, - int StopBits = 0, int HandShake = 0 ); - // Set up the port timeouts - void SetTimeouts( int RXTimeout = CS_DEFAULT_RX_TIMEOUT, - int TXTimeout = CS_DEFAULT_TX_TIMEOUT ); - // Get the serial port settings - void GetPortData( int *Port, int *Baud, char *Parity, int *Bits, - int *StopBits, int *HandShake ); - // Test if the serial port is open - bool IsValid() { - return IsOpen()!=0; - } - int IsOpen( void ); - // Close the serial port - DWORD Close( void ); - // Flush all data in any serial port buffers - int FlushPort( void ); - // Attempt to read the specified number of bytes - DWORD ReadPort( char *Buffer, DWORD Bytes ); - DWORD ReadPort( CString &Buffer, DWORD Bytes ); - // Attempt to write the specified number of bytes - DWORD WritePort( const char *Buffer, DWORD Bytes ); - DWORD SendWriteFile(const char *Buffer, DWORD Bytes); - // Send the specifed number of bytes out when possible - int Transmit( const char *Buffer, DWORD Bytes ); - // Add a block of data to the internal list of receieved blocks - int AddReceived( const char *Buffer, DWORD Bytes ); - // Get the next block of data added with AddReceived() - // char *GetNextReceived( void ); - // Find the maximum port number available - int MaxPort( void ); - // Add text to the debug output - void AddToDebug( const char *Ptr, DWORD BytesToCopy, int State ); - // Attach this serial port to a debug window - //CSerialRaw *AttachWnd( CWnd *Wnd ); - // Convert ascii hex into an int - int HexToInt( char *Data, int Bytes ); + // Open the serial port ( if possible ) using the parameters set by SetPort() + DWORD Open() override; + // Setup the serial port prior to opening it + int SetPort(int Port, int Baud = 0, char Parity = 0, int Bits = 0, + int StopBits = 0, int HandShake = 0); + // Set up the port timeouts + void SetTimeouts(int RXTimeout = CS_DEFAULT_RX_TIMEOUT, + int TXTimeout = CS_DEFAULT_TX_TIMEOUT); + // Get the serial port settings + void GetPortData(int* Port, int* Baud, char* Parity, int* Bits, + int* StopBits, int* HandShake); + // Test if the serial port is open + bool IsValid() override + { + return IsOpen() != 0; + } - virtual DWORD Send(LPCSTR buffer, int l, BOOL needsResponse=FALSE); - //virtual DWORD Send(CString what); + int IsOpen(void); + // Close the serial port + DWORD Close(void) override; + // Flush all data in any serial port buffers + int FlushPort(void); + // Attempt to read the specified number of bytes + DWORD ReadPort(char* Buffer, DWORD Bytes); + DWORD ReadPort(CString& Buffer, DWORD Bytes); + // Attempt to write the specified number of bytes + DWORD WritePort(const char* Buffer, DWORD Bytes); + DWORD SendWriteFile(const char* Buffer, DWORD Bytes); + // Send the specifed number of bytes out when possible + int Transmit(const char* Buffer, DWORD Bytes); + // Add a block of data to the internal list of receieved blocks + int AddReceived(const char* Buffer, DWORD Bytes); + // Get the next block of data added with AddReceived() + // char *GetNextReceived( void ); + // Find the maximum port number available + int MaxPort(void); + // Add text to the debug output + void AddToDebug(const char* Ptr, DWORD BytesToCopy, int State); + // Attach this serial port to a debug window + //CSerialRaw *AttachWnd( CWnd *Wnd ); + // Convert ascii hex into an int + int HexToInt(char* Data, int Bytes); - // Called when data is received on the serial port - virtual void OnReceive( void ); - // Called when data has been sent using the Transmit() function - virtual void OnTransmit( int Item, DWORD Error ); + DWORD Send(LPCSTR buffer, int l, BOOL needsResponse = FALSE) override; + //virtual DWORD Send(CString what); + + // Called when data is received on the serial port + virtual void OnReceive(void); + // Called when data has been sent using the Transmit() function + virtual void OnTransmit(int Item, DWORD Error); private: - // Private so no comment :-) - void RegisterDebugWindow(void); - void SendBuffer(int Next); - void ReceiveTask(void); - int ProgramPort(int Port,int Baud,char Parity,int Bits,int StopBits,int HandShake); - int ReadBlock(BYTE *abIn, int MaxLength); - // Attributes + // Private so no comment :-) + void RegisterDebugWindow(void); + void SendBuffer(int Next); + void ReceiveTask(void); + int ProgramPort(int Port, int Baud, char Parity, int Bits, int StopBits, int HandShake); + int ReadBlock(BYTE* abIn, int MaxLength); + // Attributes protected: - int m_RXTimeout; - int m_TXTimeout; + int m_RXTimeout; + int m_TXTimeout; - // Attributes + // Attributes private: - char m_Parity; - // char m_DebugData[CS_DEBUG_SIZE]; - // char m_DebugState[CS_DEBUG_SIZE]; - // char *m_RXTempPtr; - int m_Port; - int m_Baud; - int m_Bits; - int m_StopBits; - int m_HandShake; - int m_MaxTXRetries; - int m_DebugInPtr; - int m_DebugCount; - int m_Item; - // struct SerialList *m_TXHead; - // struct SerialList *m_TXTail; - // struct SerialList *m_RXHead; - // struct SerialList *m_RXTail; - OVERLAPPED m_ReceiveOLap; - OVERLAPPED m_TransmitOLap; - OVERLAPPED m_ReadOLap; - OVERLAPPED m_WriteOLap; - HANDLE m_PortHandle; - HANDLE m_ThreadHandle; - HANDLE m_ReceiveTaskEvent; + char m_Parity; + // char m_DebugData[CS_DEBUG_SIZE]; + // char m_DebugState[CS_DEBUG_SIZE]; + // char *m_RXTempPtr; + int m_Port; + int m_Baud; + int m_Bits; + int m_StopBits; + int m_HandShake; + int m_MaxTXRetries; + int m_DebugInPtr; + int m_DebugCount; + int m_Item; + // struct SerialList *m_TXHead; + // struct SerialList *m_TXTail; + // struct SerialList *m_RXHead; + // struct SerialList *m_RXTail; + OVERLAPPED m_ReceiveOLap; + OVERLAPPED m_TransmitOLap; + OVERLAPPED m_ReadOLap; + OVERLAPPED m_WriteOLap; + HANDLE m_PortHandle; + HANDLE m_ThreadHandle; + HANDLE m_ReceiveTaskEvent; private: - friend unsigned int WINAPI CSerialTask(LPVOID CSerialPtr); + friend unsigned int WINAPI CSerialTask(LPVOID CSerialPtr); - //Buffer for incomming commands: - int CurrentPointer; - BOOL m_IsWrtingData; + //Buffer for incomming commands: + int CurrentPointer; + BOOL m_IsWrtingData; public: - HANDLE m_hWaitCMMResponse; - HANDLE m_hNewRx; + HANDLE m_hWaitCMMResponse; + HANDLE m_hNewRx; - // BV Nov 2001: Made public - // CRITICAL_SECTION m_QueueLock; - BOOL m_iRecvState; - INT m_iRecvBytes; - INT m_iRecvCount; - unsigned char m_RecvData[MAX_RECIEVE_BUFFER_SIZE]; + // BV Nov 2001: Made public + // CRITICAL_SECTION m_QueueLock; + BOOL m_iRecvState; + INT m_iRecvBytes; + INT m_iRecvCount; + unsigned char m_RecvData[MAX_RECIEVE_BUFFER_SIZE]; }; -#endif // CMMIO_SERIAL_H \ No newline at end of file +#endif // CMMIO_SERIAL_H diff --git a/HSI_HexagonMI_EF3/WAI64bit/.vs/WAI64Bit/v15/Browse.VC.db b/HSI_HexagonMI_EF3/WAI64bit/.vs/WAI64Bit/v15/Browse.VC.db index b74a8ab..8056385 100644 Binary files a/HSI_HexagonMI_EF3/WAI64bit/.vs/WAI64Bit/v15/Browse.VC.db and b/HSI_HexagonMI_EF3/WAI64bit/.vs/WAI64Bit/v15/Browse.VC.db differ diff --git a/HSI_HexagonMI_EF3/WAI64bit/UpgradeLog.htm b/HSI_HexagonMI_EF3/WAI64bit/UpgradeLog.htm new file mode 100644 index 0000000..2828eac Binary files /dev/null and b/HSI_HexagonMI_EF3/WAI64bit/UpgradeLog.htm differ diff --git a/HSI_HexagonMI_EF3/WAI64bit/WAI64Bit.sln b/HSI_HexagonMI_EF3/WAI64bit/WAI64Bit.sln new file mode 100644 index 0000000..5b9c8c7 --- /dev/null +++ b/HSI_HexagonMI_EF3/WAI64bit/WAI64Bit.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.28307.2092 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WAI64Bit", "WAI64Bit.vcxproj", "{6936CAC7-384F-4EDC-BF1E-D549E2A37465}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {6936CAC7-384F-4EDC-BF1E-D549E2A37465}.Debug|x64.ActiveCfg = Debug|x64 + {6936CAC7-384F-4EDC-BF1E-D549E2A37465}.Debug|x64.Build.0 = Debug|x64 + {6936CAC7-384F-4EDC-BF1E-D549E2A37465}.Debug|x86.ActiveCfg = Debug|Win32 + {6936CAC7-384F-4EDC-BF1E-D549E2A37465}.Debug|x86.Build.0 = Debug|Win32 + {6936CAC7-384F-4EDC-BF1E-D549E2A37465}.Release|x64.ActiveCfg = Release|x64 + {6936CAC7-384F-4EDC-BF1E-D549E2A37465}.Release|x64.Build.0 = Release|x64 + {6936CAC7-384F-4EDC-BF1E-D549E2A37465}.Release|x86.ActiveCfg = Release|Win32 + {6936CAC7-384F-4EDC-BF1E-D549E2A37465}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {4ABC1E18-7BBA-419C-A745-5EBAF5089457} + EndGlobalSection +EndGlobal diff --git a/HSI_HexagonMI_EF3/logger.cpp b/HSI_HexagonMI_EF3/logger.cpp index a789e44..5c7957b 100644 --- a/HSI_HexagonMI_EF3/logger.cpp +++ b/HSI_HexagonMI_EF3/logger.cpp @@ -5,109 +5,113 @@ void CLogger::SendAtTime(const TCHAR* buffer) { - EnterCriticalSection(&m_lockLogger); - if (!m_File) - { - m_File = _wfsopen(m_FileName, _T("at"), _SH_DENYWR); - } - if(m_File) - { - CTime _cTime=CTime::GetCurrentTime(); - CString csTime=_cTime.Format("[%m/%d %H:%M] "); - _ftprintf(m_File,_T("%s"), csTime); - _ftprintf(m_File, _T("%s\r\n"), buffer); - } - LeaveCriticalSection(&m_lockLogger); + EnterCriticalSection(&m_lockLogger); + if (!m_File) + { + m_File = _wfsopen(m_FileName, _T("at"), _SH_DENYWR); + } + if (m_File) + { + CTime _cTime = CTime::GetCurrentTime(); + CString csTime = _cTime.Format("[%m/%d %H:%M] "); + _ftprintf(m_File,_T("%s"), csTime); + _ftprintf(m_File, _T("%s\r\n"), buffer); + } + LeaveCriticalSection(&m_lockLogger); } + void CLogger::Send(LPCTSTR format, ...) { - EnterCriticalSection(&m_lockLogger); - if (!m_File) - { - m_File = _wfsopen(m_FileName, _T("at"), _SH_DENYWR); - } - int length = 0; - va_list list; - va_start(list, format); - length = vswprintf_s(m_Str,5000, format, list); - if(m_File) - { - _ftprintf(m_File, m_Str); - } - LeaveCriticalSection(&m_lockLogger); + EnterCriticalSection(&m_lockLogger); + if (!m_File) + { + m_File = _wfsopen(m_FileName, _T("at"), _SH_DENYWR); + } + int length = 0; + va_list list; + va_start(list, format); + length = vswprintf_s(m_Str, 5000, format, list); + if (m_File) + { + _ftprintf(m_File, m_Str); + } + LeaveCriticalSection(&m_lockLogger); } + void CLogger::SendAndFlush(LPCTSTR format, ...) { - EnterCriticalSection(&m_lockLogger); - int length = 0; - va_list list; + EnterCriticalSection(&m_lockLogger); + int length = 0; + va_list list; - va_start(list, format); - length = vswprintf_s(m_Str2,5000, format, list); - Send(m_Str2); - - if(m_File) - { - fclose(m_File); - m_File = NULL; - if(m_FileName.GetLength() > 0) - m_File = _wfsopen(m_FileName, _T("at"), _SH_DENYWR); - } - LeaveCriticalSection(&m_lockLogger); + va_start(list, format); + length = vswprintf_s(m_Str2, 5000, format, list); + Send(m_Str2); + + if (m_File) + { + fclose(m_File); + m_File = nullptr; + if (m_FileName.GetLength() > 0) + m_File = _wfsopen(m_FileName, _T("at"), _SH_DENYWR); + } + LeaveCriticalSection(&m_lockLogger); } + void CLogger::SendAndFlushWithTime(LPCTSTR format, ...) { - EnterCriticalSection(&m_lockLogger); - if (!IsEnabledLog) - { - return; - } - if (!m_File) - { - m_File = _wfsopen(m_FileName, _T("at"), _SH_DENYNO); - } - if(m_File) - { - int length = 0; - va_list list; - va_start(list, format); - length = vswprintf_s(m_Str2,5000, format, list); - CTime _cTime=CTime::GetCurrentTime(); - CString csTime=_cTime.Format("[%m/%d %H:%M:%S"); - struct _timeb timebuffer; - _ftime64_s(&timebuffer); - if (m_File) - { - _ftprintf(m_File, _T("%s:%03d] "), csTime, timebuffer.millitm); - } - if (m_File) - { - _ftprintf(m_File, m_Str2); - } - if (m_File) - { - fclose(m_File); - m_File = NULL; - } - } - LeaveCriticalSection(&m_lockLogger); + EnterCriticalSection(&m_lockLogger); + if (!IsEnabledLog) + { + return; + } + if (!m_File) + { + m_File = _wfsopen(m_FileName, _T("at"), _SH_DENYNO); + } + if (m_File) + { + int length = 0; + va_list list; + va_start(list, format); + length = vswprintf_s(m_Str2, 5000, format, list); + CTime _cTime = CTime::GetCurrentTime(); + CString csTime = _cTime.Format("[%m/%d %H:%M:%S"); + struct _timeb timebuffer; + _ftime64_s(&timebuffer); + if (m_File) + { + _ftprintf(m_File, _T("%s:%03d] "), csTime, timebuffer.millitm); + } + if (m_File) + { + _ftprintf(m_File, m_Str2); + } + if (m_File) + { + fclose(m_File); + m_File = nullptr; + } + } + LeaveCriticalSection(&m_lockLogger); } + void CLogger::SendAndFlushPerMode(LPCTSTR format, ...) { - EnterCriticalSection(&m_lockLogger); - int length = 0; - va_list list; + EnterCriticalSection(&m_lockLogger); + int length = 0; + va_list list; - va_start(list, format); - length = vswprintf_s(m_Str2,5000, format, list); - Send(m_Str2); - - if((m_lLogMask & LOGFLUSH) && m_File) - { - fclose(m_File); - m_File = NULL; - if(m_FileName.GetLength() > 0) - m_File = _wfsopen(m_FileName, _T("at"), _SH_DENYWR); - } - LeaveCriticalSection(&m_lockLogger); -} \ No newline at end of file + va_start(list, format); + length = vswprintf_s(m_Str2, 5000, format, list); + Send(m_Str2); + + if ((m_lLogMask & LOGFLUSH) && m_File) + { + fclose(m_File); + m_File = nullptr; + if (m_FileName.GetLength() > 0) + m_File = _wfsopen(m_FileName, _T("at"), _SH_DENYWR); + } + LeaveCriticalSection(&m_lockLogger); +} diff --git a/HSI_HexagonMI_EF3/logger.h b/HSI_HexagonMI_EF3/logger.h index a9a456d..8663f52 100644 --- a/HSI_HexagonMI_EF3/logger.h +++ b/HSI_HexagonMI_EF3/logger.h @@ -9,54 +9,55 @@ #include #include -const long LOGINIT = 0x0001; +const long LOGINIT = 0x0001; const long LOGACTIONS = 0x0002; -const long LOGCOMM = 0x0004; -const long LOGFLUSH = 0x0008; +const long LOGCOMM = 0x0004; +const long LOGFLUSH = 0x0008; class CLogger { public: + CLogger(CString m_Name) + { + IsEnabledLog = false; + m_File = nullptr; + CString Path = _T(""); // Speed optimization - noticed slow in GlowCode + if (Path.IsEmpty()) + { + CString tmpPath; + GetModuleFileName(nullptr, tmpPath.GetBuffer(255), 255); + tmpPath.ReleaseBuffer(); + tmpPath.TrimRight(); + int nLastSlash = tmpPath.ReverseFind('\\'); + if (nLastSlash >= 0) + tmpPath = tmpPath.Left(nLastSlash); + else + tmpPath.Empty(); + Path = tmpPath; + } + m_FileName = Path + m_Name; //_T("\\SO7_SSILog.txt"); + m_lLogMask = 0; + InitializeCriticalSection(&m_lockLogger); + }; - CLogger(CString m_Name) - { - IsEnabledLog = false; - m_File = NULL; - CString Path=_T(""); // Speed optimization - noticed slow in GlowCode - if (Path.IsEmpty()) { - CString tmpPath; - GetModuleFileName(NULL,tmpPath.GetBuffer(255),255); - tmpPath.ReleaseBuffer(); - tmpPath.TrimRight(); - int nLastSlash = tmpPath.ReverseFind('\\'); - if (nLastSlash >= 0) - tmpPath = tmpPath.Left(nLastSlash); - else - tmpPath.Empty(); - Path=tmpPath; - } - m_FileName=Path + m_Name;//_T("\\SO7_SSILog.txt"); - m_lLogMask=0; - InitializeCriticalSection(&m_lockLogger); - }; - ~CLogger() - { - if (m_File) - fclose(m_File); - DeleteCriticalSection(&m_lockLogger); - }; - void SendAtTime(const TCHAR* buffer); - void Send(LPCTSTR, ...); - void SendAndFlush(LPCTSTR, ...); - void SendAndFlushPerMode(LPCTSTR, ...); - void SendAndFlushWithTime(LPCTSTR, ...); - bool IsEnabledLog/* = false*/;//是否启用日志 - CString m_FileName; - long m_lLogMask; - FILE *m_File; - _TCHAR m_Str[20000]; - _TCHAR m_Str2[20000]; - CRITICAL_SECTION m_lockLogger; + ~CLogger() + { + if (m_File) + fclose(m_File); + DeleteCriticalSection(&m_lockLogger); + }; + void SendAtTime(const TCHAR* buffer); + void Send(LPCTSTR, ...); + void SendAndFlush(LPCTSTR, ...); + void SendAndFlushPerMode(LPCTSTR, ...); + void SendAndFlushWithTime(LPCTSTR, ...); + bool IsEnabledLog/* = false*/; //是否启用日志 + CString m_FileName; + long m_lLogMask; + FILE* m_File; + _TCHAR m_Str[20000]; + _TCHAR m_Str2[20000]; + CRITICAL_SECTION m_lockLogger; }; #endif // !defined(LOGGER_H__5142BB38_5565_4124_88A4_56EA08298154__INCLUDED_) diff --git a/HSI_HexagonMI_EF3/x64/Debug/HSI_Hexa.ECCF081D.tlog/CL.command.1.tlog b/HSI_HexagonMI_EF3/obj/HSI_Hexa.ECCF081D.tlog/CL.command.1.tlog similarity index 55% rename from HSI_HexagonMI_EF3/x64/Debug/HSI_Hexa.ECCF081D.tlog/CL.command.1.tlog rename to HSI_HexagonMI_EF3/obj/HSI_Hexa.ECCF081D.tlog/CL.command.1.tlog index cd31da0..f05a9d5 100644 Binary files a/HSI_HexagonMI_EF3/x64/Debug/HSI_Hexa.ECCF081D.tlog/CL.command.1.tlog and b/HSI_HexagonMI_EF3/obj/HSI_Hexa.ECCF081D.tlog/CL.command.1.tlog differ diff --git a/HSI_HexagonMI_EF3/obj/HSI_Hexa.ECCF081D.tlog/CL.read.1.tlog b/HSI_HexagonMI_EF3/obj/HSI_Hexa.ECCF081D.tlog/CL.read.1.tlog new file mode 100644 index 0000000..99c0c8f Binary files /dev/null and b/HSI_HexagonMI_EF3/obj/HSI_Hexa.ECCF081D.tlog/CL.read.1.tlog differ diff --git a/HSI_HexagonMI_EF3/obj/HSI_Hexa.ECCF081D.tlog/CL.write.1.tlog b/HSI_HexagonMI_EF3/obj/HSI_Hexa.ECCF081D.tlog/CL.write.1.tlog new file mode 100644 index 0000000..e5b7a19 Binary files /dev/null and b/HSI_HexagonMI_EF3/obj/HSI_Hexa.ECCF081D.tlog/CL.write.1.tlog differ diff --git a/HSI_HexagonMI_EF3/obj/HSI_Hexa.ECCF081D.tlog/HSI_HexagonMI_EF3.lastbuildstate b/HSI_HexagonMI_EF3/obj/HSI_Hexa.ECCF081D.tlog/HSI_HexagonMI_EF3.lastbuildstate new file mode 100644 index 0000000..b22599b --- /dev/null +++ b/HSI_HexagonMI_EF3/obj/HSI_Hexa.ECCF081D.tlog/HSI_HexagonMI_EF3.lastbuildstate @@ -0,0 +1,2 @@ +#TargetFrameworkVersion=:PlatformToolSet=v141:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native64Bit:WindowsTargetPlatformVersion=10.0.19041.0 +Debug|x64|E:\HexagonProjects\2022-05-直线电机平台\LM-Middleware\| diff --git a/HSI_HexagonMI_EF3/obj/HSI_Hexa.ECCF081D.tlog/HSI_HexagonMI_EF3.write.1u.tlog b/HSI_HexagonMI_EF3/obj/HSI_Hexa.ECCF081D.tlog/HSI_HexagonMI_EF3.write.1u.tlog new file mode 100644 index 0000000..0d1108a Binary files /dev/null and b/HSI_HexagonMI_EF3/obj/HSI_Hexa.ECCF081D.tlog/HSI_HexagonMI_EF3.write.1u.tlog differ diff --git a/HSI_HexagonMI_EF3/obj/HSI_Hexa.ECCF081D.tlog/link.command.1.tlog b/HSI_HexagonMI_EF3/obj/HSI_Hexa.ECCF081D.tlog/link.command.1.tlog new file mode 100644 index 0000000..e7281bf Binary files /dev/null and b/HSI_HexagonMI_EF3/obj/HSI_Hexa.ECCF081D.tlog/link.command.1.tlog differ diff --git a/HSI_HexagonMI_EF3/obj/HSI_Hexa.ECCF081D.tlog/link.read.1.tlog b/HSI_HexagonMI_EF3/obj/HSI_Hexa.ECCF081D.tlog/link.read.1.tlog new file mode 100644 index 0000000..54d6b15 Binary files /dev/null and b/HSI_HexagonMI_EF3/obj/HSI_Hexa.ECCF081D.tlog/link.read.1.tlog differ diff --git a/HSI_HexagonMI_EF3/obj/HSI_Hexa.ECCF081D.tlog/link.write.1.tlog b/HSI_HexagonMI_EF3/obj/HSI_Hexa.ECCF081D.tlog/link.write.1.tlog new file mode 100644 index 0000000..32b5c55 Binary files /dev/null and b/HSI_HexagonMI_EF3/obj/HSI_Hexa.ECCF081D.tlog/link.write.1.tlog differ diff --git a/HSI_HexagonMI_EF3/obj/vc141.idb b/HSI_HexagonMI_EF3/obj/vc141.idb new file mode 100644 index 0000000..4ac666a Binary files /dev/null and b/HSI_HexagonMI_EF3/obj/vc141.idb differ diff --git a/HSI_HexagonMI_EF3/version.h b/HSI_HexagonMI_EF3/version.h index 58f4d97..3138bf7 100644 --- a/HSI_HexagonMI_EF3/version.h +++ b/HSI_HexagonMI_EF3/version.h @@ -12,5 +12,5 @@ #define HSI_VERSION_REVNUM #define HSI_VERSION_BUILD_DATE _T(__DATE__ ) #define HSI_VERSION_BUILD_TIME _T(__TIME__ ) -#define HSI_FILE_DESCRIPTION "2022.10.10 / 11:34 " -#define HSI_FILE_CSDESCRIPTION _T("2022.10.10 / 11:34 ") +#define HSI_FILE_DESCRIPTION "2022.10.12 / 9:29 " +#define HSI_FILE_CSDESCRIPTION _T("2022.10.12 / 9:29 ") diff --git a/HSI_HexagonMI_EF3/x64/Debug/HSI_Hexa.ECCF081D.tlog/HSI_HexagonMI_EF3.lastbuildstate b/HSI_HexagonMI_EF3/x64/Debug/HSI_Hexa.ECCF081D.tlog/HSI_HexagonMI_EF3.lastbuildstate deleted file mode 100644 index e9202ea..0000000 --- a/HSI_HexagonMI_EF3/x64/Debug/HSI_Hexa.ECCF081D.tlog/HSI_HexagonMI_EF3.lastbuildstate +++ /dev/null @@ -1,2 +0,0 @@ -#TargetFrameworkVersion=v4.0:PlatformToolSet=v141:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit:WindowsTargetPlatformVersion=10.0.19041.0 -Debug|x64|E:\HexagonProjects\2022-05-直线电机平台\LM-Middleware\| diff --git a/HSI_SEVENOCEAN_EF1_CsTest/HSI/HSI.cs b/HSI_SEVENOCEAN_EF1_CsTest/HSI/HSI.cs index aaa9a16..f74b6b6 100644 --- a/HSI_SEVENOCEAN_EF1_CsTest/HSI/HSI.cs +++ b/HSI_SEVENOCEAN_EF1_CsTest/HSI/HSI.cs @@ -32,7 +32,7 @@ namespace HSI_SEVENOCEAN_EF1_CsTest.HSI public static extern Def.HSI_STATUS Shutdown(); // <<<< Out Interfacess - + //¼ص public static void EventCallback(Def.HSI_EVENT_TYPE eventType, Def.HSI_EVENT_RESPONSE_TYPE responseType, uint eventId, string eventData, ref uint eventCallbackId) { diff --git a/HSI_SEVENOCEAN_EF1_CsTest/bin/Debug/Config/DMC2410_Motion.ini b/HSI_SEVENOCEAN_EF1_CsTest/bin/Debug/Config/DMC2410_Motion.ini new file mode 100644 index 0000000..8a43c8f --- /dev/null +++ b/HSI_SEVENOCEAN_EF1_CsTest/bin/Debug/Config/DMC2410_Motion.ini @@ -0,0 +1,86 @@ +[JOG_SPEED] +JOG_SPEED_0=200.0 +JOG_STARTV_0=5.0 +JOG_ACC_TIME_0=0.2 +JOG_DEC_TIME_0=0.2 +JOG_SPEED_1=150.0 +JOG_STARTV_1=5.0 +JOG_ACC_TIME_1=0.2 +JOG_DEC_TIME_1=0.2 +JOG_SPEED_2=100.0 +JOG_STARTV_2=5.0 +JOG_ACC_TIME_2=0.2 +JOG_DEC_TIME_2=0.2 +JOG_SPEED_3=10.0 +JOG_STARTV_3=5.0 +JOG_ACC_TIME_3=0.2 +JOG_DEC_TIME_3=0.2 +JOG_SPEED_4=1.0 +JOG_STARTV_4=5.0 +JOG_ACC_TIME_4=0.2 +JOG_DEC_TIME_4=0.2 +[RESOLUTION] +SCALE_RESOLUTION_1=0.0004 +SCALE_RESOLUTION_2=0.0004 +SCALE_RESOLUTION_3=0.0004 +SCALE_RESOLUTION_4=0.0004 +[LIMIT] +NEG_WORKING_LIMIT_1=-260.0 +POS_WORKING_LIMIT_1=40.0 +NEG_WORKING_LIMIT_2=-40.0 +POS_WORKING_LIMIT_2=160.0 +NEG_WORKING_LIMIT_3=-40.0 +POS_WORKING_LIMIT_3=160.0 +NEG_WORKING_LIMIT_4=-40.0 +POS_WORKING_LIMIT_4=200.0 +[HOME] +HOME_HIGH_SPEED_1=200.0 +HOME_HIGH_ACC_TIME_1=0.2 +HOME_LOW_SPEED_1=180.0 +HOME_LOW_ACC_TIME_1=0.2 +HOME_TIME_1=1000 +HOME_MACHINE_AXIS_1=1 +HOME_HIGH_SPEED_2=200.0 +HOME_HIGH_ACC_TIME_2=0.2 +HOME_LOW_SPEED_2=180.0 +HOME_LOW_ACC_TIME_2=0.2 +HOME_TIME_2=1000 +HOME_MACHINE_AXIS_2=1 +HOME_HIGH_SPEED_3=200.0 +HOME_HIGH_ACC_TIME_3=0.2 +HOME_LOW_SPEED_3=180.0 +HOME_LOW_ACC_TIME_3=0.2 +HOME_TIME_3=1000 +HOME_MACHINE_AXIS_3=1 +HOME_HIGH_SPEED_4=200.0 +HOME_HIGH_ACC_TIME_4=0.2 +HOME_LOW_SPEED_4=180.0 +HOME_LOW_ACC_TIME_4=0.2 +HOME_TIME_4=1000 +HOME_MACHINE_AXIS_4=0 +[PRECISION] +PRECISION_COUNT_1=8 +PRECISION_TIME_1=20000 +PRECISION_COUNT_2=8 +PRECISION_TIME_2=20000 +PRECISION_COUNT_3=8 +PRECISION_TIME_3=20000 +PRECISION_COUNT_4=8 +PRECISION_TIME_4=20000 +[SET_POSITION_SPEED] +SET_POTION_SPEED_1=500.0 +SET_POTION_ACC_TIME_1=0.2 +SET_POTION_DEC_TIME_1=0.2 +SET_POSITION_COUNT_1=240 +SET_POTION_SPEED_2=500.0 +SET_POTION_ACC_TIME_2=0.2 +SET_POTION_DEC_TIME_2=0.2 +SET_POSITION_COUNT_2=240 +SET_POTION_SPEED_3=500.0 +SET_POTION_ACC_TIME_3=0.2 +SET_POTION_DEC_TIME_3=0.2 +SET_POSITION_COUNT_3=240 +SET_POTION_SPEED_4=500.0 +SET_POTION_ACC_TIME_4=0.2 +SET_POTION_DEC_TIME_4=0.2 +SET_POSITION_COUNT_4=240 diff --git a/HSI_SEVENOCEAN_EF1_CsTest/bin/Debug/Config/EF1_Motion.ini b/HSI_SEVENOCEAN_EF1_CsTest/bin/Debug/Config/EF1_Motion.ini new file mode 100644 index 0000000..cab782f --- /dev/null +++ b/HSI_SEVENOCEAN_EF1_CsTest/bin/Debug/Config/EF1_Motion.ini @@ -0,0 +1,337 @@ +[JOG_SPEED] +JOGٶ(pulse/ms) +JOG_SPEED_0=200.0 +JOG_SPEED_1=150.0 +JOG_SPEED_2=50 +JOG_SPEED_3=10 +JOG_SPEED_4=1 + +;JOGٶ(pulse/ms^2) +JOG_ACC_0=2.0 +JOG_ACC_1=2.0 +JOG_ACC_2=2.0 +JOG_ACC_3=1.0 +JOG_ACC_4=1.0 + +;JOGٶ(pulse/ms^2) +JOG_DEC_0=2.0 +JOG_DEC_1=2.0 +JOG_DEC_2=2.0 +JOG_DEC_3=1.0 +JOG_DEC_4=1.0 + +;JOGģʽüͣƽֹͣ,0ƽֹͣ1ΪͣĬ0 +JOG_STOP_MODE_1=0 +JOG_STOP_MODE_2=0 +JOG_STOP_MODE_3=0 +JOG_STOP_MODE_4=0 +JOG_STOP_MODE_5=0 +JOG_STOP_MODE_6=0 +JOG_STOP_MODE_7=0 +JOG_STOP_MODE_8=0 +JOG_STOP_MODE=0 +JOG_SPEED_GEAR0_1=200.0 +JOG_ACC_GEAR0_1=2.0 +JOG_DEC_GEAR0_1=2.0 +JOG_SPEED_GEAR0_2=200.0 +JOG_ACC_GEAR0_2=2.0 +JOG_DEC_GEAR0_2=2.0 +JOG_SPEED_GEAR0_3=150.0 +JOG_ACC_GEAR0_3=2.0 +JOG_DEC_GEAR0_3=2.0 +JOG_SPEED_GEAR0_4=200.0 +JOG_ACC_GEAR0_4=2.0 +JOG_DEC_GEAR0_4=2.0 +JOG_SPEED_GEAR1_1=100.0 +JOG_ACC_GEAR1_1=2.0 +JOG_DEC_GEAR1_1=2.0 +JOG_SPEED_GEAR1_2=100.0 +JOG_ACC_GEAR1_2=2.0 +JOG_DEC_GEAR1_2=2.0 +JOG_SPEED_GEAR1_3=80.0 +JOG_ACC_GEAR1_3=2.0 +JOG_DEC_GEAR1_3=2.0 +JOG_SPEED_GEAR1_4=100.0 +JOG_ACC_GEAR1_4=2.0 +JOG_DEC_GEAR1_4=2.0 +JOG_SPEED_GEAR2_1=50.0 +JOG_ACC_GEAR2_1=2.0 +JOG_DEC_GEAR2_1=2.0 +JOG_SPEED_GEAR2_2=50.0 +JOG_ACC_GEAR2_2=2.0 +JOG_DEC_GEAR2_2=2.0 +JOG_SPEED_GEAR2_3=50.0 +JOG_ACC_GEAR2_3=2.0 +JOG_DEC_GEAR2_3=2.0 +JOG_SPEED_GEAR2_4=50.0 +JOG_ACC_GEAR2_4=2.0 +JOG_DEC_GEAR2_4=2.0 +JOG_SPEED_GEAR3_1=10.0 +JOG_ACC_GEAR3_1=1.0 +JOG_DEC_GEAR3_1=1.0 +JOG_SPEED_GEAR3_2=10.0 +JOG_ACC_GEAR3_2=1.0 +JOG_DEC_GEAR3_2=1.0 +JOG_SPEED_GEAR3_3=10.0 +JOG_ACC_GEAR3_3=1.0 +JOG_DEC_GEAR3_3=1.0 +JOG_SPEED_GEAR3_4=10.0 +JOG_ACC_GEAR3_4=1.0 +JOG_DEC_GEAR3_4=1.0 +JOG_SPEED_GEAR4_1=1.0 +JOG_ACC_GEAR4_1=1.0 +JOG_DEC_GEAR4_1=1.0 +JOG_SPEED_GEAR4_2=1.0 +JOG_ACC_GEAR4_2=1.0 +JOG_DEC_GEAR4_2=1.0 +JOG_SPEED_GEAR4_3=1.0 +JOG_ACC_GEAR4_3=1.0 +JOG_DEC_GEAR4_3=1.0 +JOG_SPEED_GEAR4_4=1.0 +JOG_ACC_GEAR4_4=1.0 +JOG_DEC_GEAR4_4=1.0 + +;0:ʹ() 1:ֻʹõƣʹÿ;Ĭ0 +[USE_LIGHT] +ONLY_USE_LIGHT=0 + +[RESOLUTION] +;դߵķֱ(mm) +SCALE_RESOLUTION_1=0.0004 +SCALE_RESOLUTION_2=0.0004 +SCALE_RESOLUTION_3=0.0004 +SCALE_RESOLUTION_4=0.0004 +SCALE_RESOLUTION_5=0.0004 +SCALE_RESOLUTION_6=0.0004 +SCALE_RESOLUTION_7=0.0004 +SCALE_RESOLUTION_8=0.0004 + +[LIMIT] +;λ(mm)Ǹ +NEG_WORKING_LIMIT_1=-260.0 +NEG_WORKING_LIMIT_2=-40.0 +NEG_WORKING_LIMIT_3=-40.0 +NEG_WORKING_LIMIT_4=-40.0 +NEG_WORKING_LIMIT_5=-40.0 +NEG_WORKING_LIMIT_6=-40.0 +NEG_WORKING_LIMIT_7=-40.0 +NEG_WORKING_LIMIT_8=-40.0 + +;λ(mm) +POS_WORKING_LIMIT_1=40.0 +POS_WORKING_LIMIT_2=160.0 +POS_WORKING_LIMIT_3=160.0 +POS_WORKING_LIMIT_4=200.0 +POS_WORKING_LIMIT_5=200.0 +POS_WORKING_LIMIT_6=200.0 +POS_WORKING_LIMIT_7=200.0 +POS_WORKING_LIMIT_8=200.0 + +[HOME] +;ѡҪؼҵţΪ1 +HOME_MACHINE_AXIS_1=1 +HOME_MACHINE_AXIS_2=1 +HOME_MACHINE_AXIS_3=1 +HOME_MACHINE_AXIS_4=0 +HOME_MACHINE_AXIS_5=0 +HOME_MACHINE_AXIS_6=0 +HOME_MACHINE_AXIS_7=0 +HOME_MACHINE_AXIS_8=0 + +;ǷʵλжǷؼңĬ01ã0ر +IS_HOME_ENC_POS=0 +;Ƿ滮λжǷؼңĬ11ã0ر +IS_HOME_PRF_POS=1 + +;رյԴʱסǰλãжǷҪؼ +HOME_POS_AXIS_1=0 +HOME_POS_AXIS_2=0 +HOME_POS_AXIS_3=0 +HOME_POS_AXIS_4=0 +HOME_POS_AXIS_5=0 +HOME_POS_AXIS_6=0 +HOME_POS_AXIS_7=0 +HOME_POS_AXIS_8=0 + +;ؼҵһٶ(pulse/ms) +HOME_HIGH_SPEED_1=200.0 +HOME_HIGH_SPEED_2=200.0 +HOME_HIGH_SPEED_3=200.0 +HOME_HIGH_SPEED_4=200.0 +HOME_HIGH_SPEED_5=200.0 +HOME_HIGH_SPEED_6=200.0 +HOME_HIGH_SPEED_7=200.0 +HOME_HIGH_SPEED_8=200.0 + +;ؼҵһμٶ(pulse/ms^2) +HOME_HIGH_ACC_1=2.0 +HOME_HIGH_ACC_2=2.0 +HOME_HIGH_ACC_3=2.0 +HOME_HIGH_ACC_4=2.0 +HOME_HIGH_ACC_5=2.0 +HOME_HIGH_ACC_6=2.0 +HOME_HIGH_ACC_7=2.0 +HOME_HIGH_ACC_8=2.0 + +;ؼҵڶٶ(pulse/ms) +HOME_LOW_SPEED_1=180.0 +HOME_LOW_SPEED_2=180.0 +HOME_LOW_SPEED_3=180.0 +HOME_LOW_SPEED_4=180.0 +HOME_LOW_SPEED_5=180.0 +HOME_LOW_SPEED_6=180.0 +HOME_LOW_SPEED_7=180.0 +HOME_LOW_SPEED_8=180.0 + +;ؼҵڶμٶ(pulse/ms^2) +HOME_LOW_ACC_1=2.0 +HOME_LOW_ACC_2=2.0 +HOME_LOW_ACC_3=2.0 +HOME_LOW_ACC_4=2.0 +HOME_LOW_ACC_5=2.0 +HOME_LOW_ACC_6=2.0 +HOME_LOW_ACC_7=2.0 +HOME_LOW_ACC_8=2.0 + +;ؼʱʱ(ms) +HOME_TIME_1=1000 +HOME_TIME_2=1000 +HOME_TIME_3=1000 +HOME_TIME_4=1000 +HOME_TIME_5=1000 +HOME_TIME_6=1000 +HOME_TIME_7=1000 +HOME_TIME_8=1000 + +[PID] +;PID,Ӧ0.01ʼ +PID_KP_1=1.20 +PID_KP_2=1.20 +PID_KP_3=1.20 +PID_KP_4=1.20 +PID_KP_5=1.20 +PID_KP_6=1.20 +PID_KP_7=1.20 +PID_KP_8=1.20 + +[PRECISION] +;ʱʱ(0.1ms) +PRECISION_TIME_1=20000 +PRECISION_TIME_2=20000 +PRECISION_TIME_3=20000 +PRECISION_TIME_4=20000 +PRECISION_TIME_5=20000 +PRECISION_TIME_6=20000 +PRECISION_TIME_7=20000 +PRECISION_TIME_8=20000 + +;ؼ +PRECISION_COUNT_1=8 +PRECISION_COUNT_2=8 +PRECISION_COUNT_3=8 +PRECISION_COUNT_4=8 +PRECISION_COUNT_5=8 +PRECISION_COUNT_6=8 +PRECISION_COUNT_7=8 +PRECISION_COUNT_8=8 + +[SET_POSITION_SPEED] +;XYZλĺϳٶ(pulse/ms) +SET_POTION_SPEED_1=500.0 +SET_POTION_SPEED_2=500.0 +SET_POTION_SPEED_3=500.0 +SET_POTION_SPEED_4=500.0 +SET_POTION_SPEED_5=500.0 +SET_POTION_SPEED_6=500.0 +SET_POTION_SPEED_7=500.0 +SET_POTION_SPEED_8=500.0 + +;XYZλĺϳɼٶ(pulse/ms^2) +SET_POTION_ACC_1=2.5 +SET_POTION_ACC_2=2.5 +SET_POTION_ACC_3=2.5 +SET_POTION_ACC_4=2.5 +SET_POTION_ACC_5=2.5 +SET_POTION_ACC_6=2.5 +SET_POTION_ACC_7=2.5 +SET_POTION_ACC_8=2.5 + +;XYZλյٶ(pulse/ms) +SET_POTION_DEC_1=1.0 +SET_POTION_DEC_2=1.0 +SET_POTION_DEC_3=1.0 +SET_POTION_DEC_4=1.0 +SET_POTION_DEC_5=1.0 +SET_POTION_DEC_6=1.0 +SET_POTION_DEC_7=1.0 +SET_POTION_DEC_8=1.0 + +;XYZλжϴ +SET_POSITION_COUNT_1=240 +SET_POSITION_COUNT_2=240 +SET_POSITION_COUNT_3=240 +SET_POSITION_COUNT_4=240 +SET_POSITION_COUNT_5=240 +SET_POSITION_COUNT_6=240 +SET_POSITION_COUNT_7=240 +SET_POSITION_COUNT_8=240 + +[COMPORT] +;ƹѡ +;0:c++õƹ,ʹSTM32 USBʱҪIS_STM32_USBΪ0 +;1:wpfֱӵ; +;2:DPԴ; +;3:ɵ68Ϊ3(οɵ); +;4:µ68Ϊ4(ɵ); +;5:STM32,IPַexeĿ¼µCameraNum.ini޸ +;61:OPTԴģʽ(111ms),IPַexeĿ¼µCameraNum.ini޸ģģʽ62(44ms); +COM_PORT_CPP_WPF=0 + +;ʹstm32ʱǷʹUSBͨѶʹøùʱCOM_PORT_CPP_WPF0 +IS_STM32_USB=0 + +;Ƿ򿪵һ1Ϊ򿪣0ΪرգĬ0 +IS_COM_PORT_A=0 +COM_PORT_A=2 +COM_PORT_A_LED_1=1 +COM_PORT_A_LED_2=1 +COM_PORT_A_LED_3=1 +COM_PORT_A_LED_4=1 + +;Ƿ򿪵ڶ1Ϊ򿪣0ΪرգĬ0 +IS_COM_PORT_B=0 +COM_PORT_B=6 +COM_PORT_B_LED_1=1 +COM_PORT_B_LED_2=1 +COM_PORT_B_LED_3=1 +COM_PORT_B_LED_4=1 + +[TRRIGER] +;Ե㴥 +LINEAR_PULSE_WIDTH=500 + +;ȼഥ +INTERVAL_PULSE_WIDTH=500 + +;ֶ +HOLD_TIME=150 + +[LOG] +;Ƿ򿪼¼Ĭ0Ϊرգ1λ,;LOG_IS_OPEN_0ΪǷ򿪼¼ +LOG_IS_OPEN_0=1 +LOG_IS_OPEN_1=1 +LOG_IS_OPEN_2=1 +LOG_IS_OPEN_3=1 +LOG_IS_OPEN_4=0 +LOG_IS_OPEN_5=0 +LOG_IS_OPEN_6=0 +LOG_IS_OPEN_7=0 +LOG_IS_OPEN_8=0 +;Ƿͳƶλʱ־1ãĬ0ر +LOG2_IS_OPEN=0 +;λκ󣬼⼸ܹʱmmĬ4 +LOG_SUM_COUNT=0 + + + + diff --git a/HSI_SEVENOCEAN_EF1_CsTest/bin/Debug/Config/EF3_Config.ini b/HSI_SEVENOCEAN_EF1_CsTest/bin/Debug/Config/EF3_Config.ini new file mode 100644 index 0000000..fca8a99 Binary files /dev/null and b/HSI_SEVENOCEAN_EF1_CsTest/bin/Debug/Config/EF3_Config.ini differ diff --git a/HSI_SEVENOCEAN_EF1_CsTest/bin/Debug/Config/EF3_Motion.ini b/HSI_SEVENOCEAN_EF1_CsTest/bin/Debug/Config/EF3_Motion.ini new file mode 100644 index 0000000..cab782f --- /dev/null +++ b/HSI_SEVENOCEAN_EF1_CsTest/bin/Debug/Config/EF3_Motion.ini @@ -0,0 +1,337 @@ +[JOG_SPEED] +JOGٶ(pulse/ms) +JOG_SPEED_0=200.0 +JOG_SPEED_1=150.0 +JOG_SPEED_2=50 +JOG_SPEED_3=10 +JOG_SPEED_4=1 + +;JOGٶ(pulse/ms^2) +JOG_ACC_0=2.0 +JOG_ACC_1=2.0 +JOG_ACC_2=2.0 +JOG_ACC_3=1.0 +JOG_ACC_4=1.0 + +;JOGٶ(pulse/ms^2) +JOG_DEC_0=2.0 +JOG_DEC_1=2.0 +JOG_DEC_2=2.0 +JOG_DEC_3=1.0 +JOG_DEC_4=1.0 + +;JOGģʽüͣƽֹͣ,0ƽֹͣ1ΪͣĬ0 +JOG_STOP_MODE_1=0 +JOG_STOP_MODE_2=0 +JOG_STOP_MODE_3=0 +JOG_STOP_MODE_4=0 +JOG_STOP_MODE_5=0 +JOG_STOP_MODE_6=0 +JOG_STOP_MODE_7=0 +JOG_STOP_MODE_8=0 +JOG_STOP_MODE=0 +JOG_SPEED_GEAR0_1=200.0 +JOG_ACC_GEAR0_1=2.0 +JOG_DEC_GEAR0_1=2.0 +JOG_SPEED_GEAR0_2=200.0 +JOG_ACC_GEAR0_2=2.0 +JOG_DEC_GEAR0_2=2.0 +JOG_SPEED_GEAR0_3=150.0 +JOG_ACC_GEAR0_3=2.0 +JOG_DEC_GEAR0_3=2.0 +JOG_SPEED_GEAR0_4=200.0 +JOG_ACC_GEAR0_4=2.0 +JOG_DEC_GEAR0_4=2.0 +JOG_SPEED_GEAR1_1=100.0 +JOG_ACC_GEAR1_1=2.0 +JOG_DEC_GEAR1_1=2.0 +JOG_SPEED_GEAR1_2=100.0 +JOG_ACC_GEAR1_2=2.0 +JOG_DEC_GEAR1_2=2.0 +JOG_SPEED_GEAR1_3=80.0 +JOG_ACC_GEAR1_3=2.0 +JOG_DEC_GEAR1_3=2.0 +JOG_SPEED_GEAR1_4=100.0 +JOG_ACC_GEAR1_4=2.0 +JOG_DEC_GEAR1_4=2.0 +JOG_SPEED_GEAR2_1=50.0 +JOG_ACC_GEAR2_1=2.0 +JOG_DEC_GEAR2_1=2.0 +JOG_SPEED_GEAR2_2=50.0 +JOG_ACC_GEAR2_2=2.0 +JOG_DEC_GEAR2_2=2.0 +JOG_SPEED_GEAR2_3=50.0 +JOG_ACC_GEAR2_3=2.0 +JOG_DEC_GEAR2_3=2.0 +JOG_SPEED_GEAR2_4=50.0 +JOG_ACC_GEAR2_4=2.0 +JOG_DEC_GEAR2_4=2.0 +JOG_SPEED_GEAR3_1=10.0 +JOG_ACC_GEAR3_1=1.0 +JOG_DEC_GEAR3_1=1.0 +JOG_SPEED_GEAR3_2=10.0 +JOG_ACC_GEAR3_2=1.0 +JOG_DEC_GEAR3_2=1.0 +JOG_SPEED_GEAR3_3=10.0 +JOG_ACC_GEAR3_3=1.0 +JOG_DEC_GEAR3_3=1.0 +JOG_SPEED_GEAR3_4=10.0 +JOG_ACC_GEAR3_4=1.0 +JOG_DEC_GEAR3_4=1.0 +JOG_SPEED_GEAR4_1=1.0 +JOG_ACC_GEAR4_1=1.0 +JOG_DEC_GEAR4_1=1.0 +JOG_SPEED_GEAR4_2=1.0 +JOG_ACC_GEAR4_2=1.0 +JOG_DEC_GEAR4_2=1.0 +JOG_SPEED_GEAR4_3=1.0 +JOG_ACC_GEAR4_3=1.0 +JOG_DEC_GEAR4_3=1.0 +JOG_SPEED_GEAR4_4=1.0 +JOG_ACC_GEAR4_4=1.0 +JOG_DEC_GEAR4_4=1.0 + +;0:ʹ() 1:ֻʹõƣʹÿ;Ĭ0 +[USE_LIGHT] +ONLY_USE_LIGHT=0 + +[RESOLUTION] +;դߵķֱ(mm) +SCALE_RESOLUTION_1=0.0004 +SCALE_RESOLUTION_2=0.0004 +SCALE_RESOLUTION_3=0.0004 +SCALE_RESOLUTION_4=0.0004 +SCALE_RESOLUTION_5=0.0004 +SCALE_RESOLUTION_6=0.0004 +SCALE_RESOLUTION_7=0.0004 +SCALE_RESOLUTION_8=0.0004 + +[LIMIT] +;λ(mm)Ǹ +NEG_WORKING_LIMIT_1=-260.0 +NEG_WORKING_LIMIT_2=-40.0 +NEG_WORKING_LIMIT_3=-40.0 +NEG_WORKING_LIMIT_4=-40.0 +NEG_WORKING_LIMIT_5=-40.0 +NEG_WORKING_LIMIT_6=-40.0 +NEG_WORKING_LIMIT_7=-40.0 +NEG_WORKING_LIMIT_8=-40.0 + +;λ(mm) +POS_WORKING_LIMIT_1=40.0 +POS_WORKING_LIMIT_2=160.0 +POS_WORKING_LIMIT_3=160.0 +POS_WORKING_LIMIT_4=200.0 +POS_WORKING_LIMIT_5=200.0 +POS_WORKING_LIMIT_6=200.0 +POS_WORKING_LIMIT_7=200.0 +POS_WORKING_LIMIT_8=200.0 + +[HOME] +;ѡҪؼҵţΪ1 +HOME_MACHINE_AXIS_1=1 +HOME_MACHINE_AXIS_2=1 +HOME_MACHINE_AXIS_3=1 +HOME_MACHINE_AXIS_4=0 +HOME_MACHINE_AXIS_5=0 +HOME_MACHINE_AXIS_6=0 +HOME_MACHINE_AXIS_7=0 +HOME_MACHINE_AXIS_8=0 + +;ǷʵλжǷؼңĬ01ã0ر +IS_HOME_ENC_POS=0 +;Ƿ滮λжǷؼңĬ11ã0ر +IS_HOME_PRF_POS=1 + +;رյԴʱסǰλãжǷҪؼ +HOME_POS_AXIS_1=0 +HOME_POS_AXIS_2=0 +HOME_POS_AXIS_3=0 +HOME_POS_AXIS_4=0 +HOME_POS_AXIS_5=0 +HOME_POS_AXIS_6=0 +HOME_POS_AXIS_7=0 +HOME_POS_AXIS_8=0 + +;ؼҵһٶ(pulse/ms) +HOME_HIGH_SPEED_1=200.0 +HOME_HIGH_SPEED_2=200.0 +HOME_HIGH_SPEED_3=200.0 +HOME_HIGH_SPEED_4=200.0 +HOME_HIGH_SPEED_5=200.0 +HOME_HIGH_SPEED_6=200.0 +HOME_HIGH_SPEED_7=200.0 +HOME_HIGH_SPEED_8=200.0 + +;ؼҵһμٶ(pulse/ms^2) +HOME_HIGH_ACC_1=2.0 +HOME_HIGH_ACC_2=2.0 +HOME_HIGH_ACC_3=2.0 +HOME_HIGH_ACC_4=2.0 +HOME_HIGH_ACC_5=2.0 +HOME_HIGH_ACC_6=2.0 +HOME_HIGH_ACC_7=2.0 +HOME_HIGH_ACC_8=2.0 + +;ؼҵڶٶ(pulse/ms) +HOME_LOW_SPEED_1=180.0 +HOME_LOW_SPEED_2=180.0 +HOME_LOW_SPEED_3=180.0 +HOME_LOW_SPEED_4=180.0 +HOME_LOW_SPEED_5=180.0 +HOME_LOW_SPEED_6=180.0 +HOME_LOW_SPEED_7=180.0 +HOME_LOW_SPEED_8=180.0 + +;ؼҵڶμٶ(pulse/ms^2) +HOME_LOW_ACC_1=2.0 +HOME_LOW_ACC_2=2.0 +HOME_LOW_ACC_3=2.0 +HOME_LOW_ACC_4=2.0 +HOME_LOW_ACC_5=2.0 +HOME_LOW_ACC_6=2.0 +HOME_LOW_ACC_7=2.0 +HOME_LOW_ACC_8=2.0 + +;ؼʱʱ(ms) +HOME_TIME_1=1000 +HOME_TIME_2=1000 +HOME_TIME_3=1000 +HOME_TIME_4=1000 +HOME_TIME_5=1000 +HOME_TIME_6=1000 +HOME_TIME_7=1000 +HOME_TIME_8=1000 + +[PID] +;PID,Ӧ0.01ʼ +PID_KP_1=1.20 +PID_KP_2=1.20 +PID_KP_3=1.20 +PID_KP_4=1.20 +PID_KP_5=1.20 +PID_KP_6=1.20 +PID_KP_7=1.20 +PID_KP_8=1.20 + +[PRECISION] +;ʱʱ(0.1ms) +PRECISION_TIME_1=20000 +PRECISION_TIME_2=20000 +PRECISION_TIME_3=20000 +PRECISION_TIME_4=20000 +PRECISION_TIME_5=20000 +PRECISION_TIME_6=20000 +PRECISION_TIME_7=20000 +PRECISION_TIME_8=20000 + +;ؼ +PRECISION_COUNT_1=8 +PRECISION_COUNT_2=8 +PRECISION_COUNT_3=8 +PRECISION_COUNT_4=8 +PRECISION_COUNT_5=8 +PRECISION_COUNT_6=8 +PRECISION_COUNT_7=8 +PRECISION_COUNT_8=8 + +[SET_POSITION_SPEED] +;XYZλĺϳٶ(pulse/ms) +SET_POTION_SPEED_1=500.0 +SET_POTION_SPEED_2=500.0 +SET_POTION_SPEED_3=500.0 +SET_POTION_SPEED_4=500.0 +SET_POTION_SPEED_5=500.0 +SET_POTION_SPEED_6=500.0 +SET_POTION_SPEED_7=500.0 +SET_POTION_SPEED_8=500.0 + +;XYZλĺϳɼٶ(pulse/ms^2) +SET_POTION_ACC_1=2.5 +SET_POTION_ACC_2=2.5 +SET_POTION_ACC_3=2.5 +SET_POTION_ACC_4=2.5 +SET_POTION_ACC_5=2.5 +SET_POTION_ACC_6=2.5 +SET_POTION_ACC_7=2.5 +SET_POTION_ACC_8=2.5 + +;XYZλյٶ(pulse/ms) +SET_POTION_DEC_1=1.0 +SET_POTION_DEC_2=1.0 +SET_POTION_DEC_3=1.0 +SET_POTION_DEC_4=1.0 +SET_POTION_DEC_5=1.0 +SET_POTION_DEC_6=1.0 +SET_POTION_DEC_7=1.0 +SET_POTION_DEC_8=1.0 + +;XYZλжϴ +SET_POSITION_COUNT_1=240 +SET_POSITION_COUNT_2=240 +SET_POSITION_COUNT_3=240 +SET_POSITION_COUNT_4=240 +SET_POSITION_COUNT_5=240 +SET_POSITION_COUNT_6=240 +SET_POSITION_COUNT_7=240 +SET_POSITION_COUNT_8=240 + +[COMPORT] +;ƹѡ +;0:c++õƹ,ʹSTM32 USBʱҪIS_STM32_USBΪ0 +;1:wpfֱӵ; +;2:DPԴ; +;3:ɵ68Ϊ3(οɵ); +;4:µ68Ϊ4(ɵ); +;5:STM32,IPַexeĿ¼µCameraNum.ini޸ +;61:OPTԴģʽ(111ms),IPַexeĿ¼µCameraNum.ini޸ģģʽ62(44ms); +COM_PORT_CPP_WPF=0 + +;ʹstm32ʱǷʹUSBͨѶʹøùʱCOM_PORT_CPP_WPF0 +IS_STM32_USB=0 + +;Ƿ򿪵һ1Ϊ򿪣0ΪرգĬ0 +IS_COM_PORT_A=0 +COM_PORT_A=2 +COM_PORT_A_LED_1=1 +COM_PORT_A_LED_2=1 +COM_PORT_A_LED_3=1 +COM_PORT_A_LED_4=1 + +;Ƿ򿪵ڶ1Ϊ򿪣0ΪرգĬ0 +IS_COM_PORT_B=0 +COM_PORT_B=6 +COM_PORT_B_LED_1=1 +COM_PORT_B_LED_2=1 +COM_PORT_B_LED_3=1 +COM_PORT_B_LED_4=1 + +[TRRIGER] +;Ե㴥 +LINEAR_PULSE_WIDTH=500 + +;ȼഥ +INTERVAL_PULSE_WIDTH=500 + +;ֶ +HOLD_TIME=150 + +[LOG] +;Ƿ򿪼¼Ĭ0Ϊرգ1λ,;LOG_IS_OPEN_0ΪǷ򿪼¼ +LOG_IS_OPEN_0=1 +LOG_IS_OPEN_1=1 +LOG_IS_OPEN_2=1 +LOG_IS_OPEN_3=1 +LOG_IS_OPEN_4=0 +LOG_IS_OPEN_5=0 +LOG_IS_OPEN_6=0 +LOG_IS_OPEN_7=0 +LOG_IS_OPEN_8=0 +;Ƿͳƶλʱ־1ãĬ0ر +LOG2_IS_OPEN=0 +;λκ󣬼⼸ܹʱmmĬ4 +LOG_SUM_COUNT=0 + + + + diff --git a/HSI_SEVENOCEAN_EF1_CsTest/bin/Debug/Config/GTS800_Config.ini b/HSI_SEVENOCEAN_EF1_CsTest/bin/Debug/Config/GTS800_Config.ini new file mode 100644 index 0000000..63cf068 --- /dev/null +++ b/HSI_SEVENOCEAN_EF1_CsTest/bin/Debug/Config/GTS800_Config.ini @@ -0,0 +1,186 @@ +[IO] +;ǷIOܣ1Ϊã0ΪرգĬ0 +IS_IO_FUNTION=1 + +;Ƿý̤عܣ1Ϊã0ΪرգĬ0 +IS_START_INPUT=0 +;е˿ںţ1ΪEXI0,2ΪEXI14ΪEXI2,8ΪEXI332768ΪEXI15Ĭ1 +START_INPUT_PORT=1 + +;Ƿüͣܣ1Ϊã0ΪرգĬ0 +IS_QUICK_STOP=0 +;ͣ˿ںţEXI15:32768EXI14:16384EXI13:8192EXI7:128Ĭ128 +QUICK_STOP_IN_PORT=128 +;ͣӦ˿ںţǹرRobotĴʹʹܣEXO15:EXO15:32768EXO14:16384EXO13:8192 Ĭ32768 +QUICK_STOP_OUT_PORT=32768 + +;Ƿðȫդܣ1Ϊã0ΪرգĬ0 +IS_SAFE_STOP=0 +;ȫդĶ˿ں +;EXI15:32768EXI14:16384EXI13:8192EXI12:4096Ĭ32768 +SAFE_STOP_PORT=32768 +;ȫդֹͣģʽ0ͣģʽ1Ĭ0ֹͣģʽ +SAFE_STOP_MODE=0 + +;Ƿⲿܣ1Ϊã0ΪرգĬ0 +IS_ALARM_OUTPUT_PORT=0 +;Ķ˿ں +;EXO15:32767EXO14:49151EXO13:57343 Ĭ32767 +ALARM_OUTPUT_PORT=32767 + +;Ƿûؼ֮ǰźŸе֣1Ϊã0ΪرգĬ0 +IS_HOME_TO_ROBOT=0 +;еֵ˿ں,ȡȨ,ʹøΪ65535 +;EXO15:32767EXO14:49151EXO13:57343EXO12:61439EXO11:63487EXO7:65407 Ĭ65407 +HOME_TO_ROBOT_FIRST_OUT_PORT=65535 +;еֵ˿ںţеҪĸλźţĬ57343ʹøΪ65535һֻ +HOME_TO_ROBOT_RESET_OUT_PORT=57343 +;еֵ˿ںţеźţĬ63487ʹøΪ65535 +HOME_TO_ROBOT_START_OUT_PORT=65535 +;еֵ˿ںţеֹͣźţĬ49151ʹøΪ65535 +HOME_TO_ROBOT_STOP_OUT_PORT=65535 +;еֹͣźŵONƽʱ䣬Ĭ500ms,ʹøΪ0 +HOME_TO_ROBOT_FIRST_TIME=0 +;еONʱ䣬Ĭ200ms,ʹøΪ0 +HOME_TO_ROBOT_START_TIME=0 +;еֹͣźŵOFFƽʱ䣬Ĭ500ms,ʹøΪ0 +HOME_TO_ROBOT_STOP_TIME=0 +;ȡеַ˿ںţ׼ؼңʹøΪ0һֻ +;EXI15:32767EXI14:49151EXI13:57343EXI12:61439EXI11:63487,Ĭ32767 +HOME_TO_ROBOT_OK_IN_PORT=57343 +;ȡеַ˿ںţҪλ,Ĭ49151ʹøΪ0 +HOME_TO_ROBOT_RESET_IN_PORT=0 + +;ǷõΪʹܣ1Ϊã0ΪرգĬ0 +IS_TRANSPORER=0 +;ʹ˿ں,ö˿ںΪ͵ƽʱʹ +;EXI15:32768EXI14:16384EXI15:32768EXI10:1024EXI9:512EXI8:256Ĭ16384 +TRANSPORER_START_PORT=16384 +;ֹͣʹ˿ں,ö˿ںΪ͵ƽʱֹͣʹ +;EXI15:32768EXI14:16384EXI15:32768EXI10:1024EXI9:512EXI8:256Ĭ32768 +TRANSPORER_STOP_PORT=32768 +;еֵ˿ں,ֹͣʹʱö˿ںΪߵƽ,EXO1516Ĭ16 +TRANSPORER_TO_ROBOOT_PORT=16 +;ʹٶJOGλͷҪı䷽ǰӸż +;ĵ1.00.8ڶ0.6һ0.4㵵0.2Ĭ3, +TRANSPORER_SPEED_GEAR=0.2 +;ʹʹõţ8ʾ4ᣬĬ8 +TRANSPORER_AXIS=8 + +;ǷõֹͣťʱضĶ˿ںţɶͬʱ1Ϊã0ΪرգĬ0 +IS_ABORT_MOTION_OUT_PORT=0 +;ضĶ˿ں,Ĭ65535(ر)ֻرEXO15:32767,ֻرEXO15EXO1416383 +ABORT_MOTION_OUT_PORT=65471 + +;ǷijһȻؼңܵλһߣһԭģ1Ϊã0ΪرգĬ0 +IS_AXIS_FIRST_HOME=0 +;õţĬ31ᣬ2:2ᣬ3:3ᣬ4:4 +AXIS_NUM_FIRST_HOME=3 + +;ǷXY岹Ĭ0رգ1 +IS_SET_POS_XY=0 + +;ǷIO˳(˲)Ĭ0رգ1,Ϊ1ʱ߳ +IS_IO_STEP=0 +;ȡλmmĬ0.0 +IO_STEP_UP_4=-62.0 +;ȡλmmĬ0.0 +IO_STEP_LEFT_DOWN_4=-103.0 +;ұȡλmmĬ0.0 +IO_STEP_RIGHT_DOWN_4=-87.5 +;λmmĬ0.0 +IO_STEP_LEFT_3=-3.8 +;ұλmmĬ0.0 +IO_STEP_RIGHT_3=-564.2 +;߿ȥȡ˿ڣ˿Ϊʱ4ȥȡ,źŹرʱȥȡϣĬ65531EXO265534EXO0 +IO_STEP_LEFT_LOAD_OUT_PORT=65531 +;ߵ4ȡϺźΪʱߵһ̨ԿԼȥ,14EXO14,Զ+1 +IO_STEP_LEFT_CONTINUE_OUT_PORT=14 +;ұ߿ȥϵ˿ڣ˿Ϊʱ4ȥϣĬ16384:EXI14,32768:EXI15 +IO_STEP_RIGHT_UPLOAD_IN_PORT=16384 +;ұߵ4Ϻ󣬶˿Ϊʱߵڶ̨ԿԼȥźţĬ15EXO1514EXO14,Զ+1 +IO_STEP_RIGHT_CONTINUE_OUT_PORT=15 +;İ̵˿ڣĬ4EXO45EXO5ڲλԶ+1(116) +IO_STEP_SUCKER_OUT_PORT=4 +;ģǷϵ˿(ϸӦ)Ĭ1EXI08EXI3 +IO_STEP_LOADING_IN_PORT=32768 + +[SAFETY_LOCK] +;Ƿ֮İȫ1ãĬ0ر +IS_SAFETY_LOCK=0 +;ʱҪסAĬ3 +SAFETY_LOCK_AXIS_A=2 +;ʱҪסBĬ3 +SAFETY_LOCK_AXIS_B=3 +;˿ںAĬ32768ΪEXI15,1ΪEXI0,2ΪEXI14ΪEXI2,8ΪEXI3 +SAFETY_LOCK_INPORT_A=32768 +;˿ںBĬ32768ΪEXI15,1ΪEXI0,2ΪEXI14ΪEXI2,8ΪEXI3 +SAFETY_LOCK_INPORT_B=32768 + +[SERIAL_PORT] +;Ƿ򿪴ڿ1ãĬ0ر +IS_SERIAL_PORT=0 +;ʹõĶ˿ںţĬ϶˿ں3 +SERIAL_PORT_NUM=5 + +[PROBE] +;Ƿ̽벶ܣ1ãĬ0ر +IS_PROBE=0 +;̽봥ʱţĬ3ʾXYZ3ᣬ4ʾXYZA4 +PROBE_ALL_AXIS=3 +;̽봥ʱʱصľmmťʱ,Ĭ10.0mm +PROBE_RETURN_POS=5.0 + +[OK_NG] +;ǷڲOK/NGжϹܣ1ãĬ0ر +IS_OK_NG=0 +;λ1˿ں,EXO0:65534EXO1:65533EXO2:65531EXO3:65527Ϊ65535Ĭ65535 +OK_NG_OUT_PORT1=65533 +;λ2˿ں,EXO0:65534EXO1:65533EXO2:65531EXO3:65527Ϊ65535Ĭ65535 +OK_NG_OUT_PORT2=65534 + +[HOME] +;ؼҾжϣĬ4 +HOME_PULSE_1=4 +HOME_PULSE_2=4 +HOME_PULSE_3=4 +HOME_PULSE_4=4 +HOME_PULSE_5=4 +HOME_PULSE_6=4 +HOME_PULSE_7=4 +HOME_PULSE_8=4 + +[JOG] +;ǷZJOGٶȶ,1ãĬ0ر +IS_JOG_AXIS_3=0 +;ZJOGٶXYļĬ1.0 +JOG_AXIS_3_GEAR=0.5 + +[SPECIAL_MOTOR] +;Ƿõ4Ჽƣõûб͹դ߷ؼҲλԭ㣬1ãĬ0ر +IS_SPECIAL_MOTOR=0 + +[DOUBLE_SWITCH] +;Ƿ2̤أ1ãĬ0ر +IS_DOUBLE_SWITCH=0 +;2صļʱmsʱ䣬ʹ2ضѰҲЧĬ500ms +DOUBLE_SWITCH_TIME=500 +;һص˿ںţ1ΪEXI0,2ΪEXI14ΪEXI2,8ΪEXI332768ΪEXI15Ĭ1 +DOUBLE_SWITCH_INPUT_PORT_A=1 +;ڶص˿ںţ1ΪEXI0,2ΪEXI14ΪEXI2,8ΪEXI332768ΪEXI15Ĭ2 +DOUBLE_SWITCH_INPUT_PORT_B=2 + +[SEND_OUTPUT] +;Ƿźźλø߶ʱӦ˿ڣ1ãĬ0ر +IS_OUTPUT_HIGH=0 +;жǷ˿ں,1ΪEXO0,2ΪEXO14ΪEXO2,8ΪEXO332768ΪEXO15Ĭ1 +OUTPUT_HIGH_ENABLE_OUT=1 +;,Ĭ11 +OUTPUT_HIGH_AXIS=1 +;λ,Ĭ0.0λmm +OUTPUT_HIGH_POS=0.0 +;ӦĶ˿ں,EXO0:0EXO1:1EXO2:2EXO3:3Ĭ0 +OUTPUT_HIGH_OUTPORT=0 + + + diff --git a/HSI_SEVENOCEAN_EF1_CsTest/bin/Debug/Config/GTS800_Motion.cfg b/HSI_SEVENOCEAN_EF1_CsTest/bin/Debug/Config/GTS800_Motion.cfg new file mode 100644 index 0000000..b7e8041 --- /dev/null +++ b/HSI_SEVENOCEAN_EF1_CsTest/bin/Debug/Config/GTS800_Motion.cfg @@ -0,0 +1,839 @@ +[profile1] +active=1 +decSmoothStop=3.000000 +decAbruptStop=1000.000000 +[profile2] +active=1 +decSmoothStop=5.000000 +decAbruptStop=1000.000000 +[profile3] +active=1 +decSmoothStop=5.000000 +decAbruptStop=1000.000000 +[profile4] +active=1 +decSmoothStop=1.000000 +decAbruptStop=1000.000000 +[profile5] +active=1 +decSmoothStop=1.000000 +decAbruptStop=1000.000000 +[profile6] +active=1 +decSmoothStop=1.000000 +decAbruptStop=1000.000000 +[profile7] +active=1 +decSmoothStop=1.000000 +decAbruptStop=1000.000000 +[profile8] +active=1 +decSmoothStop=1.000000 +decAbruptStop=1000.000000 +[axis1] +active=1 +alarmType=2 +alarmIndex=1 +limitPositiveType=0 +limitPositiveIndex=1 +limitNegativeType=1 +limitNegativeIndex=1 +smoothStopType=4 +smoothStopIndex=-1 +abruptStopType=4 +abruptStopIndex=-1 +prfMap=0x1 +encMap=0x1 +prfMapAlpha1=1 +prfMapBeta1=1 +prfMapAlpha2=1 +prfMapBeta2=1 +encMapAlpha1=1 +encMapBeta1=1 +encMapAlpha2=1 +encMapBeta2=1 +[axis2] +active=1 +alarmType=2 +alarmIndex=-1 +limitPositiveType=0 +limitPositiveIndex=2 +limitNegativeType=1 +limitNegativeIndex=2 +smoothStopType=4 +smoothStopIndex=-1 +abruptStopType=4 +abruptStopIndex=-1 +prfMap=0x2 +encMap=0x2 +prfMapAlpha1=1 +prfMapBeta1=1 +prfMapAlpha2=1 +prfMapBeta2=1 +encMapAlpha1=1 +encMapBeta1=1 +encMapAlpha2=1 +encMapBeta2=1 +[axis3] +active=1 +alarmType=2 +alarmIndex=3 +limitPositiveType=1 +limitPositiveIndex=3 +limitNegativeType=0 +limitNegativeIndex=3 +smoothStopType=4 +smoothStopIndex=-1 +abruptStopType=4 +abruptStopIndex=-1 +prfMap=0x4 +encMap=0x4 +prfMapAlpha1=1 +prfMapBeta1=1 +prfMapAlpha2=1 +prfMapBeta2=1 +encMapAlpha1=1 +encMapBeta1=1 +encMapAlpha2=1 +encMapBeta2=1 +[axis4] +active=1 +alarmType=2 +alarmIndex=-1 +limitPositiveType=0 +limitPositiveIndex=4 +limitNegativeType=1 +limitNegativeIndex=4 +smoothStopType=4 +smoothStopIndex=-1 +abruptStopType=4 +abruptStopIndex=-1 +prfMap=0x8 +encMap=0x8 +prfMapAlpha1=1 +prfMapBeta1=1 +prfMapAlpha2=1 +prfMapBeta2=1 +encMapAlpha1=1 +encMapBeta1=1 +encMapAlpha2=1 +encMapBeta2=1 +[axis5] +active=1 +alarmType=2 +alarmIndex=-1 +limitPositiveType=0 +limitPositiveIndex=5 +limitNegativeType=1 +limitNegativeIndex=5 +smoothStopType=4 +smoothStopIndex=-1 +abruptStopType=4 +abruptStopIndex=-1 +prfMap=0x10 +encMap=0x10 +prfMapAlpha1=1 +prfMapBeta1=1 +prfMapAlpha2=1 +prfMapBeta2=1 +encMapAlpha1=1 +encMapBeta1=1 +encMapAlpha2=1 +encMapBeta2=1 +[axis6] +active=1 +alarmType=2 +alarmIndex=-1 +limitPositiveType=0 +limitPositiveIndex=6 +limitNegativeType=1 +limitNegativeIndex=6 +smoothStopType=4 +smoothStopIndex=-1 +abruptStopType=4 +abruptStopIndex=-1 +prfMap=0x20 +encMap=0x20 +prfMapAlpha1=1 +prfMapBeta1=1 +prfMapAlpha2=1 +prfMapBeta2=1 +encMapAlpha1=1 +encMapBeta1=1 +encMapAlpha2=1 +encMapBeta2=1 +[axis7] +active=1 +alarmType=2 +alarmIndex=-1 +limitPositiveType=0 +limitPositiveIndex=7 +limitNegativeType=1 +limitNegativeIndex=7 +smoothStopType=4 +smoothStopIndex=-1 +abruptStopType=4 +abruptStopIndex=-1 +prfMap=0x40 +encMap=0x40 +prfMapAlpha1=1 +prfMapBeta1=1 +prfMapAlpha2=1 +prfMapBeta2=1 +encMapAlpha1=1 +encMapBeta1=1 +encMapAlpha2=1 +encMapBeta2=1 +[axis8] +active=1 +alarmType=2 +alarmIndex=-1 +limitPositiveType=0 +limitPositiveIndex=8 +limitNegativeType=1 +limitNegativeIndex=8 +smoothStopType=4 +smoothStopIndex=-1 +abruptStopType=4 +abruptStopIndex=-1 +prfMap=0x80 +encMap=0x80 +prfMapAlpha1=1 +prfMapBeta1=1 +prfMapAlpha2=1 +prfMapBeta2=1 +encMapAlpha1=1 +encMapBeta1=1 +encMapAlpha2=1 +encMapBeta2=1 +[control1] +active=0 +axis=-1 +encoder1=-1 +encoder2=-1 +errorLimit=2000 +filterType1=0 +filterType2=0 +filterType3=0 +encoderSmooth=8 +controlSmooth=8 +[control2] +active=0 +axis=-1 +encoder1=-1 +encoder2=-1 +errorLimit=32767 +filterType1=0 +filterType2=0 +filterType3=0 +encoderSmooth=8 +controlSmooth=8 +[control3] +active=0 +axis=-1 +encoder1=-1 +encoder2=-1 +errorLimit=52767 +filterType1=0 +filterType2=0 +filterType3=0 +encoderSmooth=8 +controlSmooth=8 +[control4] +active=0 +axis=-1 +encoder1=-1 +encoder2=-1 +errorLimit=32767 +filterType1=0 +filterType2=0 +filterType3=0 +encoderSmooth=8 +controlSmooth=8 +[control5] +active=0 +axis=-1 +encoder1=-1 +encoder2=-1 +errorLimit=32767 +filterType1=0 +filterType2=0 +filterType3=0 +encoderSmooth=8 +controlSmooth=8 +[control6] +active=0 +axis=-1 +encoder1=-1 +encoder2=-1 +errorLimit=32767 +filterType1=0 +filterType2=0 +filterType3=0 +encoderSmooth=8 +controlSmooth=8 +[control7] +active=0 +axis=-1 +encoder1=-1 +encoder2=-1 +errorLimit=32767 +filterType1=0 +filterType2=0 +filterType3=0 +encoderSmooth=8 +controlSmooth=8 +[control8] +active=0 +axis=-1 +encoder1=-1 +encoder2=-1 +errorLimit=32767 +filterType1=0 +filterType2=0 +filterType3=0 +encoderSmooth=8 +controlSmooth=8 +[dac1] +active=0 +control=-1 +reverse=1 +bias=0 +limit=32767 +[dac2] +active=0 +control=-1 +reverse=0 +bias=0 +limit=32767 +[dac3] +active=0 +control=-1 +reverse=1 +bias=0 +limit=32767 +[dac4] +active=0 +control=-1 +reverse=0 +bias=0 +limit=32767 +[dac5] +active=0 +control=-1 +reverse=1 +bias=0 +limit=32767 +[dac6] +active=0 +control=-1 +reverse=0 +bias=0 +limit=32767 +[dac7] +active=0 +control=-1 +reverse=1 +bias=0 +limit=32767 +[dac8] +active=0 +control=-1 +reverse=1 +bias=0 +limit=32767 +[step1] +active=1 +axis=1 +mode=0 +parameter=0 +reverse=0 +[step2] +active=1 +axis=2 +mode=0 +parameter=0 +reverse=0 +[step3] +active=1 +axis=3 +mode=0 +parameter=0 +reverse=0 +[step4] +active=1 +axis=4 +mode=0 +parameter=0 +reverse=0 +[step5] +active=1 +axis=5 +mode=0 +parameter=0 +reverse=0 +[step6] +active=1 +axis=6 +mode=0 +parameter=0 +reverse=0 +[step7] +active=1 +axis=7 +mode=0 +parameter=0 +reverse=0 +[step8] +active=1 +axis=8 +mode=0 +parameter=0 +reverse=0 +[encoder1] +active=1 +reverse=0 +filterType=0 +captureSource=0 +captureHomeSense=0 +captureIndexSense=0 +[encoder2] +active=1 +reverse=1 +filterType=0 +captureSource=0 +captureHomeSense=0 +captureIndexSense=0 +[encoder3] +active=1 +reverse=0 +filterType=0 +captureSource=0 +captureHomeSense=0 +captureIndexSense=0 +[encoder4] +active=1 +reverse=1 +filterType=0 +captureSource=0 +captureHomeSense=0 +captureIndexSense=0 +[encoder5] +active=1 +reverse=0 +filterType=0 +captureSource=0 +captureHomeSense=0 +captureIndexSense=0 +[encoder6] +active=1 +reverse=1 +filterType=0 +captureSource=0 +captureHomeSense=0 +captureIndexSense=0 +[encoder7] +active=1 +reverse=0 +filterType=0 +captureSource=0 +captureHomeSense=0 +captureIndexSense=0 +[encoder8] +active=1 +reverse=0 +filterType=0 +captureSource=0 +captureHomeSense=0 +captureIndexSense=0 +[encoder9] +active=1 +reverse=1 +filterType=0 +captureSource=0 +captureHomeSense=0 +captureIndexSense=0 +[enable1] +active=1 +axis=1 +axisItem=-1 +reverse=1 +[enable2] +active=1 +axis=2 +axisItem=-1 +reverse=1 +[enable3] +active=1 +axis=3 +axisItem=-1 +reverse=1 +[enable4] +active=1 +axis=4 +axisItem=-1 +reverse=1 +[enable5] +active=1 +axis=5 +axisItem=-1 +reverse=1 +[enable6] +active=1 +axis=6 +axisItem=-1 +reverse=1 +[enable7] +active=1 +axis=7 +axisItem=-1 +reverse=1 +[enable8] +active=1 +axis=8 +axisItem=-1 +reverse=1 +[clear1] +active=1 +axis=-1 +axisItem=-1 +reverse=0 +[clear2] +active=1 +axis=-1 +axisItem=-1 +reverse=0 +[clear3] +active=1 +axis=-1 +axisItem=-1 +reverse=0 +[clear4] +active=1 +axis=-1 +axisItem=-1 +reverse=0 +[clear5] +active=1 +axis=-1 +axisItem=-1 +reverse=0 +[clear6] +active=1 +axis=-1 +axisItem=-1 +reverse=0 +[clear7] +active=1 +axis=-1 +axisItem=-1 +reverse=0 +[clear8] +active=1 +axis=-1 +axisItem=-1 +reverse=0 +[gpo1] +active=1 +axis=-1 +axisItem=-1 +reverse=0 +[gpo2] +active=1 +axis=-1 +axisItem=-1 +reverse=0 +[gpo3] +active=1 +axis=-1 +axisItem=-1 +reverse=0 +[gpo4] +active=1 +axis=-1 +axisItem=-1 +reverse=0 +[gpo5] +active=1 +axis=-1 +axisItem=-1 +reverse=0 +[gpo6] +active=1 +axis=-1 +axisItem=-1 +reverse=0 +[gpo7] +active=1 +axis=-1 +axisItem=-1 +reverse=0 +[gpo8] +active=1 +axis=-1 +axisItem=-1 +reverse=0 +[gpo9] +active=1 +axis=-1 +axisItem=-1 +reverse=0 +[gpo10] +active=1 +axis=-1 +axisItem=-1 +reverse=0 +[gpo11] +active=1 +axis=-1 +axisItem=-1 +reverse=0 +[gpo12] +active=1 +axis=-1 +axisItem=-1 +reverse=0 +[gpo13] +active=1 +axis=-1 +axisItem=-1 +reverse=0 +[gpo14] +active=1 +axis=-1 +axisItem=-1 +reverse=0 +[gpo15] +active=1 +axis=-1 +axisItem=-1 +reverse=0 +[gpo16] +active=1 +axis=-1 +axisItem=-1 +reverse=0 +[limitPositive1] +active=1 +reverse=1 +filterTime=3 +[limitPositive2] +active=1 +reverse=1 +filterTime=3 +[limitPositive3] +active=1 +reverse=1 +filterTime=3 +[limitPositive4] +active=1 +reverse=1 +filterTime=3 +[limitPositive5] +active=1 +reverse=1 +filterTime=3 +[limitPositive6] +active=1 +reverse=1 +filterTime=3 +[limitPositive7] +active=1 +reverse=1 +filterTime=3 +[limitPositive8] +active=1 +reverse=1 +filterTime=3 +[limitNegative1] +active=1 +reverse=1 +filterTime=3 +[limitNegative2] +active=1 +reverse=1 +filterTime=3 +[limitNegative3] +active=1 +reverse=1 +filterTime=3 +[limitNegative4] +active=1 +reverse=1 +filterTime=3 +[limitNegative5] +active=1 +reverse=1 +filterTime=3 +[limitNegative6] +active=1 +reverse=1 +filterTime=3 +[limitNegative7] +active=1 +reverse=1 +filterTime=3 +[limitNegative8] +active=1 +reverse=1 +filterTime=3 +[alarm1] +active=1 +reverse=0 +filterTime=3 +[alarm2] +active=1 +reverse=0 +filterTime=3 +[alarm3] +active=1 +reverse=0 +filterTime=3 +[alarm4] +active=1 +reverse=1 +filterTime=3 +[alarm5] +active=1 +reverse=1 +filterTime=3 +[alarm6] +active=1 +reverse=1 +filterTime=3 +[alarm7] +active=1 +reverse=1 +filterTime=3 +[alarm8] +active=1 +reverse=1 +filterTime=3 +[home1] +active=1 +reverse=1 +filterTime=3 +[home2] +active=1 +reverse=1 +filterTime=3 +[home3] +active=1 +reverse=1 +filterTime=3 +[home4] +active=1 +reverse=1 +filterTime=3 +[home5] +active=1 +reverse=1 +filterTime=3 +[home6] +active=1 +reverse=1 +filterTime=3 +[home7] +active=1 +reverse=1 +filterTime=3 +[home8] +active=1 +reverse=1 +filterTime=3 +[gpi1] +active=1 +reverse=0 +filterTime=3 +[gpi2] +active=1 +reverse=0 +filterTime=3 +[gpi3] +active=1 +reverse=0 +filterTime=3 +[gpi4] +active=1 +reverse=0 +filterTime=3 +[gpi5] +active=1 +reverse=0 +filterTime=3 +[gpi6] +active=1 +reverse=0 +filterTime=3 +[gpi7] +active=1 +reverse=0 +filterTime=3 +[gpi8] +active=1 +reverse=0 +filterTime=3 +[gpi9] +active=1 +reverse=0 +filterTime=3 +[gpi10] +active=1 +reverse=0 +filterTime=3 +[gpi11] +active=1 +reverse=0 +filterTime=3 +[gpi12] +active=1 +reverse=0 +filterTime=3 +[gpi13] +active=1 +reverse=0 +filterTime=3 +[gpi14] +active=1 +reverse=0 +filterTime=3 +[gpi15] +active=1 +reverse=0 +filterTime=3 +[gpi16] +active=1 +reverse=0 +filterTime=3 +[arrive1] +active=1 +reverse=1 +filterTime=8 +[arrive2] +active=1 +reverse=1 +filterTime=8 +[arrive3] +active=1 +reverse=1 +filterTime=8 +[arrive4] +active=1 +reverse=1 +filterTime=9 +[arrive5] +active=1 +reverse=1 +filterTime=8 +[arrive6] +active=1 +reverse=0 +filterTime=3 +[arrive7] +active=1 +reverse=1 +filterTime=8 +[arrive8] +active=1 +reverse=1 +filterTime=8 diff --git a/HSI_SEVENOCEAN_EF1_CsTest/bin/Debug/Config/GTS800_Motion.ini b/HSI_SEVENOCEAN_EF1_CsTest/bin/Debug/Config/GTS800_Motion.ini new file mode 100644 index 0000000..cab782f --- /dev/null +++ b/HSI_SEVENOCEAN_EF1_CsTest/bin/Debug/Config/GTS800_Motion.ini @@ -0,0 +1,337 @@ +[JOG_SPEED] +JOGٶ(pulse/ms) +JOG_SPEED_0=200.0 +JOG_SPEED_1=150.0 +JOG_SPEED_2=50 +JOG_SPEED_3=10 +JOG_SPEED_4=1 + +;JOGٶ(pulse/ms^2) +JOG_ACC_0=2.0 +JOG_ACC_1=2.0 +JOG_ACC_2=2.0 +JOG_ACC_3=1.0 +JOG_ACC_4=1.0 + +;JOGٶ(pulse/ms^2) +JOG_DEC_0=2.0 +JOG_DEC_1=2.0 +JOG_DEC_2=2.0 +JOG_DEC_3=1.0 +JOG_DEC_4=1.0 + +;JOGģʽüͣƽֹͣ,0ƽֹͣ1ΪͣĬ0 +JOG_STOP_MODE_1=0 +JOG_STOP_MODE_2=0 +JOG_STOP_MODE_3=0 +JOG_STOP_MODE_4=0 +JOG_STOP_MODE_5=0 +JOG_STOP_MODE_6=0 +JOG_STOP_MODE_7=0 +JOG_STOP_MODE_8=0 +JOG_STOP_MODE=0 +JOG_SPEED_GEAR0_1=200.0 +JOG_ACC_GEAR0_1=2.0 +JOG_DEC_GEAR0_1=2.0 +JOG_SPEED_GEAR0_2=200.0 +JOG_ACC_GEAR0_2=2.0 +JOG_DEC_GEAR0_2=2.0 +JOG_SPEED_GEAR0_3=150.0 +JOG_ACC_GEAR0_3=2.0 +JOG_DEC_GEAR0_3=2.0 +JOG_SPEED_GEAR0_4=200.0 +JOG_ACC_GEAR0_4=2.0 +JOG_DEC_GEAR0_4=2.0 +JOG_SPEED_GEAR1_1=100.0 +JOG_ACC_GEAR1_1=2.0 +JOG_DEC_GEAR1_1=2.0 +JOG_SPEED_GEAR1_2=100.0 +JOG_ACC_GEAR1_2=2.0 +JOG_DEC_GEAR1_2=2.0 +JOG_SPEED_GEAR1_3=80.0 +JOG_ACC_GEAR1_3=2.0 +JOG_DEC_GEAR1_3=2.0 +JOG_SPEED_GEAR1_4=100.0 +JOG_ACC_GEAR1_4=2.0 +JOG_DEC_GEAR1_4=2.0 +JOG_SPEED_GEAR2_1=50.0 +JOG_ACC_GEAR2_1=2.0 +JOG_DEC_GEAR2_1=2.0 +JOG_SPEED_GEAR2_2=50.0 +JOG_ACC_GEAR2_2=2.0 +JOG_DEC_GEAR2_2=2.0 +JOG_SPEED_GEAR2_3=50.0 +JOG_ACC_GEAR2_3=2.0 +JOG_DEC_GEAR2_3=2.0 +JOG_SPEED_GEAR2_4=50.0 +JOG_ACC_GEAR2_4=2.0 +JOG_DEC_GEAR2_4=2.0 +JOG_SPEED_GEAR3_1=10.0 +JOG_ACC_GEAR3_1=1.0 +JOG_DEC_GEAR3_1=1.0 +JOG_SPEED_GEAR3_2=10.0 +JOG_ACC_GEAR3_2=1.0 +JOG_DEC_GEAR3_2=1.0 +JOG_SPEED_GEAR3_3=10.0 +JOG_ACC_GEAR3_3=1.0 +JOG_DEC_GEAR3_3=1.0 +JOG_SPEED_GEAR3_4=10.0 +JOG_ACC_GEAR3_4=1.0 +JOG_DEC_GEAR3_4=1.0 +JOG_SPEED_GEAR4_1=1.0 +JOG_ACC_GEAR4_1=1.0 +JOG_DEC_GEAR4_1=1.0 +JOG_SPEED_GEAR4_2=1.0 +JOG_ACC_GEAR4_2=1.0 +JOG_DEC_GEAR4_2=1.0 +JOG_SPEED_GEAR4_3=1.0 +JOG_ACC_GEAR4_3=1.0 +JOG_DEC_GEAR4_3=1.0 +JOG_SPEED_GEAR4_4=1.0 +JOG_ACC_GEAR4_4=1.0 +JOG_DEC_GEAR4_4=1.0 + +;0:ʹ() 1:ֻʹõƣʹÿ;Ĭ0 +[USE_LIGHT] +ONLY_USE_LIGHT=0 + +[RESOLUTION] +;դߵķֱ(mm) +SCALE_RESOLUTION_1=0.0004 +SCALE_RESOLUTION_2=0.0004 +SCALE_RESOLUTION_3=0.0004 +SCALE_RESOLUTION_4=0.0004 +SCALE_RESOLUTION_5=0.0004 +SCALE_RESOLUTION_6=0.0004 +SCALE_RESOLUTION_7=0.0004 +SCALE_RESOLUTION_8=0.0004 + +[LIMIT] +;λ(mm)Ǹ +NEG_WORKING_LIMIT_1=-260.0 +NEG_WORKING_LIMIT_2=-40.0 +NEG_WORKING_LIMIT_3=-40.0 +NEG_WORKING_LIMIT_4=-40.0 +NEG_WORKING_LIMIT_5=-40.0 +NEG_WORKING_LIMIT_6=-40.0 +NEG_WORKING_LIMIT_7=-40.0 +NEG_WORKING_LIMIT_8=-40.0 + +;λ(mm) +POS_WORKING_LIMIT_1=40.0 +POS_WORKING_LIMIT_2=160.0 +POS_WORKING_LIMIT_3=160.0 +POS_WORKING_LIMIT_4=200.0 +POS_WORKING_LIMIT_5=200.0 +POS_WORKING_LIMIT_6=200.0 +POS_WORKING_LIMIT_7=200.0 +POS_WORKING_LIMIT_8=200.0 + +[HOME] +;ѡҪؼҵţΪ1 +HOME_MACHINE_AXIS_1=1 +HOME_MACHINE_AXIS_2=1 +HOME_MACHINE_AXIS_3=1 +HOME_MACHINE_AXIS_4=0 +HOME_MACHINE_AXIS_5=0 +HOME_MACHINE_AXIS_6=0 +HOME_MACHINE_AXIS_7=0 +HOME_MACHINE_AXIS_8=0 + +;ǷʵλжǷؼңĬ01ã0ر +IS_HOME_ENC_POS=0 +;Ƿ滮λжǷؼңĬ11ã0ر +IS_HOME_PRF_POS=1 + +;رյԴʱסǰλãжǷҪؼ +HOME_POS_AXIS_1=0 +HOME_POS_AXIS_2=0 +HOME_POS_AXIS_3=0 +HOME_POS_AXIS_4=0 +HOME_POS_AXIS_5=0 +HOME_POS_AXIS_6=0 +HOME_POS_AXIS_7=0 +HOME_POS_AXIS_8=0 + +;ؼҵһٶ(pulse/ms) +HOME_HIGH_SPEED_1=200.0 +HOME_HIGH_SPEED_2=200.0 +HOME_HIGH_SPEED_3=200.0 +HOME_HIGH_SPEED_4=200.0 +HOME_HIGH_SPEED_5=200.0 +HOME_HIGH_SPEED_6=200.0 +HOME_HIGH_SPEED_7=200.0 +HOME_HIGH_SPEED_8=200.0 + +;ؼҵһμٶ(pulse/ms^2) +HOME_HIGH_ACC_1=2.0 +HOME_HIGH_ACC_2=2.0 +HOME_HIGH_ACC_3=2.0 +HOME_HIGH_ACC_4=2.0 +HOME_HIGH_ACC_5=2.0 +HOME_HIGH_ACC_6=2.0 +HOME_HIGH_ACC_7=2.0 +HOME_HIGH_ACC_8=2.0 + +;ؼҵڶٶ(pulse/ms) +HOME_LOW_SPEED_1=180.0 +HOME_LOW_SPEED_2=180.0 +HOME_LOW_SPEED_3=180.0 +HOME_LOW_SPEED_4=180.0 +HOME_LOW_SPEED_5=180.0 +HOME_LOW_SPEED_6=180.0 +HOME_LOW_SPEED_7=180.0 +HOME_LOW_SPEED_8=180.0 + +;ؼҵڶμٶ(pulse/ms^2) +HOME_LOW_ACC_1=2.0 +HOME_LOW_ACC_2=2.0 +HOME_LOW_ACC_3=2.0 +HOME_LOW_ACC_4=2.0 +HOME_LOW_ACC_5=2.0 +HOME_LOW_ACC_6=2.0 +HOME_LOW_ACC_7=2.0 +HOME_LOW_ACC_8=2.0 + +;ؼʱʱ(ms) +HOME_TIME_1=1000 +HOME_TIME_2=1000 +HOME_TIME_3=1000 +HOME_TIME_4=1000 +HOME_TIME_5=1000 +HOME_TIME_6=1000 +HOME_TIME_7=1000 +HOME_TIME_8=1000 + +[PID] +;PID,Ӧ0.01ʼ +PID_KP_1=1.20 +PID_KP_2=1.20 +PID_KP_3=1.20 +PID_KP_4=1.20 +PID_KP_5=1.20 +PID_KP_6=1.20 +PID_KP_7=1.20 +PID_KP_8=1.20 + +[PRECISION] +;ʱʱ(0.1ms) +PRECISION_TIME_1=20000 +PRECISION_TIME_2=20000 +PRECISION_TIME_3=20000 +PRECISION_TIME_4=20000 +PRECISION_TIME_5=20000 +PRECISION_TIME_6=20000 +PRECISION_TIME_7=20000 +PRECISION_TIME_8=20000 + +;ؼ +PRECISION_COUNT_1=8 +PRECISION_COUNT_2=8 +PRECISION_COUNT_3=8 +PRECISION_COUNT_4=8 +PRECISION_COUNT_5=8 +PRECISION_COUNT_6=8 +PRECISION_COUNT_7=8 +PRECISION_COUNT_8=8 + +[SET_POSITION_SPEED] +;XYZλĺϳٶ(pulse/ms) +SET_POTION_SPEED_1=500.0 +SET_POTION_SPEED_2=500.0 +SET_POTION_SPEED_3=500.0 +SET_POTION_SPEED_4=500.0 +SET_POTION_SPEED_5=500.0 +SET_POTION_SPEED_6=500.0 +SET_POTION_SPEED_7=500.0 +SET_POTION_SPEED_8=500.0 + +;XYZλĺϳɼٶ(pulse/ms^2) +SET_POTION_ACC_1=2.5 +SET_POTION_ACC_2=2.5 +SET_POTION_ACC_3=2.5 +SET_POTION_ACC_4=2.5 +SET_POTION_ACC_5=2.5 +SET_POTION_ACC_6=2.5 +SET_POTION_ACC_7=2.5 +SET_POTION_ACC_8=2.5 + +;XYZλյٶ(pulse/ms) +SET_POTION_DEC_1=1.0 +SET_POTION_DEC_2=1.0 +SET_POTION_DEC_3=1.0 +SET_POTION_DEC_4=1.0 +SET_POTION_DEC_5=1.0 +SET_POTION_DEC_6=1.0 +SET_POTION_DEC_7=1.0 +SET_POTION_DEC_8=1.0 + +;XYZλжϴ +SET_POSITION_COUNT_1=240 +SET_POSITION_COUNT_2=240 +SET_POSITION_COUNT_3=240 +SET_POSITION_COUNT_4=240 +SET_POSITION_COUNT_5=240 +SET_POSITION_COUNT_6=240 +SET_POSITION_COUNT_7=240 +SET_POSITION_COUNT_8=240 + +[COMPORT] +;ƹѡ +;0:c++õƹ,ʹSTM32 USBʱҪIS_STM32_USBΪ0 +;1:wpfֱӵ; +;2:DPԴ; +;3:ɵ68Ϊ3(οɵ); +;4:µ68Ϊ4(ɵ); +;5:STM32,IPַexeĿ¼µCameraNum.ini޸ +;61:OPTԴģʽ(111ms),IPַexeĿ¼µCameraNum.ini޸ģģʽ62(44ms); +COM_PORT_CPP_WPF=0 + +;ʹstm32ʱǷʹUSBͨѶʹøùʱCOM_PORT_CPP_WPF0 +IS_STM32_USB=0 + +;Ƿ򿪵һ1Ϊ򿪣0ΪرգĬ0 +IS_COM_PORT_A=0 +COM_PORT_A=2 +COM_PORT_A_LED_1=1 +COM_PORT_A_LED_2=1 +COM_PORT_A_LED_3=1 +COM_PORT_A_LED_4=1 + +;Ƿ򿪵ڶ1Ϊ򿪣0ΪرգĬ0 +IS_COM_PORT_B=0 +COM_PORT_B=6 +COM_PORT_B_LED_1=1 +COM_PORT_B_LED_2=1 +COM_PORT_B_LED_3=1 +COM_PORT_B_LED_4=1 + +[TRRIGER] +;Ե㴥 +LINEAR_PULSE_WIDTH=500 + +;ȼഥ +INTERVAL_PULSE_WIDTH=500 + +;ֶ +HOLD_TIME=150 + +[LOG] +;Ƿ򿪼¼Ĭ0Ϊرգ1λ,;LOG_IS_OPEN_0ΪǷ򿪼¼ +LOG_IS_OPEN_0=1 +LOG_IS_OPEN_1=1 +LOG_IS_OPEN_2=1 +LOG_IS_OPEN_3=1 +LOG_IS_OPEN_4=0 +LOG_IS_OPEN_5=0 +LOG_IS_OPEN_6=0 +LOG_IS_OPEN_7=0 +LOG_IS_OPEN_8=0 +;Ƿͳƶλʱ־1ãĬ0ر +LOG2_IS_OPEN=0 +;λκ󣬼⼸ܹʱmmĬ4 +LOG_SUM_COUNT=0 + + + + diff --git a/HSI_SEVENOCEAN_EF1_CsTest/bin/Debug/Config/MainWindowCfg.ini b/HSI_SEVENOCEAN_EF1_CsTest/bin/Debug/Config/MainWindowCfg.ini new file mode 100644 index 0000000..88ddcdd --- /dev/null +++ b/HSI_SEVENOCEAN_EF1_CsTest/bin/Debug/Config/MainWindowCfg.ini @@ -0,0 +1,3 @@ +[Default] +MotionControlSpeed=1 +ControllerType=1 diff --git a/HSI_SEVENOCEAN_EF1_CsTest/bin/Debug/Log/2022-10-11_16 b/HSI_SEVENOCEAN_EF1_CsTest/bin/Debug/Log/2022-10-11_16 new file mode 100644 index 0000000..e69de29