Page 1
AX S er i es - St an d ar d In s tr uc t io ns M a nu a l Re v is i on H is t or y...
Page 2
AX Seri es-St andard I nst ruct i ons Manual Rev i si on Hi st ory Revision History Version Revision Date 2020/10/30 The first version was published. Updated CH3: • Added supported products AX-364E & AX-324N for DFB_Capture, DFB_Compare, DFB_HCnt, DFB_HTmr, DFB_PresetValue, DFB_Sample •...
Page 3
AX Seri es-St andard I nst ruct i ons Manual Rev i si on Hi st ory Version Revision Date • Removed DFB_NO_MDBSETH_CONFIG • Updated DFB_ILLEGAL_DATA_VALUE, DFB_MEMORY_NOT_ENOUGH Updated CH9: • Added supported products AX-364E, AX-300, and AX-324N for DFB_MemoryRead, DFB_MemoryWrite Added CH10 High Speed Output Instructions Updated CH11: •...
AX Seri es-St andard I nst ruct i ons Manual TO C Preface ......................P1.1 Introduction ........................2 P1.1.1 Applicable Products ..................P1.1.2 Associated Manuals ..................2 Move Instructions ...................... 3 DFC_NIBMOV ........................4 DFC_XCH .......................... 7 Error Code and Troubleshooting .................... 9 Comparison Instructions ....................
Page 5
AX Seri es-St andard I nst ruct i ons Manual TO C DFC_LRC32 ........................100 Error Codes and Troubleshooting..................102 Module Read-write Instructions ................. 103 DFB_From........................104 DFB_To ......................... 107 DFB_DLCCAL ........................110 DFB_DLCWEI ........................114 DFB_DPUCONF ....................... 118 DFB_PUSTAT ........................122 DFB_DPUPLS ........................
Page 6
AX Seri es-St andard I nst ruct i ons Manual TO C DFB_ModbusTCPChannel ....................243 DFB_ModbusTCPRequest ....................246 Error Codes and Troubleshooting..................250 Instructions for Reading and Writing a Memory Card ............. 253 DFB_MemoryRead ......................254 DFB_MemoryWrite......................258 Error Codes and Troubleshooting..................262 High Speed Output Instructions ................
Thank you for purchasing our product. The AX series motion controller provides a high-level motion control system based on CODESYS to integrate the control function of PLCs and Motion Control. This manual introduces Delta self-developed function blocks and functions for customers to perform PLC application development.
AX Seri es-St andard I nst ruct i ons Manual Chapt er 1 1.1 DFC_NIBMOV Supported Products • AX series DFC_NIBMOV: Data shift. FB/FC Instruction Graphic Expression ST Language DFC_NIBMOV( pSrc:= , wSrcStartPos:= , DFC_NIBMOV pDst:= , wDstStartPos:= , wNum:= , ErrorID=>...
Page 11
AX Seri es-St andard I nst ruct i ons Manual Chapt er 1 Function • After executing this Function, the value of variable1 (pSrc) will be copied to variable2 (pDst), while the length of copied data is determined by wNum input. (Unit: Nibble) Example •...
Page 12
AX Seri es-St andard I nst ruct i ons Manual Chapt er 1 Program example 2: In this example, FC instruction (DFC_NIBMOV) is used for shifting the content of ar_wVar0 (pSrc) to the variable ar_wVar1 (pDst). Since wSrcStartPos=3, wNum=2 and wDstStartPos=0, two consecutive Nibbles (Length=2), which start from Nibble3 of variable ar_wVar0 (pSrc), are shifted to the address Nibble0 inside the memory of ar_wVar1 (pDst).
AX Seri es-St andard I nst ruct i ons Manual Chapt er 1 1.2 DFC_XCH Supported Products • AX series DFC_XCH: Data exchange between two variables. FB/FC Instruction Graphic Expression ST Language DFC_XCH( pSrc1:= , DFC_XCH pSrc2:= , dwNum:= , ErrorID=>...
Page 14
AX Seri es-St andard I nst ruct i ons Manual Chapt er 1 Example In this example, Function (DFC_XCH) is used for exchanging contents of two variables. Since the data length for data exchange is set to one Byte (Length=1), low-byte of variable1 and 2 will be switched after executing Function (DFC_XCH).
AX Seri es-St andard I nst ruct i ons Manual Chapt er 1 1.3 Error Code and Troubleshooting Description Reasons for error Troubleshooting DFC_NIBMOV_ERR_PARAMETER Incorrect value of wNum Check if the value of wNum is bigger than 0. DFC_XCH_ERR_PARAMETER Incorrect value of dwNum Check if the value of dwNum is bigger than 0.
AX Seri es-St andard I nst ruct i ons Manual Chapt er 2 2.1 DFC_CMP Supported Products • AX series DFC_CMP: Comparison between LINT variables. FB/FC Instruction Graphic Expression ST Language DFC_CMP( DFC_CMP liSrc1:= , liSrc2:= ) Inputs • Setting Value Name Function...
Page 18
AX Seri es-St andard I nst ruct i ons Manual Chapt er 2 Programing Example This example use FC instruction (DFC_CMP) to do comparison between two variable values. Since variable1 (liVar0) is smaller than variable2 (liVar1), the calculation result (wVar0) would be 2. Library ...
AX Seri es-St andard I nst ruct i ons Manual Chapt er 2 2.2 FC_UCMP Supported Products • AX Series DFC_UCMP: Comparison between ULINT variables. FB/FC Instruction Graphic Expression ST Language DFC_UCMP( DFC_UCMP lwSrc1:= , lwSrc2:= ) • Input Setting Value Name Function...
Page 20
AX Seri es-St andard I nst ruct i ons Manual Chapt er 2 Programming Example This example use FC instruction (DFC_UCMP) to do comparison between two variable values. Since variable1 (uiVar0) is smaller than variable2 (uiVar1), the calculation result (wVar0) would be 2. Library •...
AX Seri es-St andard I nst ruct i ons Manual Chapt er 2 2.3 DFC_LRCMP Supported Products • AX Series DFC_LRCMP: Comparison between LREAL variables. FB/FC Instruction Graphic Expression ST Language DFC_LRCMP( DFC_LRCMP lrSrc1:= , lrSrc2:= ) Input • Setting Value Name Function...
Page 22
AX Seri es-St andard I nst ruct i ons Manual Chapt er 2 Programming Example This example use FC instruction (DFC_LRCMP) to do comparison between two variable values. Since variable1 (lrVar0) is smaller than variable2 (lrVar1), the calculation result (wVar0) would be 2. Library •...
AX Seri es-St andard I nst ruct i ons Manual Chapt er 2 2.4 DFC_ZCP Supported Products • AX Series DFC_ZCP: Compares a range with a value of LINT variable. FB/FC Instruction Graphic Expression ST Language DFC_ZCP( liLowbound:= , DFC_ZCP liHighbound:= , liSrc:= );...
Page 24
AX Seri es-St andard I nst ruct i ons Manual Chapt er 2 Programming Example • This example use FC instruction (DFC_ ZCP) to compare variable values with the upper and lower value. Since the value in variable (liVar0) is larger than the upper value (H_liVar), the calculation result (wVar0) is 3. Library •...
AX Seri es-St andard I nst ruct i ons Manual Chapt er 2 2.5 DFC_UZCP Supported Products • AX Series DFC_UZCP: Compares a range with a value of ULINT variable. FB/FC Instruction Graphic Expression ST Language DFC_UZCP( lwLowbound:= , DFC_UZCP lwHighbound:= , lwSrc:= );...
Page 26
AX Seri es-St andard I nst ruct i ons Manual Chapt er 2 Programming Example • This example use FC instruction (DFC_ UZCP) to compare variable values with the upper and lower value. Since the value in variable (ulVar0) is larger than the upper value (H_ulVar), the calculation result (wVar0) is 3 Library •...
AX Seri es-St andard I nst ruct i ons Manual Chapt er 2 2.6 DFC_LRZCP Supported Products • AX Series DFC_LRZCP: Compares a range with a value of LREAL variable. FB/FC Instruction Graphic Expression ST Language DFC_LRZCP( lrLowbound:= , DFC_LRZCP lrHighbound:= , lrSrc:= );...
Page 28
AX Seri es-St andard I nst ruct i ons Manual Chapt er 2 Programming Example • This example use FC instruction (DFC_LRZCP) to compare variable values with the upper and lower value. Since the value in variable (lrVar0) is smaller than the upper value (H_lrVar) and larger than the lower value (L_lrVar), the calculation result (wVar0) is 2.
AX Seri es-St andard I nst ruct i ons Manual Chapt er 3 3.1 DFB_Capture Supported Products • AX-308E, AX-364E, AX-324N, AX-332E DFB_Capture captures the commanded pulses of the specified high-speed counter according to the designated external trigger device. FB/FC Instruction Graphic Expression...
Page 31
AX Seri e s-St and ard I n st ruct i on s Man ual Ch apt er 3 Setting Value Name Function Data Type Timing for Updating (Default value) Define whether True/False When b Eable is rising edge, bCycle capture values BOOL (False)
Page 32
AX Seri es-St andard I nst ruct i ons Manual Chapt er 3 Outputs Update Timing Name Timing for shifting to True Timing for shifting to False When the values at the outputs are valid When bEnable shifts to False. bValid after bEnable being True for one scan ...
Page 33
AX Seri es-St andard I nst ruct i ons Manual Chapt er 3 Function • bEdgeSelect This funxtion is only supported in AX-3 firmware version v1.0.5.0 and later and not supported in AX-332. uiMaskValue Please refer to the following figure for the function description of uiMaskValue input. Set uiMaskValue to 500 and bEnable to True, then Capture function is enabled.
Page 34
AX Seri es-St andard I nst ruct i ons Manual Chapt er 3 bEdgeSelect EdgeSelect defines whether the DI signal is the rising edge triggered or the falling-edge triggered to capture the signal. This function is only applicable to AX-332E models. When EdgeSelect=False, the capture is triggered when DI generates the rising edge signal, and when EdgeSelect=True, the capture is triggered when DI generates the fallingr edge signal.
Page 35
AX Seri es-St andard I nst ruct i ons Manual Chapt er 3 bCycle The Cycle setting determines whether the Capture function block will capture values continuously. This function is only applicable to the AX-332El. When Cycle=False, the Capture function block can only capture the value once triggered by DI. When Cycle=True, the Capture function block can capture multiple values for multiple times.
Page 36
AX Seri es-St andard I nst ruct i ons Manual Chapt er 3 Enable the FB DFB_Capture (bEnable=True) after using the FB DFB_HCnt to activate the high-speed counter (bEnable=True) in the POU, then the present counter value would be captured and shown on the diCapValue output of DFB_Capture after the external signal (IN15) being triggered.
Page 37
AX Seri es-St andard I nst ruct i ons Manual Chapt er 3 Enable the FB DFB_Capture (bEnable=True) after using the FB DFB_HCnt to activate the high-speed counter (bEnable=True) in the POU, then the present counter value would be captured and shown on the diCapValue output of DFB_Capture after the external signal (IN0) being triggered.
AX Seri es-St andard I nst ruct i ons Manual Chapt er 3 3.2 DFB_Compare Supported Products AX-308E, AX-364E, AX-324N, AX-332E DFB_Compare compares the designated source value and the setting value and then to Set or Reset the desired device when the comparison result is True or False.
Page 39
AX Seri es-St andard I nst ruct i ons Manual Chapt er 3 Setting Value Name Function Data Type Timing for Updating (Default value) Specify the compare When bEnable is rising diTablePosition ARRAY OF DINT value array edge and bBusy is False. Specify the compare When bEnable is rising diTableSize...
Page 40
AX Seri es-St andard I nst ruct i ons Manual Chapt er 3 Timing Diagram • bEnable bValid bBusy bError In/ Outs • Setting Value Name Function Data Type Timing for Updating (Default value) Reference to the DFB_COMPARE_REF When bEnable shifts to True Compare source of high- DFB_COMPARE_REF (FB)*...
Page 41
AX Seri es-St andard I nst ruct i ons Manual Chapt er 3 If comparing multiple value at the same time, the following two situations will affect the ouput of Do. Case1: In the process of Do output, other value of diTablezpodtion is compared, the value will not generate Do output. The output will be the Do output of the current value.
Page 42
AX Seri es-St andard I nst ruct i ons Manual Chapt er 3 OutputAction is an output variable that define the action of the output device once the comparison condition is met. When it is set to SET, the ouput device will be set to high level. When it is set to RESET, the output device will be set to low level. Only support AX-332E version 1.0.4.2 or later.
Page 43
AX Seri es-St andard I nst ruct i ons Manual Chapt er 3 shown in follows. At the same time, the output device (OUT3) will output the signal once the comparison condition is fulfilled (DFB_HCnt_0.diCounterValue = DFB_Compare_0.diCmpValue). Please refer to AX-3 series operational manual for more details related to the settings and operation of Hardware IO Configuration.
Page 44
AX Seri es-St andard I nst ruct i ons Manual Chapt er 3 Execute the function block DFB_Compare after enable the high-speed counter by using DFB_HCnt in the POU as shown in follows. At the same time, the output device (OUT1) will output the signal once the comparison condition is fulfilled (DFB_HCnt_0.diCounterValue = DFB_Compare_0.diCmpValue).
AX Seri es-St andard I nst ruct i ons Manual Chapt er 3 3.3 DFB_HCnt Supported Products AX-308E, AX-364E, AX-324N, AX-332E DFB_HCnt enables the specified high speed counter according to the specified parameters and monitors the counter value. FB/FC Instruction Graphic Expression...
Page 46
AX Seri es-St andard I nst ruct i ons Manual Chapt er 3 Output • Output Range Name Function Data Type (Default value) True when the output value bValid BOOL True/False(False) is valid. True when the instruction is bBusy BOOL True/False(False) enabled.
Page 47
AX Seri es-St andard I nst ruct i ons Manual Chapt er 3 In/ Outs • Setting Value Name Function Data Type Timing for Updating (Default value) Reference to the DFB_COUNTER_REF source of specified When bEnable shifts to True Counter DFB_COUNTER_REF (FB)* high-speed and Busy is False.
Page 48
AX Seri es-St andard I nst ruct i ons Manual Chapt er 3 bTriggerMode=True xUD_Select=False bTriggerMode=False xUD_Select=True bTriggerMode=True xUD_Select=True Only supports AX-332Eversion 1.0.4.2 or later.
Page 49
AX Seri es-St andard I nst ruct i ons Manual Chapt er 3 Troubleshooting • If an error occurs during the execution of the instruction, bError will change to True and the Capture will stop. You can refer to ErrorID (Error Code) to address the problem. Programming Example •...
Page 50
AX Seri es-St andard I nst ruct i ons Manual Chapt er 3 This example uses DFB_HCnt in AX-332E to perform the Count function As the following figure shows, select a Counter (Counter 0) in Hardware IO Configuration and you will see the input points (e.g.
AX Seri es-St andard I nst ruct i ons Manual Chapt er 3 3.4 DFB_HTmr Supported Products • AX-308E, AX-364E, AX-324N DFB_HTmr enables the specified high speed timer channel according to the specified parameters and monitors and timed value. FB/FC Instruction Graphic Expression...
Page 52
AX Seri es-St andard I nst ruct i ons Manual Chapt er 3 Output • Name Function Data Type Output Range(Default value) True when the output value bValid BOOL True/False(False) is valid. True when the instruction is bBusy BOOL True/False(False) enabled.
Page 53
AX Seri es-St andard I nst ruct i ons Manual Chapt er 3 In/ Outs • Setting Value Name Function Data Type Timing for Updating (Default value) Reference to the source of the DFB_TIMER_REF DFB_TIMER_REF When bEnable shifts to True and Busy Timer specified high- (FB)*...
Page 54
AX Seri es-St andard I nst ruct i ons Manual Chapt er 3 After using the FB DFB_HTmr in the POU to activate the high-speed timer(bEnable=True), it starts receiving and counting the pulses from the external signals(IN 0) based on the timing mode set in Timer Configuration, then the timed value would be displayed in the output dwTimerValue.
AX Seri es-St andard I nst ruct i ons Manual Chapt er 4 3.5 DFB_PresetValue Supported Products • AX-308E, AX-364E, AX-324N DFB_PresetValue is the application function block for high-speed counters, its role is to reset the current counter value back to the default value.
Page 56
AX Seri es-St andard I nst ruct i ons Manual Chapt er 4 Name Function Data Type Output Range(Default value) enabled. True when the instruction is bCommandAborted BOOL True/False(False) aborted before it’s completed. bError True when an error occurs. BOOL True/False(False) DFB_HSIO_ERROR ErrorID...
Page 57
AX Seri es-St andard I nst ruct i ons Manual Chapt er 4 In/ Outs • Setting Value Name Function Data Type Timing for Updating (Default value) Reference to the source of DFB_COUNTER_REF DFB_COUNTER_REF When bExecute shifts to True and Counter high-speed (FB)*...
Page 58
AX Seri es-St andard I nst ruct i ons Manual Chapt er 4 After using the FB DFB_HCnt in the POU to activate the high-speed counter(bEnable=True), it starts receiving and counting the pulses from the external signals(IN 0, IN 1) based on the counting mode set in Counter Configuration, then the counter value would be displayed in the output diCounterValue.
Page 59
AX Seri es-St andard I nst ruct i ons Manual Chapt er 4 Then the input bExecute of DFB_PresetValue shifts to True and the FB DFB_PresetValue would wait for the Z phase of high-speed counter to trigger the Default value function. After the counter value being set to the default (DFB_HCnt.diCounterValue = fb), the output bDone will shift from False to True.
AX Seri es-St andard I nst ruct i ons Manual Chapt er 4 3.6 DFB_Sample Supported Products • AX-308E, AX-364E, AX-324N DFB_Sample is the application function block for high-speed counters, its role is to read the increasing and decreasing number of the counter value during the sampling period.
Page 61
AX Seri es-St andard I nst ruct i ons Manual Chapt er 4 Outputs Updating Timing Name Timing for shifting to True Timing for shifting to False When the values at the outputs are valid When bEnable shifts to False. bValid after bEnable being True for one scan ...
Page 62
AX Seri es-St andard I nst ruct i ons Manual Chapt er 4 F unction • DFB_Sample counts incoming pulses during a specified sampling period (wSampleTime). wSampleTime = 4( unit : 1ms ) 時間 ms diSampleValue = 6 diSampleValue = 4 diSampleValue = 2 diSampleValue = -4 diCounterValue =12...
Page 63
AX Seri es-St andard I nst ruct i ons Manual Chapt er 4 As the following figure shows, select a Counter (Counter 2) in Hardware IO Configuration and you will see the input points (e.g. IN 0, IN 1, IN 2) matched to the corresponding encoder A, B, Z phase outputs, which the wiring should follows the configuration so as to perform the normal function of high speed counting.
Page 64
AX Seri es-St andard I nst ruct i ons Manual Chapt er 4 After enabling DFB_Sample in the POU (bEnable=True), the FB starts counting the increasing number of the pulse counter value during each sampling period. Please refer to AX-3 series operational manual for more details related to the settings and operation of Counter Configuration.
AX Seri es-St andard I nst ruct i ons Manual Chapt er 4 3.7 Error Codes and Troubleshooting The following table lists the error codes corresponding to the FBs and the contents of the errors: Description Cause of Error Corrective Action DFB_HSIO_NO_ERR No error messages.
Page 66
AX Seri e s-St and ard I n st ruct i on s Man ual Ch apt er 4 Description Cause of Error Corrective Action DFB_HC_COUNTER_ The high-speed counter has been Check if this Counter device is currently ALREADY_ENABLE activated. being used by another DFB_HCnt.
Page 67
AX Seri es-St andard I nst ruct i ons Manual Chapt er 4 Description Cause of Error Corrective Action operational manual to troubleshoot the errors. After make sure Counter in IO DFB_SP_INVALID_ The variable type set for the FB Configuration is selected, input the COUNTER_REF input is not Counter_REF.
AX Seri es-St andard I nst ruct i ons Manual Chapt er 4 4.1 DFB_EcGetAllSlaveAddr Supported Products • AX-308E, AX-364E DFB_EcGetAllSlaveAddr gets all the slave addresses. FB/FC Instruction Graphic Expression DFB_EcGetAllSlaveAddr ST Language DFB_EcGetAllSlaveAddr ( bExecute :=, bDone =>, bBusy =>, bError =>, ErrorID =>,...
Page 70
AX Seri es-St andard I nst ruct i ons Manual Chapt er 4 Output Range Name Function Data Type (Default value) uSlaves The number of slaves. UINT 0~128(0) *Note: DFB_ECAT_Diag_ERROR: Enumeration (Enum) Output Updating Timing Name Timing for shifting to True Timing for shifting to False ...
Page 71
AX Seri es-St andard I nst ruct i ons Manual Chapt er 4 Programming Example • The following example demonstrates the behavior of DFB_EcGetAllSlaveAddr. There’re a total of 7 EtherCAT slaves in the category EtherCAT_Master_SoftMotion.
Page 72
AX Seri es-St andard I nst ruct i ons Manual Chapt er 4 After the input bExecute of DFB_EcGetAllSlaveAddr bExecute shifts to True, the output of AddrArray is shown as below and the output value of uSlaves is 7. Library ...
AX Seri es-St andard I nst ruct i ons Manual Chapt er 4 4.2 DFB_EcGetSlaveCount Supported Products • AX-308E, AX-364E DFB_EcGetSlaveCount gets the number of slaves that are connected to the master. FB/FC Instruction Graphic Expression DFB_EcGetSlaveCount ST Language DFB_EcGetSlaveCount ( bExecute :=, bDone =>,...
Page 74
AX Seri es-St andard I nst ruct i ons Manual Chapt er 4 *Note: DFB_ECAT_Diag_ERROR: Enumeration (Enum) Outputs Updating Timing Name Timing for shifting to True Timing for shifting to False When bExecute shifts to False. If bExecute is False and bDone shifts to True, bDone When the execution of FB is completed.
Page 75
AX Seri es-St andard I nst ruct i ons Manual Chapt er 4 There’re a total of 7 EtherCAT slaves in the category EtherCAT_Master_SoftMotion. When the input bExecute of DFB_EcGetSlaveCount shifts to True, the output value of uSlaves is 7. Library ...
AX Seri es-St andard I nst ruct i ons Manual Chapt er 4 4.3 DFB_EtherCATLink_Diag Supported Products • AX-308E, AX-364E DFB_EtherCATLink_Diag is used to display all the EtherCAT slave diagnostics. FB/FC Instruction Graphic Expression DFB_EtherCATLink_Diag ST Language DFB_EtherCATLink_Diag ( bEnable :=, bValid =>, bError =>,...
Page 77
AX Seri es-St andard I nst ruct i ons Manual Chapt er 4 uSlaves Number of Slaves UINT 0 ~ 65535 *Note: DFB_ECAT_Diag_ERROR: Enumeration (Enum) StationStatus Structure (STRUCT) Setting Value Name Function Data Type (Default value) StationAddress Slave station address UINT True: Connected and functioning properly.
Page 78
AX Seri es-St andard I nst ruct i ons Manual Chapt er 4 When bEnable shifts to True, StationAddress and Node output from StationAddress are in array type to show all the slave addresses and status with the support up to 128 slave stations. If the value of StationAddress is shown as 0 in the struct array after bEnable is rising edge triggered, it indicates that the slave station does not exist.
Page 79
AX Seri es-St andard I nst ruct i ons Manual Chapt er 4 bEnable of DFB_EtherCATLink_Diag After shifts to True, the output uSlave shows 2, indicating that there are EtherCAT slaves in total. The array of StationNode index 1 to 2 shows the two slave addresses, statuses, and physical connection statuses, and the StationAddress of StationNode shows 0 from index Disconnect the cable for internet connection between slave station 1 and 2 and you can see the status of slave 2 is shown to be Fail in the device tree.
Page 80
AX Seri es-St andard I nst ruct i ons Manual Chapt er 4 StationNode index 2 Node and LinkStatus of DFB_EtherCATLink_Diag are False respectively. Now, If connecting the physical network of Slave 1 and Slave 2, StationNode index 2 Node and LinkStatus of DFB_EtherCATLink_Diag will be False and True respectively.
AX Seri es-St andard I nst ruct i ons Manual Chapt er 4 4.4 DFB_GetAllECATSlaveInfo Supported Products AX-308E, AX-364E DFB_GetAllECATSlaveInfo gets all the slaves’ information. FB/FC Instruction Graphic Expression DFB_GetAllECATSlaveInfo ST Language DFB_GetAllECATSlaveInfo ( bExecute :=, bDone =>, bBusy =>, bError =>, ErrorID =>,...
Page 82
AX Seri es-St andard I nst ruct i ons Manual Chapt er 4 Output Range Name Function Data Type (Default value) if an error occurs. (DFB_ECAT_Diag_NO_ERROR) ECATSlaveInfo slaveInfoArray Slave information array. ECATSlaveInfo [1..128] uSlaves The number of slaves. UINT 0~128(0) *Note: DFB_ECAT_Diag_ERROR: Enumeration(Enum) slaveInfoArray: Structure(STRUCT)。...
Page 83
AX Seri es-St andard I nst ruct i ons Manual Chapt er 4 Function • When bExecute shifts to True, slaveInfoArray gives the information of all the EtherCAT slaves in the device tree, which includes vendor id, product code, revision number and serial number. Support up to 128 stations as well as the maximum number of slaves and the corresponding information output from uSlaves and slaveInfoArray.
Page 84
AX Seri es-St andard I nst ruct i ons Manual Chapt er 4 The input bExecute of DFB_GetAllECATSlaveInfo bExecute shifts to True, then the output of slaveInfoArray is shown as below and the output value of uSlaves is 2. Library ...
AX Seri es-St andard I nst ruct i ons Manual Chapt er 4 4.5 DFB_GetECATMasterError Supported Products AX-308E, AX-364E DFB_GetECATMasterError gets the error code of failed EtherCAT network connection. FB/FC Instruction Graphic Expression DFB_GetECATMasterError ST Language DFB_GetECATMasterError ( bEnable :=, bBusy =>, bError =>,...
Page 86
AX Seri es-St andard I nst ruct i ons Manual Chapt er 4 DFB_ECAT_Diag_ERROR: Enumeration (Enum) ETC_LASTERROR: Enumeration (Enum) Outputs Updating Time Name Timing for shifting to True Timing for shifting to False When bEnable shifts to False. bBusy ...
Page 87
AX Seri es-St andard I nst ruct i ons Manual Chapt er 4 shown as NO_ERROR after the input bEnable of DFB_GetECATMasterError shifts to True. Remove the network connection between the master and the slave, then the output content of EtherCATErrorId would be shown as NO_COMM.
AX Seri es-St andard I nst ruct i ons Manual Chapt er 4 4.6 DFB_GetECATMasterState Supported Products AX-308E, AX-364E DFB_GetECATMasterState gets the connection status of EtherCAT Master. FB/FC Instruction Graphic Expression DFB_GetECATasterState ST Language DFB_GetECATMasterState ( bEnable :=, bBusy =>, bError =>, ErrorID =>,...
Page 89
AX Seri es-St andard I nst ruct i ons Manual Chapt er 4 Name Timing for shifting to True Timing for shifting to False bBusy When bEnable is rising edge triggered. When bError shifts to True. bError When an error occurs in the execution ...
Page 90
AX Seri es-St andard I nst ruct i ons Manual Chapt er 4 The connection status of EtherCAT master shows PASS in the device tree. When the input bEnable of DFB_GetECATMasterState shifts to True, the output of bStatus is displayed as True. Remove the network connection between the master and the slave, and the current connection status of EtherCAT master would show Fail in the device tree.
AX Seri es-St andard I nst ruct i ons Manual Chapt er 4 4.7 DFB_ResetECATMaster Supported Products AX-308E, AX-364E DFB_ResetECATMaster resets the EtherCAT master, which has errors in connection. FB/FC Instruction Graphic Expression DFB_ResetECATMaster ST Language DFB_ResetECATMaster ( bExecute :=, bDone =>, bBusy =>,...
Page 92
AX Seri es-St andard I nst ruct i ons Manual Chapt er 4 True when the instruction is bBusy BOOL True/False(False) enabled. bError True if an error occurs. BOOL True/False(False) Indicates the error code if DFB_ECAT_Diag_ERROR ErrorID DFB_ECAT_Diag_ERROR* an error occurs. (DFB_ECAT_Diag_NO_ERROR) *Note: DFB_ECAT_Diag_ERROR: Enumeration (Enum) Outputs Updating Timing...
Page 93
AX Seri es-St andard I nst ruct i ons Manual Chapt er 4 The connection status of EtherCAT master shows PASS in the device tree. Remove the network connection between the master and the slave, and the current connection status of EtherCAT master would show Fail in the device tree.
Page 94
AX Seri es-St andard I nst ruct i ons Manual Chapt er 4 The network connectivity has been recovered after the output bDone shifting to True. Library DL_EtherCAT_Diag.library ...
AX Seri es-St andard I nst ruct i ons Manual Chapt er 4 4.8 DFB_ResetECATSlave Supported Products AX-308E, AX-364E DFB_ResetECATSlave resets the EtherCAT slave, which has errors in connection. FB/FC Instruction Graphic Expression DFB_ResetECATSlave ST Language DFB_ResetECATSlave( bExecute :=, uiSlaveAddr :=, tTimeout :=, bDone =>,...
Page 96
AX Seri es-St andard I nst ruct i ons Manual Chapt er 4 Output • Output Range Name Function Data Type (Default value) The execution of FB is bDone BOOL True/False(False) completed. True when the instruction is bBusy BOOL True/False(False) enabled.
Page 97
AX Seri es-St andard I nst ruct i ons Manual Chapt er 4 If an error occurs during the execution of the instruction, bError will change to True and the Capture will stop. You can refer to ErrorID (Error Code) to address the problem. Programming Example •...
Page 98
AX Seri es-St andard I nst ruct i ons Manual Chapt er 4 Remove the network connection of slave 4 and 5, and the current connection status of EtherCAT slave starting from slave 5 would show Fail in the device tree. To restore the network connection of slave 4 and 5, enter 1005 to the input uiSlaveAddr and shift the input bExecute to True.
Page 99
AX Seri es-St andard I nst ruct i ons Manual Chapt er 4 All the slave stations would be reset if you enter 0 to the input uiSlaveAddr. Library DL_EtherCAT_Diag.library ...
AX Seri es-St andard I nst ruct i ons Manual Chapt er 4 4.9 Error Codes and Troubleshooting The following table lists the error codes corresponding to the FBs and the contents of the errors: Description Cause of Error Corrective Action The EtherCAT master is not in the mapping, EtherCAT master DFB_ECAT_Diag_MASTER_CANT_BE_FOUND...
AX Seri es-St andard I nst ruct i ons Manual Chapt er 5 5.1 DFC_LRC8 Supported Products AX Series DFC_LRC8: LRC (8-bit) checksum calculation. FB/FC Instruction Graphic Expression ST Language DFC_LRC8( pSrc:= , DFC_LRC8 wLen:= , ErrorID=> ); Input •...
Page 103
AX Seri es-St andard I nst ruct i ons Manual Chapt er 5 Programming Example The example uses FC instruction (DFC_LRC8) to perform calculating the LRC (8-bit) checksum. The checksum calculation scope is 6(dwLen = 6), therefore, the FC instruction(DFC_LRC8) will starts calculating checksums of six consecutive BYTE data from the memory address input to pSrc(ar_byVar0[0]) and will result in a checksum value of 16#CF.
AX Seri es-St andard I nst ruct i ons Manual Chapt er 5 5.2 FC_LRC16 Supported Products • AX Series DFC_LRC16: LRC (16-bit) checksum calculation. FB/FC Instruction Graphic Expression ST Language DFC_LRC16( pSrc:= , DFC_LRC16 dwLen:= , ErrorID=> ); •...
Page 105
AX Seri es-St andard I nst ruct i ons Manual Chapt er 5 Programming Example • The example uses FC instruction (DFC_LRC16) to perform calculating the LRC (16-bit) checksum. The checksum calculation scope is 6(dwLen = 6), therefore, the FC instruction(DFC_LRC16) will starts calculating checksums of six consecutive BYTE data from the memory address input to pSrc(ar_byVar0[0]) and will result in a checksum value of 16#CFCB.
Page 106
AX Seri es-St andard I nst ruct i ons Manual Chapt er 5 5.3 DFC_LRC32 Supported Products • AX Series DFC_LRC32: LRC (32-bit) checksum calculation. FB/FC Instruction Graphic Expression ST Language DFC_LRC32( pSrc:= , DFC_LRC32 wLen:= , ErrorID=> ); •...
Page 107
AX Seri es-St andard I nst ruct i ons Manual Chapt er 5 Programming Example The example uses FC instruction (DFC_LRC32) to perform calculating the LRC (32-bit) checksum. The checksum calculation scope is 4(dwLen = 4), therefore, the FC instruction(DFC_LRC32) will starts calculating checksums of four consecutive BYTE data from the memory address input to pSrc(ar_byVar0[0]) and will result in a checksum value of 16#3935312E.
Page 108
AX Seri es-St andard I nst ruct i ons Manual Chapt er 5 5.4 Error Codes and Troubleshooting Description Cause of Error Corrective Action DFC_LRC_ERR_ Make sure the wLen value is greater than zero and The value of wLen is incorrect. PARAMETER does not exceed the upper limit.
Page 109
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 Chapter 6 Module Read-write Instructions 1 0 3...
Page 110
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 6.1 DFB_From Supported Products • AX-308E, AX-364E, AX-300, AX-324N DFB_From: Read the CR data in the module. FB/FC Instruction Graphic Expression ST Language DFB_From( bExecute:= , byRemoteID:= , byLocalID:= , wCRAddr:= ,...
Page 111
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 Name Function Data Type Output Range(Default value) True when the instruction bBusy BOOL True/False(False) is being executed. bError True if an error occurs. BOOL True/False(False) DFB_AS_MODULE_ DFB_AS_MODULE_API_ Indicates the error code if ErrorID an error occurs.
Page 112
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 Programming Example This example uses DFB_From to read the value of CR1 in the second module on the right side of the CPU and store the value in the variable (wVar) of the controller.
Page 113
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 6.2 DFB_To Supported Products • AX-308E, AX-364E, AX-300, AX-324N DFB_To: Write a value to the CR data in the module. FB/FC Instruction Graphic Expression ST Language DFB_To( bExecute:= , byRemoteID:= ,...
Page 114
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 Output • Name Function Data Type Output Range(Default value) True when the execution of the instruction is bDone BOOL True/False(False) completed. True when the instruction bBusy BOOL True/False(False) is being executed.
Page 115
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 Library DL_ASModuleAPI_AX3 1 0 9...
Page 116
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 6.3 DFB_DLCCAL • Supported Products AX-308E, AX-364E, AX-300, AX-324N DFB_DLCCAL:AS02LC weighing module weight calibration instruction FB/FC Instruction Graphic Expression ST Language DFB_DLCCAL( bEnable:= , byRemoteID:= , byLocalID:= , usiChannelNo:= , bTrigger:= ,...
Page 117
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 Output • Name Function Data Type Output Range(Default value) All calibration is done. bDone BOOL True/False(False) Indicates that the bBusy function block is being BOOL True/False(False) executed. Points number calibration iCPoint 0~20(0)
Page 118
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 Timing Diagram • bExecute iTPoint iCPoint bTrigger bTriggerDone bDone bError The timing points in the timing diagram are described as below: ...
Page 119
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 iTPoint is the total number of points for this calibration. After the instruction is activated by users, this value cannot be changed because this iTPoint has been sent to the LC module for calibration at the first activation. aTWeight is the calibration weight value for each calibrated point, and the maximum number of calibration points for the LC module is 20.
Page 120
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 6.4 DFB_DLCWEI • Supported Products AX-308E, AX-364E, AX-300, AX-324N DFB_DLCWEI:AS02LC weighting module weight measurement instruction FB/FC Instruction Graphic Expression ST Language DFB_DLCWEI( bEnable:= , byRemoteID:= , byLocalID:= , usiChannelNo:= , rStable:= ,...
Page 121
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 Output • Name Function Data Type Output Range(Default value) Indicates that the bBusy function block is being BOOL True/False(False) executed. rTareW Tare weight REAL 1.0E-44~3.402823E+38(0) rWeight Current weight REAL 1.0E-44~3.402823E+38(0) iStatus*...
Page 122
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 • Timing Diagram bEnable bZeroS bTareS rTareW rWeight iStatus The timing points in the timing diagram are described as below: ...
Page 123
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 If users need to know the “Gross weight (total weight)” value, add rTareW and rWeight. bZeroS is the flag that sets the current weight to 0. When this flag is from OFF to ON, rTareW and rWeight will be cleared to 0.
Page 124
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 6.5 DFB_DPUCONF Supported Products • AX-308E, AX-364E, AX-300, AX-324N DFB_DPUCONF: parameter setting of PU module output control FB/FC Instruction Graphic Expression ST Language DFB_DPUCONF( bEnable:= , byLocalID:= , iAxis:= , iMode:= ,...
Page 125
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 Output • Name Function Data Type Output Range(Default value) Parameter setting bDone BOOL True/False(False) completion flag Indicates that the bBusy function block is being BOOL True/False(False) executed. bError FB instruction error flag.
Page 126
AX Seri e s-St and ard I n st ruct i on s Man ual Ch apt er 6 PU Module Name Axis1 Combination Axis2 Combination Axis3 Combination Axis4 Combination AS02PU Y0.0 / Y0.1 Y0.2 / Y0.3 AS04PU Y0.0 / Y0.1 Y0.2 / Y0.3 Y0.4 / Y0.5 Y0.6 / Y0.7...
Page 127
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 Delta_LocalBus_Master configures an AS02PU_A. Use the DFB_DPUCONF function block to set the first axis parameter of the 02PU module on the right. Library DL_ASModuleAPI_AX3.library 1 2 1...
Page 128
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 6.6 DFB_PUSTAT Supported Products • AX-308E, AX-364E, AX-300, AX-324N DFB_PUSTAT: PU module output status read-back FB/FC Instruction Graphic Expression ST Language DFB_PUSTAT( bEnable:= , byLocalID:= , iAxis:= , bZeroSet:= , DFB_ PUSTAT...
Page 129
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 Outputs Updating Timing Name Timing for shifting to True Timing for shifting to False bBusy When bEnable shifts to True. When bEnable shifts to False. ...
Page 130
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 BError is the specified PU module and is the read error flag (Read-only). When the error occurs, please refer to ErrorCode description. Programming Example This example shows how to execute the DFB_PUSTAT function block to set the current output position of the first axis of the PU output module.
Page 131
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 6.7 DFB_DPUPLS Supported Products • AX-308E, AX-364E, AX-300, AX-324N DFB_DPUPLS: PU module pulse output (No acceleration/deceleration) FB/FC Instruction Graphic Expression ST Language DFB_DPUPLS( bEnable:= , byLocalID:= , iAxis:= , diTarPulse:= , DFB_DPUPLS...
Page 132
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 Outputs Updating Timing Name Timing for shifting to True Timing for shifting to False bDone When the pulse output is done. When bEnable shifts to False. ...
Page 133
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 when the target speed of diTarSpeed is negative (<0), it means that the output point of “negative direction” is ON; when the target speed of diTarSpeed is 0, it means that after outputting a complete executing pulse, it enters the pause output status.
Page 134
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 6.8 DFB_DPUDRI • Supported Products AX-308E, AX-364E, AX-300, AX-324N DFB_DPUDRI: PU module relative positioning output (With acceleration/deceleration) FB/FC Instruction Graphic Expression ST Language DFB_DPUDRI( bEnable:= , byLocalID:= , iAxis:= , diRTarPosi:= ,...
Page 135
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 Outputs Updating Timing Name Timing for shifting to True Timing for shifting to False bDone When the pulse output is done. When bEnable shifts to False. ...
Page 136
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 PU Module Name diTarSpeed Setting Range AS02PU -200,000(-200K) ~ 200,000(200K) AS04PU -100,000(-100K) ~ 100,000(100K) After starting the output, the target frequency can be changed anytime; however, when the frequency is actually changed, PLC will automatically change the frequency according to the acceleration/deceleration rate slope set by the DPUCONF instruction.
Page 137
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 6.9 DFB_DPUDRA • Supported Products AX-308E, AX-364E, AX-300, AX-324N DFB_DPUDRA: PU module absolute positioning output (With acceleration/deceleration) FB/FC Instruction Graphic Expression ST Language DFB_DPUDRI( bEnable:= , byLocalID:= , iAxis:= , diATarPosi:= ,...
Page 138
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 Name Timing for shifting to True Timing for shifting to False bDone When pulse output is done. When bEnable shifts to False. bBusy When bEnable shifts to True. When bEnable shifts to False.
Page 139
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 6.10 DFB_DPUZRN Supported Products • AX-308E, AX-364E, AX-300, AX-324N DFB_DPUZRN: PU module homing FB/FC Instruction Graphic Expression ST Language DFB_DPUZRN( bEnable:= , byLocalID:= , iAxis:= , iMode:= , DFB_DPUZRN diTarSpeed:= ,...
Page 140
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 Outputs Updating Timing Name Timing for shifting to True Timing for shifting to False bDone When the pulse output is done. When bEnable shifts to False. ...
Page 141
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 Select Matching Input Point Mode Function (Parameter Setting of PU Remark Parameter Module) Output the offset position after mode 2 is done. After mode 1 is done, look for z-phase first, DOG and Z-phase input Set z-phase times and then output the offset position...
Page 142
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 6.11 DFB_DPUJOG • Supported Products AX-308E, AX-364E, AX-300, AX-324N DFB_DPUJOG: PU module inching output FB/FC Instruction Graphic Expression ST Language DFB_DPUJOG( bEnable:= , byLocalID:= , iAxis:= , DFB_DPUJOG diJogSpeed:= , bBusy=>...
Page 143
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 Outputs Updating Timing Name Timing for shifting to True Timing for shifting to False bBusy When bEnable shifts to True. When bEnable shifts to False. ...
Page 144
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 The output timing diagram of the DPUJOG instruction is as follows: (In the timing diagram, Jog_in is the instruction startup switch, and Busy flag is the flag of bBusy being executing.) When the DPUJOG instruction is deactivated, it can perform other output control after the bBusy flag is already OFF.
Page 145
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 6.12 DFB_DPUCNT Supported Products • AX-308E, AX-364E, AX-300, AX-324N DFB_DPUCNT: PU module high-speed counter function FB/FC Instruction Graphic Expression ST Language DFB_DPUCNT( bEnable:= , byLocalID:= , iInputMode:= , iPeriod:= , DFB_DPUCNT...
Page 146
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 Outputs Updating Timing Name Timing for shifting to True Timing for shifting to False bBusy When bEnable shifts to True. When bEnable shifts to False. ...
Page 147
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 iInputMode Setting Description Value Input Mode (Set the following reserved setting, and the module will execute in default values.) Other value Automatically transferred to (default value). iPeriod is the cycle time setting value of speed fetching, and the settable range is 10ms ~ 1000ms. If the value is out of range, it will be set to the minimum/maximum value.
Page 148
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 6.13 DFB_DMPID Supported Products • AX-308E, AX-364E, AX-300, AX-324N DFB_DMPID: RTD/TC module PID operation FB/FC Instruction Graphic Expression ST Language DFB_DMPID( bEnable:= , byRemoteID:= , byLocalID:= , usiChannelNo:= , bUpdate:= , bPID_Run:= ,...
Page 149
AX Seri e s-St and ard I n st ruct i on s Man ual Ch apt er 6 Setting Value Name Function Data Type (Default value) usiChannelNo Specified channel number USINT bPID_Run Activate PID operation BOOL True/False(False) Target value -32768~32767(0) TRUE: Manual, MV value will output according to the MOUT value.
Page 150
AX Seri e s-St and ard I n st ruct i on s Man ual Ch apt er 6 Setting/Output value range Name Function Data Type (Default Value) parameter) (Unit: Ti = sec; Ki = 1/sec) Differential coefficient (Td or Kd, Positive single-precision floating-point number determin which coefficient to use range...
Page 151
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 Timing Diagram • bEnable bBusy bError Function • It is suggested that this instruction be placed under Main Task. This function is supported only when AX-3 series firmware version is V1.0.1 and later. The instruction is supported only by AS series temperature modules (supported version: AS04RTD-A V1.04 and later/AS06RTD-A V1.00 and later;AS04TC-A V1.04 and later /AS08TC-A V1.00 and later) byRemoteID specifies that the analog input module should connect to the right of CPU or the right of the remote...
Page 152
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 1 4 6...
Page 153
AX Seri e s-St and ard I n st ruct i on s Man ual Ch apt er 6 PID Calculation Formula: • When the PID_MODE control mode is set to 0, it is the autocontrol mode. PID calculation formula is as follows: Independent Formula &...
Page 154
If PID_DE=True, it means that using the PV value to perform the differential calculation. After the Cross Status conditions are established, the CPU will take Delta PV as 0 to perform the PID differential calculation. (Delta PV= Current PV- previous PV).
Page 155
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 α, β VALUE: • ALPHA and BETA are used to compensate initial integral when PID starts and the SV target values changes, the aim of which is to reduce the overshoot phenomenon. As shown in the following figures, ALPHA parameter is used to slow down the rising overshoot;...
Page 156
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 6.14 DFB_DHCCNT Supported Products • AX-308E, AX-364E, AX-300, AX-324N DFB_DHCCNT: This instruction is for AS02HC-A instruction only. Its functions include starting/shutting counter and setting/modifying counter value. FB/FC Instruction Graphic Expression...
Page 157
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 usiAction Function Description this usiAction is invalid. Set SSI encoder offset as When the counter form is set as Absolute Position, users can set the offset of diActionValue the SSI encoder counter value.
Page 158
AX Seri e s-St and ard I n st ruct i on s Man ual Ch apt er 6 usiAction Function Description Note: When using SSI encoder, and the counter form is set as Absolute Position, the counter value cannot be preset, but the iCurrentNo, bMatch1, and bMatch2 flags will be reset.
Page 159
AX Seri e s-St and ard I n st ruct i on s Man ual Ch apt er 6 Status Name Status Description Note Number Reserved 15 ~ 11 Reserved The device configuration area starts or shuts detection, and the default is no detection.
Page 160
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 Outputs Updating Timing Name Timing for shifting to True Timing for shifting to False When bEnable shifts to true and the When bEnable shifts to false and the function is ...
Page 161
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 Complete the usiAction and diActionValue settings before executing this instruction. When bEnable is started for the first time, usiAction and usiAction of HC module will be set once. When usiAction and diActionValue need to be re-changed during execution, set usiAction and diActionValue as new values, and then set the bUpdate flag to On.
Page 162
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 Example 1: Set/Change the current counter value. (usiAction = 1) 1. When setting M0 = ON, Counter starts to count. 2. When setting usiAction parameter of the DHCCNT instruction as 1 and setting diActionValue parameter as 10000;...
Page 163
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 Example 2 – set absolute SSI encoder offset (usiAction = 2) 1Module device parameter sets the channel 1 as SSI Input, and select the counter form as Absolute Position. When setting M0=ON, counter starts to count.
Page 164
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 Example 4: Reset or preset the current counter value (usiAction = 4、6) When setting M0=ON, counter starts to count. Set the usiAction parameter of the DHCCNT instruction as 4. When users set the bUpdate flag M1=ON, the current counter value CurNo will be reset to 0.
Page 165
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 6.15 DFB_DHCCAP Supported Products • AX-308E, AX-364E, AX-300, AX-324N DFB_DHCCAP:This instruction is for HC counting only. Its functions include starting/shutting catcher. FB/FC Instruction Graphic Expression ST Language DFB_DHCCAP( bEnable:= , byLocalID:= ,...
Page 166
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 Name Function Data Type Output Value Range (Default) Instruction execution bBusy True/False(False) BOOL flag Capture counter Positive number, negative number or diCapValue1 DINT value1 0(0) diCapValue1 capture bCapValue1_Complete True/False(False) BOOL...
Page 167
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 Function • It is suggested that this instruction be placed under Main Task. This function is supported when AX-3 Series firmware is V1.0.2 and above. 0 and This instruction is only supported by AS Series count module (The supported version is AS02HC-A V1.0 above).
Page 168
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 byTrgSel = 0 11000 Channel 1 8500 Counter Value 6000 1800 CH1 Z-Phase Input diCapValue1 1800 8500 bCapValue1_Complete diCapValue2 6000 11000 bCapValue2_Complete * 1: bCap Value1_Complete is not cleared to OFF, the captured value still up dates in di CapValu e 1. *2: bCap Value2_Complete is cleared to OFF, the captured value still up dates in CapValue 2.
Page 169
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 Set the byTrgSel parameter of the DHCCAP instruction in channel 1. When M0=ON, the DHCCAP instruction will starts to wait for compare arrival of the other channel (channel 2). When channel 2 counter value arrives compare value diCompareValue1, and at this time channel 1 counter value 2000 will immediately output to diCapValue1, and the bCapValue1_Complete flag will be set to ON.
Page 170
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 1 6 4...
Page 171
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 Timing diagram: byTrgSel = 1 Channel 1 8000 Counter Value 2000 bMATCH 2 is OFF to ON CH2 Comp2 on channel 2. Channel 2 Counter CH2 Comp1 Value bMATCH 1 is OFF to ON on channel 2.
Page 172
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 6.16 DFB_HCDO Supported Products • AX-308E, AX-364E, AX-300, AX-324N DFB_HCDO:HC module output point control FB/FC Instruction Graphic Expression ST Language DFB_HCDO( bEnable:= , byLocalID:= , bUpdate:= , DFB_HCDO iOutputSetting:= , bBusy=>...
Page 173
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 Outputs Updating Timing Name Timing for shifting to True Timing for shifting to False bBusy When bEnable shifts to true When bEnable shifts to false ...
Page 174
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 iOutputState is the status display of the output point b15~b4 Y0.3 status Y0.2 status Y0.1 status Y0.0 status 0:OFF 1:ON When the instruction is off, iOutputState will be 0. When compare output instruction DHCCMP or table compare output instruction DHCCMPT starts, output point cannot be changed through iOutputSetting.
Page 175
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 6.17 DFB_DHCCMP Supported Products • AX-308E, AX-364E, AX-300, AX-324N DFB_DHCCMP:HC module compare output. FB/FC Instruction Graphic Expression ST Language DFB_DHCCMP( bEnable:= , byLocalID:= , usiChannelNo:= , bUpdate:= , diCompareValue1:= , iActionValue1:= ,...
Page 176
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 Setting Value Name Function Data Type (Default value) Y output point number of iY_OutputNo2 0 ~ 3(0) arrival compare value2 Arrive compare value2, iInterruptNo2 0, 400 ~ 431(0) External Event interrupts number.
Page 177
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 Function • It is suggested that this instruction be placed under Main Task. This function is supported when AX-3 Series firmware is V1.0.2 and above. The o tput point Y0.0~Y0.3 in this instruction is the output point on the 02HC module.
Page 178
AX Seri e s-St and ard I n st ruct i on s Man ual Ch apt er 6 below: iActionValue1 Function iActionValue2 Function Note No action No action iY_OutputNo1 specifies output iY_OutputNo2 specifies output point Off. point Off. iY_OutputNo1 specifies output iY_OutputNo2 specifies output point On.
Page 179
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 is OFFON, or the bUpdate flag is set, the instruction will clear the bMatch1 and bMatch2 flags to Off. When the instruction is off, the relevant compare values and the output functions will not be updated. 17.
Page 180
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 Timing Diagram: Programming Example2: Clear the counter value when compare arrives. Set diCompareValue1 to 2500, set iActionValue1 to 2, set iY_OutputNo1 to 0 and set iInterruptNo1 to 0; set diCompareValue2 to 5000, set iActionValue2 to 8, set iY_OutputNo2 to 1, and set iInterruptNo2 to 0.
Page 181
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 Timing Diagram: Programming Example3: Update the compare value Set diCompareValue1 to 1000, set iActionValue1 to 3, set iY_OutputNo1 to 0,and set iInterruptNo1 to 0; set diCompareValue2 to 3000, set iActionValue2 to 3, set iY_OutputNo2 to 1, and set iInterruptNo2 to 0. When setting M0 = ON, DHCCNT counter starts to count.
Page 182
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 will be ONOFF. When counter value reaches new compare value diCompareValue2, Y0.1 will be OFFON. Because iActionValue2 = 6 include Reset, counting value will be cleared to 0. At the same time, the bMatch1 and bMatch2 flags will be cleared to OFF.
Page 183
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 Programming Example4: Compare arrival interruption DHCCMP can also configure compare arrival interruption. Set iInterruptNo1 and iInterruptNo2 to 400 and 401 respectively, and configure two Tasks at the same time. In the tasks, select Interrupt_400_ModuleIN0 or Interrupt_401_ModuleIN1 for External event as shown in the following figures.
Page 184
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 6.18 DFB_DHCCMPT Supported Products • AX-308E, AX-364E, AX-300, AX-324N DFB_DHCCMPT:HC module table compare output FB/FC Instruction Graphic Expression ST Language DFB_DHCCMPT( bEnable:= , byLocalID:= , usiChannelNo:= , bUpdate:= , iCompareLength:= , aCompareValue:= ,...
Page 185
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 Setting Value Name Function Data Type (Default value) Shows function block is bBusy BOOL True/False (False) been executed The number of groups iCurrentNo that the comparator has 0 ~ 10 (0) executed so far.
Page 186
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 bEnable will write the parameter once when it is first started. before executing the instruction. The parameters of iCompareLength, aCompareValue, aAction, aY_OutputNo, and aInterruptNo can be changed during execution. The changing methods is to set them as new values, and then set the bUpdate flag to On.
Page 187
AX Seri e s-St and ard I n st ruct i on s Man ual Ch apt er 6 aAction Function Note No action aY_OutputNo specifies the output point Off. aY_OutputNo specifies the output point On. aY_OutputNo specifies the output point Toggle output (alternating ON/OFF).
Page 188
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 aInterruptNo, and iCurrentNo. In the table, the iCompareLength value is assumed as 6. ICurrentNo aAction aY_OutputNo aCompareValue aInterruptNo Group Compare Arrival Output Point Source Compare Value Interruption Number Number Specified Action Number...
Page 189
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 aAction Compare iCurrentNo aCompareValue Source aY_OutputNo Output aInterruptNo Arrival Specified Group Number Compare Value Point Number Interruption Number Action 1000 3 (Toggle) 0 (Y0.0) 2000 3 (Toggle) 1 (Y0.1) 3000 3 (Toggle)
Page 190
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 Timing Diagram: 10000 9000 8000 7000 6000 5000 4000 3000 2000 1000 Channel 1 Counter Value iCurrenNo Y0.0 Y0.1 Y0.2 Y0.3 Library DL_ASModuleAPI_AX3.library 1 8 4...
Page 191
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 6.19 DFB_DHCMEAS Supported products • AX-308E, AX-364E, AX-300, AX-324N DFB_DHCMEAS:HC module frequency and rotation speed measurement FB/FC Instruction Graphic Expression ST Language DFB_DHCMEAS( bEnable:= , byLocalID:= , usiChannelNo:= , bUpdate:= , udiPulsePerRev:= ,...
Page 192
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 Setting Value Name Function Data Type (Default value) DFB_AS_MODULE_API_ERROR ErrorCode Error code DFB_AS_MODULE_API_ERROR (DFB_NO_ERROR) • Outputs Updating Timing Name Timing for shifting to True Timing for shifting to False bBusy When bEnable shifts to true.
Page 193
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 resolution = 60000 ÷ ( × )(unit: rev/min) Because the rotation speed calculation method is based on the CurCnt counter value of the beginning and end of the sampling period, the following situations need to be excluded when designing sampling periods.
Page 194
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 Library DL_ASModuleAPI_AX3.library 1 8 8...
Page 195
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 6.20 DFB_DADLOG Supported products • AX-308E, AX-364E, AX-300, AX-324N DFB_DADLOG:Analog input module data record. FB/FC Instruction Graphic Expression ST Language DFB_DADLOG( bEnable:= , byRemoteID:= , byLocalID:= , usiChannelNo:= , iMode:= , iPeriod:= ,...
Page 196
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 Name Function Data Type Output Range (Default value) ARRAY[0~1999] The device that stores the record Please refer to chapter 15.2.1 of AS aIntegerData value when Format is Integer OF INT Module Manual ( 0 ) ARRAY[0~1999]...
Page 197
AX Seri e s-St and ard I n st ruct i on s Man ual Ch apt er 6 AS06XA-A The setting range is 1~100, and the unit time is fixed at 10ms Fixed period (Fixed period) mode, trigger start types fixed period (Fixed period + Trigger Start) mode, trigger position designation (Fixed period + Trigger position Assign) recording mode: Setting range 1~32000, selectable time unit 20us/40us/80us...
Page 198
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 Example: Set iTotalPoints = 2000 Fixed period + Trigger Start mode: Set iMode=1, turn on the command bEnable before starting the recording. When the external trigger input point is triggered, the recording will be executed with the set Record Period immediately, and the bDone flag will be automatically set to True when the recording is completed.
Page 199
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 mode will be affected by the host scan time and module communication time, causing delay, please refer to below picture. In the Fixed period mode, it is assumed that M0 is the device that controls the DADLOG command bEnable. When M0 is turned OFF->ON, the module does not start recording immediately, but with a small delay.
Page 200
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 Corresponding to external trigger input signal source Record (Set the trigger timing of the external input point in the External Trigger Input of the Channel module Parameters) Channel 1 Triggers when X0.0 shift to True or False Channel 2...
Page 201
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 Example: Set iMode=3, iTotalPoints = 2000, iPostTrigger = 1500, means that the position of the 501st point (iTotalPoints - iPostTrigger) will be the first data recorded by the current external trigger. iPeriod is set for Record Period, the description is as follows : Model iPeriod Range...
Page 202
AX Seri e s-St and ard I n st ruct i on s Man ual Ch apt er 6 Set iTotalPoints= 100, iPostTrigger= 700, the 1000 records include the first 300 records and the last 700 records triggered by the external trigger input point. aIntegerData and aFloatData are specified arrays to store record values.
Page 203
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 6.21 DFB_DADPEAK Supported Products • AX-308E, AX-364E, AX-300, AX-324N DFB_DADPEAK:Analog input module peak record. FB/FC Instruction Graphic Expression ST LANGUAGE DFB_DADPEAK( bEnable:= , byRemoteID:= , byLocalID:= , usiChannelNo:= , bBusy=>...
Page 204
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 Name Function Data Type Output Range (Default value) DFB_AS_MODULE_API_ERROR DFB_AS_MODULE_ ErrorCode Error Code API_ERROR (DFB_NO_ERROR) Outputs Updating Timing • Name Timing for shifting to True Timing for shifting to False bBusy When the execution of FB starts.
Page 205
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 When any error occurs during the startup process, the bError flag will be set to ON. Please refer to the error code of ErrorCode for troubleshooting. Library ...
Page 206
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 6.22 Error Codes and Troubleshooting Description Cause of Error Corrective Action Confirm if the input DFB_FROM_ERR_PARAMETER Enter parameter error parameters are correct. CAN bus communication DFB_FROM_ERR_COMMUNICATION Confirm the error record. error Check if the CR address DFB_FROM_ERR_CRADDR...
Page 207
AX Seri e s-St and ard I n st ruct i on s Man ual Ch apt er 6 Description Cause of Error Corrective Action Confirm if iAxis input DFB_DPUCONF_ERR_INVALID_AXIS iAxis input error value is correct. Confirm if iMode input DFB_DPUCONF_ERR_INVALID_MODE iMode input error value is correct.
Page 208
AX Seri e s-St and ard I n st ruct i on s Man ual Ch apt er 6 Description Cause of Error Corrective Action Confirm if diJogSpeed DFB_DPUJOG_ERR_INVALID_JOGSPEED diJogSpeed input error input value is correct. Close the function block, DFB_DPUJOG_ERR_POSITIVELIMIT Exceed the positive limit set to run to the opposite...
Page 209
AX Seri e s-St and ard I n st ruct i on s Man ual Ch apt er 6 Description Cause of Error Corrective Action DFB_DHCCAP_ERR_NOT_SUPPORT Module does not support this Confirm if the module is instruction. the HC module. _MODULE DFB_DHCCAP_ERR_INVALID_INPUT When updating parameters...
Page 210
AX Seri es-St andard I nst ruct i ons Manual Chapt er 6 Description Cause of Error Corrective Action Confirm the input value is DFB_DHCCMPT_ERR_INVALID_ACTIONTABLE aAction input error correct. Confirm the input value is DFB_DHCCMPT_ERR_INVALID_YNOTABLE aY_OutputNo input error correct. Confirm the input value is DFB_DHCCMPT_ERR_INVALID_INTERRUPTNOTABLE aInterruptNo input error correct.
Page 211
AX Seri es-St andard I nst ruct i ons Manual Chapt er 7 Chapter 7 Modbus Communication Instructions 2 0 5...
Page 212
AX Seri es-St andard I nst ruct i ons Manual Chapt er 7 7.1 DFB_COMRS Supported Products • AX Series(Without supporting AX-8) DFB_COMRS: Instruction to send and receive communication data via COM port. FB/FC Instruction Graphic Expression ST Language DFB_COMRS ( bExecute:= , byComPort:= ,...
Page 213
AX Seri e s-St and ard I n st ruct i on s Man ual Ch apt er 7 Name Description Discontinuous time mode: When the time interval between each data receiving is greater than the specified DISCONTINUOUS_TIME duration, the receiving task is completed. Then a completion flag is set to True. The discontinuous time for receiving data can be configured via ParaSet.uiDiscontinuousTime.(*1) Specific end character mode:...
Page 214
AX Seri es-St andard I nst ruct i ons Manual Chapt er 7 Setting Value Name Function Data Type (Default value) stored. (Unit: Byte) Setting values for discontinuous time. uiDiscontinuousTime UINT 2 ~ 3,000(2) (Unit: ms) BYTE byStartCharAmt Size of the start character 1 ~ 255(1) (Unit: Byte) Memory address of the start...
Page 215
AX Seri es-St andard I nst ruct i ons Manual Chapt er 7 Timing Diagram • • Function The FB instruction (DFB_COMRS) is used for sending communication data. You must finish the configuration of COM port of CPU and add Delta_Modbus_Master_COM_Port device before using this instruction (for more details, please refer to chapter 9.2 “Serial Port Communication”...
Page 216
Slave:= , bExecute:= , bAbort:= , iChannelIndex:= , DFB_ ModbusComChannel bBusy=> , bDone=> , bError=> , bAborted=> , ModbusError=> ); In/ Outs • Setting Value Name Function Data Type (Default value) Slave Delta Modbus slave device DFB_ModbusComSlave 2 1 0...
Page 217
AX Seri es-St andard I nst ruct i ons Manual Chapt er 7 Input • Setting Value Name Function Data Type (Default value) Execute the function block. bExecute BOOL True/False(False) (Rising-edge triggered) bAbort No function BOOL 0 ~ 9 iChannelIndex Channel index Output •...
Page 218
AX Seri es-St andard I nst ruct i ons Manual Chapt er 7 Timing Diagram • Function • When the trigger mode of the Modbus slave channel is set to Application, the Modbus request action can be triggered by DFB_ModbusComChannel. Note 1: For more details of Modbus slave COM port configuration, you can refer to chapter 9.2 “Serial Communication”...
Page 219
AX Seri es-St andard I nst ruct i ons Manual Chapt er 7 *Note: The input of Slave would be the name of Modbus slave device. Library DL_ModbusComMaster_AX3.library 2 1 3...
Page 220
AX Seri es-St andard I nst ruct i ons Manual Chapt er 7 7.3 DFB_ModbusRequest Supported Products • AX-308E, AX-364E, AX-300, AX-324N DFB_ModbusRequest: Modbus communication commands. FB/FC Instruction Graphic Expression ST Language DFB_ModbusRequest( byComPort:= , bExecute:= , bAbort:= , usiSlaveAddr:= , uiFunctionCode:= , uiReadOffset:= ,...
Page 221
AX Seri e s-St and ard I n st ruct i on s Man ual Ch apt er 7 Setting Value Name Function Data Type (Default value) 0 ~ 65535 The start address of uiReadOffset UINT memory to be read. Coil: 1 ~ 1920 The data length of the uiReadLen...
Page 222
AX Seri es-St andard I nst ruct i ons Manual Chapt er 7 bExecute shifts to False and the execution of FB is completed. bError When an error occurs in the execution When bExecute shifts to False. conditions or input values for the instruction.
Page 223
AX Seri es-St andard I nst ruct i ons Manual Chapt er 7 7.4 DFB_ModbusRequest2 Supported Products • AX-308E, AX-364E, AX-300, AX-324N DFB_ModbusRequest2: Modbus communication commands. FB/FC Instruction Graphic Expression ST Language DFB_ModbusRequest2( bExecute:= , bAbort:= , byComPort:= , usiSlaveAddr:= , ModbusCommand:= , tResponseTimeout:= ,...
Page 224
AX Seri e s-St and ard I n st ruct i on s Man ual Ch apt er 7 Setting Value Name Function Data Type (Default value) 0: ASCII DFB_MB_ Transmission*3 Transmission mode 1: RTU TRANSMISSION (ASCII) *Note: You need to configure the settings based on the definitions of COM port numbers varied from model to model. The timeout should be greater than the Cycle time set in mdbus Task.
Page 225
AX Seri es-St andard I nst ruct i ons Manual Chapt er 7 Outputs Updating Timing Name Timing for shifting to True Timing for shifting to False bDone When the execution of FB is completed. When bExecute shifts to False. ...
Page 226
AX Seri es-St andard I nst ruct i ons Manual Chapt er 7 Library • DL_ModbusComMaster_AX3.library 2 2 0...
Page 227
AX Seri es-St andard I nst ruct i ons Manual Chapt er 7 7.5 Error codes and Troubleshooting DFB_COM_ERROR_CODE Description Cause of Error Corrective Action DFB_NO_ERROR No errors. Please check whether the setting for timeout is appropriate or not. DFB_RESPONSE_TIMEOUT Slave response timeout ...
Page 228
AX Seri e s-St and ard I n st ruct i on s Man ual Ch apt er 7 Description Cause of Error Corrective Action VALUE slave. proper wiring. DFB_SLAVE_DEVICE_ Please check slave settings and Slave failure FAILURE statuses. Slave has received request, but it DFB_ACKNOWLEDGE takes longer to handle.
Page 229
AX Seri es-St andard I nst ruct i ons Manual Chapt er 7 Description Cause of Error Corrective Action Make sure that DFB_NO_MASTER_ Delta_Modbus_Master_COM_Port Delta_Modbus_Master_COM_Port CONFIG device does not exist. device has been added to the device tree. Please check if the program size DFB_MB_ERROR_CODE_MEMORY_NOT_ENOUGH Not enough system memory.
Page 230
AX Seri es-St andard I nst ruct i ons Manual Chapt er 8 Chapter 8 Network Communication Instructions 2 2 4...
Page 231
AX Seri es-St andard I nst ruct i ons Manual Chapt er 8 8.1 DFB_TCP_Client Supported Products • AX308E, AX-364E, AX-300, AX-324N DFB_TCP_Client: TCP socket client instruction. FB/FC Instruction Graphic Expression ST Language DFB_TCP_Client( bEnable:= , SocketInfo:= , bSend:= , bRecvRestart:= , bBusy=>...
Page 232
AX Seri es-St andard I nst ruct i ons Manual Chapt er 8 tcpClientsocketInfo Setting Value Name Function Data Type (Default value) Server’s IP address byIPAddr ARRAY [0..3] OF BYTE 0: Use a random port number Communication ports on uiLPort UINT 0 ~ 65535...
Page 233
AX Seri e s-St and ard I n st ruct i on s Man ual Ch apt er 8 DFB_SOCK_RECV_MODE Name Description DFB_SOCK_MODE_NO_RECEVI No receiving data mode. Specific data length mode: A specific quantity of data is received and the receiving task is completed. DFB_SOCK_MODE_SPECIFIC_L ENGTH The data length can be specified via uiSetValue.
Page 234
AX Seri es-St andard I nst ruct i ons Manual Chapt er 8 Name Function Data Type Output Range(Default value) (Unit: Byte ) DFB_SOCKET_STATUS Name Description Applicable Protocol SOCKET_CLOSED SOCKET connection is closed. TCP / UDP SOCKET_CONNECTING SOCKET is connecting. SOCKET_CONNECTED SOCKET is connected.
Page 235
AX Seri es-St andard I nst ruct i ons Manual Chapt er 8 Timing Diagram • Function • Use the FB instruction (DFB_TCP_Client) to create TCP connection so as to send or receive TCP data packets. Note: DFB_TCP_Client, DFB_TCP_Server, and DFB_UDP_Socket instructions can be used in a maximum of 32 groups at the same time.
Page 236
AX Seri es-St andard I nst ruct i ons Manual Chapt er 8 Library • DL_EthernetLib.library 2 3 0...
Page 237
AX Seri es-St andard I nst ruct i ons Manual Chapt er 8 8.2 DFB_TCP_Server Supported Products • AX308E, AX-364E, AX-300, AX-324N DFB_TCP_Server: TCP socket server instruction FB/FC Instruction Graphic Expression ST Language DFB_TCP_Server( bEnable:= , SocketInfo:= , bSend:= , bRecvRestart:= , bBusy=>...
Page 238
AX Seri e s-St and ard I n st ruct i on s Man ual Ch apt er 8 tcpServersocketInfo Setting Value Name Function Data Type (Default value) The IP address on Client side allowed to be byIPAddr ARRAY [0..3] OF BYTE [0.0.0.0]: No limit.
Page 239
AX Seri es-St andard I nst ruct i ons Manual Chapt er 8 e.g.: If uiSetValue is set to 16#00000D0A, the end character would be 16#0A.(*1*2) Specific two end characters mode: DFB_SOCK_RECV_MODE_DFB_SOCK_MODE_ The data received ends with the two specific characters (2 Bytes) SPECIFIC_TWO_CHARS The end character can be configured via uiSetValue...
Page 240
AX Seri es-St andard I nst ruct i ons Manual Chapt er 8 DFB_SOCKET_STATUS Name Description Applicable Protocol SOCKET_CLOSED SOCKET connection is closed. TCP / UDP SOCKET_CONNECTING SOCKET is connecting. SOCKET_CONNECTED SOCKET is connected. SOCKET_SENDING SOCKET is sending the data packet. TCP / UDP SOCKET_SENT SOCKET has sent the data packet.
Page 241
AX Seri es-St andard I nst ruct i ons Manual Chapt er 8 Timing Diagram • • Function Use the FB instruction (DFB_TCP_Server) to create TCP connection so as to send or receive TCP data packets. Note: DFB_TCP_Client, DFB_TCP_Server, and DFB_UDP_Socket instructions can be used in a maximum of 32 groups at the same time.
Page 242
AX Seri es-St andard I nst ruct i ons Manual Chapt er 8 • Library DL_EthernetLib.library 2 3 6...
Page 243
AX Seri es-St andard I nst ruct i ons Manual Chapt er 8 8.3 DFB_UDP_Socket Supported Products • AX308E, AX-364E, AX-300, AX-324N DFB_UDP_Socket: UDP socket instruction FB/FC Instruction Graphic Expression ST Language DFB_UDP_Socket( bEnable:= , RemoteInfo:= , bSend:= , bRecvRestart:= , bBusy=>...
Page 244
AX Seri e s-St and ard I n st ruct i on s Man ual Ch apt er 8 udpSocketInfo Name Function Data Type Setting Value (Default value) The slave IP address byIPAddr ARRAY [0..3] OF BYTE [0.0.0.0]: No limit. allowed to be connected.
Page 245
AX Seri e s-St and ard I n st ruct i on s Man ual Ch apt er 8 uiSetValue. (Unit: Byte) Specific end character mode: The data received ends with a specific character (1 Byte). The end character can be configured via uiSetValue.
Page 246
AX Seri es-St andard I nst ruct i ons Manual Chapt er 8 ( 0 ) UINT The execution status of uiRcvLen socket. (Unit: Byte ) DFB_SOCKET_STATUS Name Description Applicable Protocol SOCKET_CLOSED SOCKET connection is closed. TCP / UDP SOCKET_CONNECTING SOCKET is connecting.
Page 247
AX Seri es-St andard I nst ruct i ons Manual Chapt er 8 Timing Diagram • Function • Use the FB instruction (DFB_UDP_Socket) to send or receive UDP data packets. Note: DFB_TCP_Client, DFB_TCP_Server, and DFB_UDP_Socket instructions can be used in a maximum of 32 groups at the same time.
Page 248
AX Seri es-St andard I nst ruct i ons Manual Chapt er 8 Library • DL_EthernetLib.library 2 4 2...
Page 249
, bError=> , bAborted=> , ModbusError=> ); In/ Outs • Name Function Data type Setting value (Default value) Delta Modbus TCP slave device Slave DFB_ModbusTCPSlave Input • Name Function Data type Setting value (Default value) Execute the function block.
Page 250
AX Seri es-St andard I nst ruct i ons Manual Chapt er 8 Name Function Data type Output range (Default value) bError FB instruction error flags. True/False (False) BOOL bAborted No function BOOL DL_MB_ERROR_CODE ModbusError Error codes DFB_MB_ERROR_CODE (UNDEFINED) • Outputs Updating Timing Name Timing for shifting to True...
Page 251
AX Seri es-St andard I nst ruct i ons Manual Chapt er 8 Note 1: For more details of Modbus TCP slave configuration, please refer to chapter 9.3 “Ethernet Communication” in AX-3 Series Operational Manual. Note 2: While using, the channel must be set to “Enable”. Note 3: DFB_ModbusTCPChannel and DFB_ModbusTCPRequest instructions can be used in a maximum of 32 groups at the same time.
Page 252
, bError=> , bAborted=> , ModbusError=> );; In/ Outs • Name Function Data type Setting value (Default value) Delta Modbus TCP slave Slave DFB_ModbusTCPSlave device Input • Name Function Data type Setting value (Default value) Execute the function block.
Page 253
AX Seri e s-St and ard I n st ruct i on s Man ual Ch apt er 8 ModbusCommand Name Function Data Type Output Range(Default value) Supported function codes: 0x01: Read Coils 0x02: Read Discrete Inputs 0x03: Read Holding Registers 0x04: Read Input Registers Modbus function codes FunctionCode...
Page 254
AX Seri es-St andard I nst ruct i ons Manual Chapt er 8 bDone When the execution of FB is completed. When bExecute shifts to False. When the execution of FB is completed. bBusy When FB instruction execution starts. ...
Page 255
AX Seri es-St andard I nst ruct i ons Manual Chapt er 8 Library DL_ModbusTCPMaster.library 2 4 9...
Page 256
AX Seri es-St andard I nst ruct i ons Manual Chapt er 8 8.6 Error Codes and Troubleshooting DFB_SOCKET_ERROR Description Cause of Error Corrective Action DFB_SOCK_ERR_NO_ERROR No errors. Please check if the server exists. DFB_SOCK_ERR Socket connection failed. _INITIALIZE_FAILED ...
Page 257
AX Seri e s-St and ard I n st ruct i on s Man ual Ch apt er 8 Description Cause of Error Corrective Action busy. Please check if the slave Slave device in Gateway fails wires function normally as DFB_GATEWAY_DEVICE_FAILED_TO_RESPOND to respond.
Page 258
AX Seri es-St andard I nst ruct i ons Manual Chapt er 8 Description Cause of Error Corrective Action Please check if the settings of uiReadLen and uiWriteLen Invalid data length setting. DFB_INVALID_LENGTH of DFB_ModbusTCPRequest are correct. Please check if the settings of usiSlaveAddr of Invalid slave station number.
Page 259
AX Seri es-St andard I nst ruct i ons Chapt er 9 Chapter 9 Instructions for Reading and Writing a Memory Card 2 5 3...
Page 260
AX Seri es-St andard I nst ruct i ons Chapt er 9 9.1 DFB_MemoryRead Supported Products • AX-308E, AX-364E, AX-300, AX-324N DFB_MemoryRead: Read a memory card. FB/FC Instruction Graphic Expression ST Language DFB_MemoryRead( bExecute:= , FileInfo:= , DFB_MemoryRead bDone=> , bBusy=>...
Page 261
AX Seri es-St andard I nst ruct i ons Chapt er 9 Name Function Data Type Setting Value (Default value) DFB_DEC_DATATYPE.UDINT_SIZE DFB_DEC_DATATYPE.LINT_SIZE DFB_DEC_DATATYPE.ULINT_SIZE DFB_DEC_DATATYPE.REAL_SIZE DFB_DEC_DATATYPE.LREAL_SIZE (DFB_DEC_DATATYPE.BYTE_SIZE) dwRead The address of the start position to DWORD StartPos read the memory card’s data.* 1 ~ 25,000 dwElement The length of the data in the...
Page 262
AX Seri es-St andard I nst ruct i ons Chapt er 9 Timing Diagram • Function • Use the FB instruction (DFB_MemoryRead) to store the retrieved memory card data in the controller’s memory. Programming Example • This example uses the FB instruction (DFB_MemoryRead) to read the content of Test.csv file in the memory card and store the data in the controller’s WORD-type array variable (ar_wVar0).
Page 263
AX Seri es-St andard I nst ruct i ons Chapt er 9 The content of Test.csv file in the memory card is shown as follows. Values displayed in the Test.csv file Read the four consecutive data starting from data 0 in the Test.csv file via the FB instruction(DFB_MemoryRead), then store the retrieved data in the variable array(ar_wVar0), which the result would be ar_wVar0 := [0,1,2,3].
Page 264
AX Seri es-St andard I nst ruct i ons Chapt er 9 9.2 DFB_MemoryWrite Supported Products • AX-308E, AX-364E, AX-300, AX-324N DFB_MemoryWrite: Write a memory card. FB/FC Instruction Graphic Expression ST Language DFB_MemoryWrite ( bExecute:= , FileInfo:= , DFB_MemoryWrite bDone=>...
Page 265
AX Seri es-St andard I nst ruct i ons Chapt er 9 Name Function Data Type Setting Value (Default value) DFB_DEC_DATATYPE.DINT_SIZE DFB_DEC_DATATYPE.UDINT_SIZE DFB_DEC_DATATYPE.LINT_SIZE DFB_DEC_DATATYPE.ULINT_SIZE DFB_DEC_DATATYPE.REAL_SIZE DFB_DEC_DATATYPE.LREAL_SIZE (DFB_DEC_DATATYPE.BYTE_SIZE) DFB_ACCESS_MODE.NEW DFB_ACCESS_MODE.APPEND The access mode of the DFB_ wAccessMode DFB_ACCESS_MODE.OVERWRITE file to be created. ACCESS_MODE DFB_ACCESS_MODE.INSERT (DFB_ACCESS_MODE.NEW)
Page 266
AX Seri es-St andard I nst ruct i ons Chapt er 9 Outputs Updating Timing Name Timing for shifting to True Timing for shifting to False bDone When FB instruction execution is completed. When bExecute shifts to False. ...
Page 267
AX Seri es-St andard I nst ruct i ons Chapt er 9 Suppose that the written data is ar_wVar0: ARRAY [0..3] OF WORD := [0,1,2,10]. After open the .csv file in the memory card, the content would be displayed as follows. Values displayed in the Test.csv file *Note: In case of wDataMode: =DFB_DATA_MODE.ASCII_MODE, the controller, the controller would write the content of array...
Page 268
AX Seri es-St andard I nst ruct i ons Chapt er 9 9.3 Error Codes and Troubleshooting Description Cause of Error Corrective Action DFB_NO_ERR No errors. Please check external SD card DFB_MEMREAD_ERR_ Internal errors. FAILED Please contact us directly DFB_MEMREAD_ERR_ Please check if the input parameters are Invalid parameter inputs.
Page 269
AX Seri e s-St and ard I n st ruct i on s Ch apt er 9 Description Cause of Error Corrective Action compressing the program. If the problem remains, please contact us directly.。 DFB_MEMREAD_ERR_ Please check if the firmware and the library Invalid handle for the object.
Page 270
AX Seri e s-St and ard I n st ruct i on s Ch apt er 9 Description Cause of Error Corrective Action Please restore the controller to factory settings DFB_MEMWRITE_ERR_ Value out of range (Reset Origin). If the problem persists, please OVERFLOW contact us directly.
Page 271
AX Seri es-St andard I nst ruct i ons Manual Chapt er 10 Chapter 10 High Speed Output Instructions 2 6 5...
Page 272
AX Seri es-St andard I nst ruct i ons Manual Chapt er 10 10.1 DFB_PWM Supported Products • AX-308E, AX-364E, AX-324N DFB_PWM:DFB_PWM is used to generate Pulse-width modulation output signals which is frequency-adjustable. FB/FC Instruction Graphic Expression DFB_PWM ST Language DFB_PWM_instance ( bEnable:=, Pin:=,...
Page 273
AX Seri es-St andard I nst ruct i ons Manual Chapt er 10 Note: AX-332E only support scope: 0-3 AX-332E only support scope: MicroSecond: 1000-2000, MilliSecond: 1-20 • Output Pins Output Value Range Name Function Data Type (Default value) Function block output is valid. bValid BOOL True/False (False)
Page 274
AX Seri es-St andard I nst ruct i ons Manual Chapt er 10 Troubleshooting If an error occurs during the execution of the instruction, Error will change to True, and the axis motion will stop. Refer to ErrorID (Error Code) to address the problem. Programming Example This programming example uses 8 sets of PWM output sine wave PWM, and the phase of each set is 45 degrees, which will make OUT LED appear water lamp behavior on the machine.
Page 275
AX Seri es-St andard I nst ruct i ons Manual Chapt er 10 10.2 Error Codes and Troubleshooting Description Cause of Error Corrective Action Firmware does not DFB_PWM_UNSUPPORT_FW_VERSION Update firmware match. Pin number is out DFB_PWM_PIN_ID_OVER_RANGE Enter an appropriate pin ID of range.
Page 276
AX Seri es-St andard I nst ruct i ons Manual Chapt er 11 Chapter 11 Additional Instructions 2 7 0...
Page 277
AX Seri es-St andard I nst ruct i ons Manual Chapt er 11 11.1 DFC_LogGetSize Supported Products • , AX-364E, AX-300, AX-324N AX-308E DFC_LogGetSize: Read the size of controller’s log files. FB/FC Instruction Graphic Expression ST Language DFC_LogGetSize( DFC_LogGetSize dwLogNum:= , ErrorID=>...
Page 278
AX Seri es-St andard I nst ruct i ons Manual Chapt er 11 Library • DL_LogDmp_AX3.library 2 7 2...
Page 279
AX Seri es-St andard I nst ruct i ons Manual Chapt er 11 11.2 DFB_LogDump Supported Products • , AX-364E, AX-300, AX-324N AX-308E DFB_LogDump: Read the log files of the controller. FB/FC Instruction Graphic Expression ST Language DFB_LogDump( bExecute:= , pDmpPos:= , dwLogNum:= , DFB_ LogDump...
Page 280
AX Seri es-St andard I nst ruct i ons Manual Chapt er 11 Name Timing for shifting to True Timing for shifting to False bDone When FB instruction execution is completed. When bExecute shifts to False. When FB instruction execution is completed. ...
Page 281
AX Seri es-St andard I nst ruct i ons Manual Chapt er 11 11.3 DFB_FTPClient Supported Products • AX-308E, AX-364E, AX-300, AX-324N DFB_FTPClient:Access FTP server and upload and download data. FB/FC Instruction Graphic Expression ST LANGUAGE DFB_FTPClient( bConnect:= , bExecute:= , fileSpace:= , connectInfo:= ,...
Page 282
AX Seri es-St andard I nst ruct i ons Manual Chapt er 11 Name Description EXTERNAL_SD External memory card INTERNAL_MEM Internal memory PCI_MEM (*1) PCI memory USB_PORT0 (*1) USB port0 USB_PORT1 (*1) USB port1 USB_PORT2 (*1) USB port2 USB_PORT3 (*1) USB port3 *Note 1: This memory location cannot be selected in this Function block.
Page 283
AX Seri es-St andard I nst ruct i ons Manual Chapt er 11 Outputs Updating Timing Name Timing for shifting to True Timing for shifting to False When FB instruction execution is bDone When bExecute shifts to False. ...
Page 284
AX Seri es-St andard I nst ruct i ons Manual Chapt er 11 This example will export the file downloaded from the FTP server to the variable. When the user sets bini to True, the memory card reading Instruction setting is completed. After the setting is completed, Var_bExecute is set to True, that is, the data in the data.csv file Export the array "Array_Word".
Page 285
AX Seri es-St andard I nst ruct i ons Manual Chapt er 11 Library • DL_FtpClient.library 2 7 9...
Page 286
AX Seri es-St andard I nst ruct i ons Manual Chapt er 11 11.4 Error Codes and Troubleshooting • DL_LOGDMP_ERROR Description Cause of Error Corrective Action DFB_NO_ERR No errors. DFB_DMP_ERR_FAILED Internal errors. Please contact us directly DFB_DMP_ERR_ Invalid parameter inputs. Please check if the input parameters are correct.
Page 287
AX Seri e s-St and ard I n st ruct i on s Man ual Ch apt er 11 Description Cause of Error Corrective Action DFB_DMP_ERR_NOT_ Please check if the firmware and the library The function is not supported. SUPPORTED version are supported.
Page 288
AX Seri e s-St and ard I n st ruct i on s Man ual Ch apt er 11 Description Cause of Error Corrective Action DFC_ GETSIZE _ERR_INVALID Please check if the firmware and the library Invalid handle for the object version are supported.