Programmable step motor controller data communications protocol (44 pages)
Summary of Contents for Smart Motor Devices SMSD-1.5Modbus ver.3
Page 1
Smart Motor Devices User manual STEPPER MOTOR CONTROLLERS SMSD-1.5Modbus ver.3 SMSD-4.2Modbus SMSD-8.0Modbus 2022...
Page 2
Common enumerations Manufacturer information Smart Motor Devices adheres to the line of continuous development and reserves the right to make changes and improvements in the design and software of the product without prior notice. The information contained in this manual is subject to change at any time and without prior notice.
Contents The intent of the controller ........................ 5 Technical specifications ........................10 Operation sequence .......................... 12 3.1. The principle of operation of relay-contact circuits and ladder diagrams in the controller ..12 3.2. Differences between logic of real relay-contact circuits and ladder diagrams in the controller 3.3.
Page 4
SMSD-1.5Mus user manual Discrete inputs ..........................133 General purpose data registers D192...D255 ................. 133 General purpose data registers D256...D319 ................. 133 Non-volatile data registers D320...D327 ..................134 Non-volatile data registers D328...335 ..................134 Hardware counters ......................... 134 Analog-to-digital converters ......................134 Hardware and software versions ....................
1. The intent of the controller The controller is designed to operate with stepper motors. The device can be controlled by PLC (via RS-485 Modbus ASCII/RTU) or can operate in a standalone mode according to the preset execut- ing program. The controller provides fullstep operating or microstepping up to 1/256.
Page 6
SMSD-1.5Mus user manual Fig. 2a – Terminal assignment – driver control mode Tallinn Science Park Tehnopol, Phone: + 372 6559914, Akadeemia tee 21/6, 12618, Tallinn, Estonia e-mail: mail@smd.ee url: https://smd.ee...
Page 7
Fig. 3b – Terminal assignment – speed control mode Tallinn Science Park Tehnopol, Phone: + 372 6559914, Akadeemia tee 21/6, 12618, Tallinn, Estonia e-mail: mail@smd.ee url: https://smd.ee...
Page 8
SMSD-1.5Mus user manual Fig. 4c – Terminal assignment – user program control mode Tallinn Science Park Tehnopol, Phone: + 372 6559914, Akadeemia tee 21/6, 12618, Tallinn, Estonia e-mail: mail@smd.ee url: https://smd.ee...
Page 9
The Fig. 1 shows the front panel of the controller with control and indication elements. The PWR indicator indicates the presence of supply voltage. RUN indicates the current state of the con- troller (RUN or STOP). In PROG mode (execution of a user program) and SPD mode (speed control), the active state of RUN indicator indicates the execution of the program, the inactive state indicates stop state.
SMSD-1.5Mus user manual 2. Technical specifications Characteristic Value SMSD-1.5Modbus ver.3 Supply voltage, VDC SMSD-4.2Modbus and SMSD-8.0Modbus SMSD-1.5Modbus ver.3 0.15 Max. output current per SMSD-4.2Modbus phase, A SMSD-8.0Modbus High level of logic inputs, VDC Low level of logic inputs, VDC Recommended voltage (best response time) of logical inputs, VDC Max.
Page 11
Additional information № Characteristic Value Possible baud rates for RS-485 data transmission 1200, 2400, 4800, 9600, 14400, 19200, 38400, 57600, 115200, 128000, 256000 Possible microstepping settings 1/1, 1/2, 1/4, 1/8, 1/16, 1/32, 1/128, 1/256 Communication protocol Modbus RTU, Modbus ASCII Programing language IL (Instruction List), LD* (Ladder Diagram) –...
SMSD-1.5Mus user manual 3. Operation sequence The sequence of the controller operation is the next: — reading of external devices (logic inputs, Modbus Coils); — user program processing; — setting of new states of output devices (logic outputs, Modbus Discrete Inputs, executing of motion).
Page 13
The second segment of the circuit consists of one normally-closed contact X1 and coil Y1, which determines the state of output Y1. In the normal state of contact X1, output Y1 will be closed (logical "1"). When the state of contact X1 changes to open, the output Y1 also changes its state to open.
SMSD-1.5Mus user manual 3.2. Differences between logic of real relay-contact circuits and ladder diagrams in the controller All specified control processes are performed simultaneously (in parallel) in conventional re- lay-contact electrical circuits. Each change in the state of the input signals immediately affects the state of the output signals.
puts occur without changing their physical condition. During this stage, the state of physical and virtu- al inputs may change, but the next buffering of the updated state will occur at the first stage of the next cycle of the user program. At the third stage the controller changes the state of the physical and virtual outputs.
SMSD-1.5Mus user manual Timer Time relay. In the program can be used for storage of current tim- er value and have 16-bit format. Also these operands can be used as contacts and take on one of two states: 0 or 1 Addressing is decimal: T0, T1 ...Т64 Counter Counter is used to implement counting.
Page 17
Input pulse contact – rising-edge X, Y, M, T, C Input pulse contact – falling-edge X, Y, M, T, C Output signal (coil) Y, M Refer to chapter Refer to chapter Basic and application instructions 7.Application 7.Application instructions instructions Logic inversion Input contacts can be combined into serial and parallel blocks: Serial connections: ANDP...
Page 18
SMSD-1.5Mus user manual Fig. 17 – sequence of a program Symbols of input signals with a rising edge (when a signal is switched from 0 to 1) and with a falling edge (when a signal is switched from 1 to 0) are explained below: Rising edge contact Falling edge contact Fig.
The ORB command performs a LOGIC OR operation on the execution conditions produced by two logical blocks. Fig. 20 – ORB instruction 3.5. Convert relay contact circuits (LD) to mnemonic code (IL) The figure below shows a program presented in the form of relay contact symbols (LD) and a list of instructions - mnemonic code (IL).
Page 20
SMSD-1.5Mus user manual Relay contact circuits (LD) Block Block Serial connection of blocks Block The state of the output will be set according to the inputs states during the program executing Parallel connection of blocks Branching Block Setting the output and marker Block Setting the...
Page 21
Example 1 The ladder diagram below can be converted into instruction list in two different ways, but the result will be identical (Fig. 22). The first encoding method is most preferable as the number of logical blocks is unlimited. The second method is limited by maximum logic blocks number (max blocks number is 8). Method 1 Method 2 Fig.
SMSD-1.5Mus user manual Program: 3. The controller executes the program starting from line 0 and stores the state of all oper- ands in objects memory. Outputs: 4. After executing the END instruction the state of the output relays Y is written to the memory of the outputs and the states of the output contacts will be changed.
Addressing and function of timers [Т] 4.4. Some control processes require a time relay. Many relay-controlled systems use time relays which switches on delay. The controller uses internal memory elements for these purposes, called tim- ers. The characteristics of the timers can be determined in the program. Addressing of timers is decimal.
SMSD-1.5Mus user manual Accumulative timer In addition to general purpose timers, the controller has accumulative timers, which, after disabling the control logical connection, save the accumulated time value. Value of timer register Fig. 25 – Accumulative timer operating principle 4.5. Addressing and function of counters [C] It is necessary to count impulses (add or subtract) in some control processes.
Page 27
The counter is reset when X0=1: the cur- rent value of register C0 = 0, contact C0 is open. After switching X1 from 0 to 1, the value of C) increments by one. setting When register value С0 = 5, contacts С0 and Y0 Current are closed, all next pulses at input are not counted.
SMSD-1.5Mus user manual The discrete inputs X0 and X1 refers to the counters C64 and C65 accordingly. C64 counts both rising-edges and falling-edges of pulses, C65 counts falling-edges of pulses. The discrete inputs X0 and X1 refers to the counter C64 and operate as encoder. A quad- rature signal is applied to the inputs.
Page 29
There are the next data register types: General purpose data registers: These registers are used during user program executing, the data are not saved when the power is off. Non-volatile data registers: The data in these registers are saved in the controller memory when the power is off. The memory power supply is provided by internal source CR2032.
SMSD-1.5Mus user manual 4.7. Index registers [A], [B] Index registers are used to index operand addresses and change constant values. The index registers are 16-bit registers. In 32-bit instructions index registers A and B are used in combination. A contains 16 low-order bits, B contains 16 high-order bits.
4.8. Pointers [P], [I]. 32 points (P0…P31) P Instruction pointers CALL, CJ Labels or marks for commands of transition or calling subprograms Interruptions Communication I0 Max. Labels for subprogram for pro- cessing of interruptions I1…I100 (Max. 4 Timed points points) I1000…I1007 External Driver...
Page 32
SMSD-1.5Mus user manual Interruption pointers (I) are used with instructions EI, DI, IRET for interrupting of main pro- gram executing. There are the following types of interruptions: 1. Communication interruption: if the controller receives a broadcast frame via Modbus proto- col, it immediately (regardless of the scan cycle) goes to the interrupt processing subpro- gram which is marked with the pointer I0.
5. Error codes If the "ERR" LED is on after loading and running the user program, this means that the user program contains an error: a grammatical error or incorrect operand error. Each error that occurs in the controller is recorded in a special register (step number and error code are recorded). This information can be read using a PC or PLC.
Page 34
SMSD-1.5Mus user manual Error Description code 2013h Brunching stack overflow, instruction MPS. 2016h Brunching stack is empty, instructions MRD, MPP. 2015h Main stack overflow, instructions MRD, MPP. 2014h Signal type is not recognized when assigning selector, instructions MRD, MPP. 2017h Stack overflow, instruction NEXT.
Page 35
Error Description code 2021h Instruction CALL/CALLP, stack overflow. 2003h Incorrect operand, instruction OUT. 200Ah Incorrect operand, instruction SET/RST. 2005h Instruction SET can not be applied to operand C. 2006h Instruction SET can not be applied to operand T. 2007h Instruction SET can not be applied to operand D. 2008h Instruction SET can not be applied to operand A.
Page 36
SMSD-1.5Mus user manual Error Description code 203Dh Instruction INT, type of 2d operand is incorrect. 203Eh Instruction PWM, the third operand is not applicable for PWM signal output. 203Fh Instruction PWM, type of 3d operand is incorrect. 2041h Instruction DECMP, type of 1st operand is incorrect. 2040h Instruction DECMP, type of 2d operand is incorrect.
Page 37
Error Description code 400Ch External interruptions queue overflow IN7. 400Dh Driver interruptions queue overflow. 400Eh Motor status change interruption queue overflow. 2054h Instruction TRD, incorrect operand type. 2055h Instruction TWR, incorrect operand type. 3000h Stacks are empty, no signal value. 3001h The main stack is empty, no signal value.
SMSD-1.5Mus user manual 6. Basic instructions Instruction Function Normally open contact Operand ● ● ● ● ● Description: Instruction LD is used as a normally open contact for programming of starts of logical chains. It is located at left in contact scheme and connected directly to the power bus line. Use: The instruction LD X0 "normally open contact X0"...
Page 39
Instruction Function Series connection - normally open contact (logic AND) Operand ● ● ● ● ● Description: Instruction AND is used as a series connected normally open contact for programming of logi- cal multiplication operation (AND). The instruction represents a logical operation and therefore cannot be programmed at the beginning of the sequence.
Page 40
SMSD-1.5Mus user manual Instruction Function Parallel connection – normally open contact (logic OR) Operand ● ● ● ● ● Description: The instruction OR is used as a parallel connected normally open contact for programming of logical addition (OR). The instruction represents a logical operation and therefore cannot be pro- grammed at the beginning of the sequence.
Page 41
Use: The instruction "Parallel connection – normally closed contact X1" creates a parallel logical connection with contact Х0 and used to perform the operation of logical instruction NOR (OR NOT). If the input Х0 is "1" or the input X1 is "0" (one or both conditions at the same time), then the output Y1 turns to the state "1".
Page 42
SMSD-1.5Mus user manual Instruction Function «OR»-block: parallel connection of blocks Description: — The instruction ORB is used for parallel connection of two or more series connected contacts or blocks. If several series connected blocks are connected in parallel, it is nec- essary to add ORB instruction after every block.
Page 43
Description: — The instructions MPS, MRD, МРР are used to create levels of logical connections (for example, after one initial logical expression, create several logical expressions at the output, i.e., turn on several output coils). — Using the MPS instruction, the previous result of logical connections (processing of a logical expression) is stored.
Page 44
SMSD-1.5Mus user manual Before executing the next instruction, an intermediate result at the 1st place of the memory of logical connections is read. The output Y2 is set. The operation at the 1st level of intermediate results is completed, and the memory of logical connections is cleared. Instruction Function Output coil...
Page 45
Description: — The state of operand can be set directly by the SET instruction. — Operands Y and M can be turned on by the SET instruction. — As soon as the entry condition is established for the SET instruction (signal "1"), the corresponding operand turns on.
Page 46
SMSD-1.5Mus user manual Instruction Function Timer (16-bit) Operands ● ● ● ● ● ● ● ● Description: — The Instruction TMR is used to set a signal state (turn on/off) depending on the result of logical connections after a period of time specified in the instruction. —...
Page 47
Usually, to use 32-bit instructions, the prefix "D" is added to the name – only a 32-bit version of the instruction exists. of the instruction. For impulse instructions with a one scan "lifetime", the postfix "P" is added. The concept of a single scan should be attributed to the used oper- and.
Page 48
SMSD-1.5Mus user manual Instruction Function Beginning of logical expression with a rising edge polling (impulse) Operand ● ● ● ● ● Description: — The instruction LDP is used to program the pulse start of a logical connection. — The instruction LDP must be programmed at the beginning of the circuit. —...
Page 49
Use: The instruction "LDF Х0 starts the series logical connection. If the input X0 changes from "1" to "0" (and Х1 = 1), then the output Y1 keeps the state "1" during one scan. Instruction Function ANDP «AND» with rising edge polling (impulse) Operand ●...
Page 50
SMSD-1.5Mus user manual Use: ANDF X1 The instruction "ANDF X1" creates a series logic connection. If input X1 changes from "1" to "0" (and Х0 = 1), then the output Y1 keeps state "1" during one scan. Instruction Function «OR» with rising edge polling (impulse) Operand ●...
Page 51
Use: The instruction "ORF X1" creates a parallel logic connection. The output Y1 will keep state "1" during one scan if the input X1 changes from "1" to "0" or Х0 = 1. Instruction Function End of program Description: The end of a user program and transition to the beginning of the program (step 0). —...
Page 52
SMSD-1.5Mus user manual Use: FEND FEND Instruction Function Empty line in the program Description: An empty line without logical functions can later be used for any instructions, for example, during assembling of a program or for debugging. — After successful assembling a program, NOP instructions should be deleted, otherwise they uselessly extend the time of program cycle.
Page 53
Use: If the input Х0 = 0, the output Y1 = 1. If the input Х0 = 1, the output Y1 = 0. Instruction Function Addressing a jump point in a program or subprogram 0…31 Operand Description: — The P instruction is used to indicate a transition point for instructions CJ, CALL. —...
Page 54
SMSD-1.5Mus user manual It is possible to organize up to 4 timed interruptions in the controller In, where n is the interrup- tion handler call period of 10ms and can have a value from 1 to 100. So, = , , where T is a de- sired period of call of the handler (measured as ms).
7. Application instructions Instruction Operands Associated Function variants Conditional jump Pointers P are used as operands. The operands can be indexed (A, B) Description: Using the CJ instruction, a part of the program can be skipped. When applying this instruction, the execution time of the program can be reduced.
Page 56
SMSD-1.5Mus user manual IRET End of interruption handler Description: The instruction IRET defines the end of interruption processing (refer to the section 4.8 for more details). Note: this instruction doesn’t require entry condition (contacts are not needed). Global interruptions enabling Description: The instruction EI enables interruption processing (refer to the section 4.8 for more details).
Page 57
Start of a loop FOR-NEXT ● ● ● ● ● ● ● Note: this instruction doesn’t require entry condition (contacts are not needed). NEXT End of a loop FOR-NEXT Note: this instruction doesn’t require entry condition (contacts are not needed). Cycles The instructions FOR/NEXT are used for programming of cyclic repetitions of program parts (program loop).
Page 58
SMSD-1.5Mus user manual NEXT NEXT Comparison of numerical data ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● Note: operand D takes 3 addresses. Description: Comparison of two numerical data values (more, less, equal). —...
Page 59
Example: Y0: is turned on if K10 > data register D10, Y1 and Y2 are turned off. Y1: is turned on if K10 = data register D10, Y0 and Y2 are turned off. Y2: is turned on if K10 < data register D10, Y0 and Y1 are turned off. Y0, Y1, Y2 are not changed if the entry condition X10=0.
Page 60
SMSD-1.5Mus user manual (S1) ≤ (S) ≤ (S2) → (D + 1) (S) > (S2) → (D + 2) — If value in (S1) more than value in (S2), all contact in operand (D) are reset. To reset the comparison results use instructions RST, ZRST. Data transfer ●...
Page 61
DMOV DMOV BMOV Block data transfer ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● Description: Copy data packet. The shift during the operation is carried out both for the source operand (S) and for the destination operand (D) to (n) block elements, depending on the instruction (16 bit or 32 bit).
Page 62
SMSD-1.5Mus user manual FMOV Transferring data to multiple addresses ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● Description: The value of the source operand (S) are copied to (n) destination operands (D) of the same types.
Page 63
Example: If X0 = 1 the data exchange is done: Addition of numerical data ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● Description: — Binary data in the source operands (S1) and (S2) are added together. The result of the addition is stored in the destination operand (D).
Page 64
SMSD-1.5Mus user manual DADD (D31, D30) + (D41, D40) = (D51, D50) If X0 is turned on, the result of addition the values of registers (D31, D30) and (D41, D40) is saved in the data registers (D51, D50). Subtraction of numerical data ●...
Page 65
If Х0 is turned on, the difference between the data values in the registers (D31, D30) and (D41, D40) is calculated. The result is saved in the data registers (D51, D50). Multiplication of numerical data ● ● ● ● ● ●...
Page 66
SMSD-1.5Mus user manual Division of numerical data ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● Description: — The value of the source operand (S1) is divided by the data value from the source oper- and (S2).
Page 67
Calculation of the remainder of the division ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● Description: — The value of the source operand (S1) is divided by the data value from the source oper- and (S2).
Page 68
SMSD-1.5Mus user manual Increment numerical data ● ● ● ● ● Description: The value in the operand (D) is incremented by 1. Example: DINCP The value in the data registers (D1, D0) is incremented by 1 if the entry condition X0 is turned on.
Page 69
WAND Logical multiplication of numerical data (operation "AND") ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● Note: WAND is a 16 bit instruction, DAND is a 32 bit instruction. Description: —...
Page 70
SMSD-1.5Mus user manual Logical addition of numerical data (OR op- eration) ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● Note: WOR is a 16 bit instruction, DOR is a 32 bit instruction. Description: —...
Page 71
WXOR Logical operation "exclusive OR" ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● Note: WXOR is a 16 bit instruction, DXOR is a 32 bit instruction. Description: — The operation "logical exclusive OR" for numeric data is a bit operation (performed bit by bit) —...
Page 72
SMSD-1.5Mus user manual Logical negation ● ● ● ● ● Description: Logical negation operation (inversion of all bits in binary form and addition with 1) for numer- ical data. Example: If Х0 = 1, the operation of logical negation and modification is performed with value in the op- erand D0.
Page 73
Description: Bits rotation on (n) places to the left. Example: If Х0 = 1, the bits of the value in the data register D10 rotate on 4 bits to the left and the value is modified. rotation to the left high bit low bit high bit...
Page 74
SMSD-1.5Mus user manual rotation to the right high bit low bit high bit low bit ZRST Group reset of operands ● ● ● ● ● ● ● ● ● ● ● ● ● ● Description: The values of several operands following one after another (operand region) can be reset by the instruction ZRST.
Page 75
Decoder 8 → 256 bit DECO ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● Note: If (D) is a bit operand: (n) = 1…8. If (D) is a numeric operand: (n) = 1…4. If (n) is out of possible range, the instruction is executed with the maximum possible (n) depending on (D).
Page 76
SMSD-1.5Mus user manual If (n) = 3, the input operands Х0, X1 and Х2 are processed. 2 = 8 addresses are used as a destionation M10…M17. Value of input operands is 1 + 2 = 3. So the 3d address of the destination, i.e. relay M13 is turned on.
Page 77
When specifying the bit operand in (S), the following must be observed: 1 ≤ (n) ≤ 8. When specifying the numeric operand in (S), the following must be observed: 1 ≤ (n) ≤ 4. (S) is a start address of operands whose data should be encoded. (D) is a start address the destination operand.
Page 78
SMSD-1.5Mus user manual Sum of single bits ● ● ● ● ● ● ● ● ● ● ● ● Description: — Determining the number of active bits in a data word. The instruction counts turned on bits in (S). — The result value is written to (D). If a 32-bit instruction is processed, then the high 16 bits (D + 1) of the destination operands (D) are set to zero, since the maximum number of turned on bits in (S) is 32.
Page 79
The square root of the value in the operand (S) is being calculated, the result is be rounded off to an integer and written to the operand (D). The operation is performed on signed integer data types. Attention! The square root of a negative number always leads to an error. Convert integer to floating point ●...
Page 80
SMSD-1.5Mus user manual Example: t – pulse width - sampling time T – period Let the sampling period be 100 μs. When the input condition X0 = 1 is satisfied, the PWM sig- nal with a period of 8 x 100 μs = 0.8 ms and a pulse duration of 3 x 100 μs = 0.3 ms appears at the out- put Y6.
Page 81
Raising to a power ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● Description: (2) Raising to a power: ( ) = (1) The instruction POW rises the value in the operand (S1) to the (S2) power. The result is saved in the operand (D).
Page 82
SMSD-1.5Mus user manual — If the number in (S2) is greater than the number in (S1), then the bit operand ((D) +2) is turned on. — The polled output operands remain turned on after disabling the entry conditions of the instruction DECMP.
Page 83
Description: Comparison of the floating point number with the selected (indicated) area and the output of the comparison result. — The instruction DEZCP compares the floating point number in the operand (S1) with the area between (S1) and (S2). — The comparison result is stored in 3 successive addresses. —...
Page 84
SMSD-1.5Mus user manual Examples: When the input X0 is turned on, the floating-point number in (D3, D2) is added to the floating- point number in (D1, D0). The result is saved in (D11, D10). When the input X2 is turned on, the floating-point number in (D11, D10) is added to the con- stant F1.568.
Page 85
Examples: When input X0 is turned on, the floating point number in (D3, D2) is subtracted from the float- ing point number in (D1, D0). The result is saved in (D11, D10). When the input X2 is turned on, the floating-point number in (D11, D10) is subtracted from the constant F1.568.
Page 86
SMSD-1.5Mus user manual When input X0 is turned on, the floating point number in (D1, D0) is multiplied by the floating point number in (D3, D2). The result is saved in (D11, D10). When input X2 is turned on, the constant F1.568 is multiplied by the floating point number in (D11, D10).
Page 87
When the input X2 is turned on, the floating-point number in (D1, D0) is divided by the con- stant F1.568. The result is saved in (D11, D10). DESQR Square root in floating point format ● ● ● ● ● Note: —...
Page 88
SMSD-1.5Mus user manual When the input X0 is turned on, the square root of the constant F16 is calculated. The result is saved in (D11, D10). DEPOW Raising to a power in floating point format ● ● ● ● ● ●...
Page 89
— The source operand is always a double word. — When using the instruction INT, the word operand is the operand of the destination. — When using the DINT instruction, the destination operand is a double word operand. — The INT instruction is the inverse function of the FLT instruction. Example: When input X0 is turned on, the floating point number in (D0, D1) is rounded to the nearest lower integer value.
Page 90
SMSD-1.5Mus user manual Recording time data ● Note: The operand (S) takes 3 consecutive addresses. Description: The instruction TWR is used to change the real-time data (hours, minutes, seconds). The data is taken from 3 consecutive addresses, specified in (S). If the values in (S) exceed the allowed range of values, an error arises.
Page 91
Example: When input X0 is turned on, real-time data is read and saved in the registers D0 ... D2 Register Function Value Example 1…31 Month 1…12 26.01.22 Year 21…99 22 Recording date data ● Note: The operand (S) takes 3 consecutive addresses. Description: The instruction DWR is used to change the date data (day, month, year).
Page 92
SMSD-1.5Mus user manual Contact type logical operations ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● Note: — The symbol # is &, |, ^. — Bit operands are taken by 16 or 32, depending on the type of instruction, and are con- verted to an integer data type for further processing.
Page 93
AND# Contact type logical operations Serial connection ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● Note: — The symbol # is &, |, ^. — Bit operands are taken by 16 or 32, depending on the type of instruction, and are con- verted to an integer data type for further processing.
Page 94
SMSD-1.5Mus user manual Contact type logical operations Parallel connection ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● Note: — The symbol # is &, |, ^. — Bit operands are taken by 16 or 32, depending on the type of instruction, and are con- verted to an integer data type for further processing.
Page 95
Contact type comparison operations ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● Note: — The symbol # is =, >, <, <>, ≤, ≥. — Bit operands are taken by 16 or 32, depending on the type of instruction, and are con- verted to an integer data type for further processing.
Page 96
SMSD-1.5Mus user manual AND* Contact type comparison operations Serial connection ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● Note: — The symbol # is =, >, <, <>, ≤, ≥. —...
Page 97
Contact type comparison operations Parallel connection ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● Note: — The symbol # is =, >, <, <>, ≤, ≥. — Bit operands are taken by 16 or 32, depending on the type of instruction, and are con- verted to an integer data type for further processing.
SMSD-1.5Mus user manual 8. Instructions for stepper motor driver control The stepper motor driver is controlled by commands that specify the parameters of rotation or movement. All commandss are divided into two groups: RUN and MOVE. The RUN group is de- signed to control the current speed of the drive, and MOVE - to control movement.
Page 99
Address Object Sevice register Size Description type (bit) Number Name 5006h Holding D363 Current position. The unit of value is Registers equal to the displacement by the amount of one microstep. 5008h Input D365 U_POS The current microstep position in four Registers full steps.
Page 101
Address Object Sevice register Size Description type (bit) Number Name 5016h Holding D382 CMIN_SPD_EN "1" - use automatic calculation of the Registers start and final speed of movement for the MOVE group commands. "0" - use MIN_SPEED as the start and final speed.
Page 102
SMSD-1.5Mus user manual Address Object Sevice register Size Description type (bit) Number Name 501Ch Coils OUT_OF_LIM_MAX_SPD_ 5-bit of the register D380. ERROR_SET_HIZ set, error OUT_OF_LIM_MAX_SPD_ERROR_ SET_HIZ (exceeding the maximum possible speed – the register D381) causes de-energizing the motor (HiZ state).
Page 103
Address Object Sevice register Size Description type (bit) Number Name 502Bh Coils OUT_OF_LIM_MIN_SPD_ERROR 4-bit of the register D381 OUT_OF_LIM_ MIN_SPD_ERROR – set speed is less than minimum. 502Ch Coils OUT_OF_LIM_MAX_SPD_ERRO 5-bit of the register D381 OUT_OF_LIM_ MAX_SPD_ERROR – exceeding the maximum possible speed.
Page 104
SMSD-1.5Mus user manual Address Object Sevice register Size Description type (bit) Number Name 503Ch Discrete BUSY_MOVE 5-bit of the register D371. Inputs Flag of the impossibility of applying the commands of the MOVE group. 503Dh Discrete BUSY_RUN 6-bit of the register D371. Flag of the Inputs impossibility of using the commands of the RUN group.
Page 105
Movement command (CMD-register) Value Group Name Description Rotation according set speed SPEED, ac- celeration ACC, deceleration DEC, direc- tion DIR. MOVE MOVE Displace by the specified number of steps TARGET_POS with the given motion parameters SPEED, ACC, DEC, DIR. MOVE GOTO Move to the specified position TAR-...
Page 106
SMSD-1.5Mus user manual RELEASE Motion with a set speed SPEED, ACC acceleration, DIR direction until the sen- sor SW_INPUT triggers on the falling edge with an initial check of the input level and then turn to holding mode. FRONT_RELEASE Motion with a set speed SPEED, accelera- tion ACC, direction DIR until the sensor SW_INPUT triggers on the falling edge and then turn to holding mode.
Page 107
Example: SSTOP The motor stops according to the DEC pa- rameter and then goes into holding mode. Writing “1” to an object (even if it is not reset) applies mo- 5104h Coils tor braking according to DEC and then goes to holding mode, reset is ignored.
Page 108
SMSD-1.5Mus user manual Example: SHIZ HSTOP Immediate stops the motor and then goes to holding mode. Writing “1” to an object (even if it is not reset) immediately 5102h Coils stops the motor and then goes to holding mode, reset is ig- nored.
9. Communication parameters The controller has a USB and RS-485 interfaces, both have the same access to registers and bit operands. The USB interface is a virtual COM port (VCP), it is mainly intended for configuring of the controller and recording of user program, therefore it has fixed communication parameters: Modbus ASCII, ID 1, 115200 baud, 7, Even, 1.
Page 111
Error code Description 0001h Memory allocation error. 0002h Checksum error. 0003h An error occurred while receiving and processing a broadcast packet. 0004h Frame size mismatch. 0005h Function error (0Fh). Not all bits have been overwritten.. 0006h Function error (10h). Not all registers have been overwritten.. 0007h Function error (17h).
SMSD-1.5Mus user manual Setting the real time clock The controller has a real-time clock, which is powered by an internal source (CR2032 battery), which ensures the operation of the clock while the main power is off. The same battery is used for the operation of non-volatile registers and safety settings of the controller communication parameters.
A user program - loading to and reading from the controller 11.1. User program uploading/downloading procedure The controller has two areas for downloading programs: general purpose and special. The general purpose area is intended for loading a user program with maximum length up to 59752 lines (the area is empty by default).
Page 114
SMSD-1.5Mus user manual All supported by the controller instruction codes are presented in the «Appendix B. List of in- structions». Use it when assembling a user program or use the supplied PC software for programming the controller. 1) Make sure that the controller is in the STOP mode. Changing the user program in the RUN mode is impossible.
Page 117
The operand types codes are shown in the table below: Operand Code 11.2. Block uploading/downloading of a user program A user program can be read and write faster if use block uploading/downloading. The proce- dure of the block uploading/downloading of a user program is the similar to the section «User program uploading/downloading procedure», but with the following differences: To write a user program Start of the procedure...
Page 118
SMSD-1.5Mus user manual The structure of the block uploading/downloading sector is below: F401h Instruction code F402h Operand value F403h F404h Index value F405h Operand 1 Operand type Index type F406h F407h F408h F409h Operand 2 F40Ah Operand 3 F40Eh Operand 4 Instruction line 1 F412h Instruction code...
Page 119
Error code Description 0001h Read protection for the main program has not been set. 0002h Read protection for the service program has not been set. 0003h Failed to erase the main program sector. 0004h Failed to erase the service program sector. 0005h Failed to write the instruction to the main program.
SMSD-1.5Mus user manual 12. Speed control mode This mode is intended for controlling the rotation speed of a stepper motor using the built-in potentiometer “SPEED” (2), buttons or an encoder. To enter the speed control mode, set the controller to the STOP state, then use the mode select button to set the SPD mode.
Page 121
Fig. 35 – Connection of control elements Tallinn Science Park Tehnopol, Phone: + 372 6559914, Akadeemia tee 21/6, 12618, Tallinn, Estonia e-mail: mail@smd.ee url: https://smd.ee...
Page 122
SMSD-1.5Mus user manual Attention Turning the controller to the RUN mode while SLOW STOP and HARD STOP switches are closed and ENABLE switch is open, will cause the motor rotation. To avoid uncontrolled rotation, turn the “SPEED” poten- tiometer to the minimum position or change the position of any of the above switches to the opposite one indicated in the diagram.
(0), holding current – by the potentiometer (1). Set parameters are displayed on the LED panel, more details in the tables below: OUT0 OUT1 OUT2 OUT3 Operation current OUT4 OUT5 OUT6 OUT7 Holding current SMSD-1.5Modbus ver.3 SMSD-4.2Modbus SMSD-8.0Modbus ● 150 мА...
Page 124
SMSD-1.5Mus user manual LED indication IN0…7 Microstepping 1/16 1/32 1/128 1/256 When the controller is in the RUN state, the above parameters are fixed and saved after the power is off. Use the inputs and outputs of the controller according to the pin assignment table (Fig. 2). Tallinn Science Park Tehnopol, Phone: + 372 6559914, Akadeemia tee 21/6, 12618, Tallinn, Estonia...
14. User program control mode The controller provides control mode according a user program and control by Modbus com- mands. The controller indicates this control mode by LED indicator PROG. A user program can be sent to the controller memory when the controller is in the STOP state. After turning to the RUN state the controller starts executing of the user program.
SMSD-1.5Mus user manual Appendix A. Registers of the controller Address Type Size Description RS-485 interface communication parameters 0x8100 Coils Communications protocol selection Reset — Modbus ASCII. Set — Modbus RTU. Changes take effect after the controller reboot. 0x8100 Holding 32-bit Baud rate.
Address Type Size Description Date setting 0x8113 Holdings 16-bit Day. Registers Valid values: 1…31 0x8114 Holdings 16-bit Month Registers Valid values: 1…12 0x8115 Holdings 16-bit Year Registers Valid values: 21…99 Setting the date is similar to setting the time with a preliminary reset of the Coils 8110h (refer to the section 10).
SMSD-1.5Mus user manual Address Type Size Description 0xF001 Coils Read protection of the main (user) program. Set — not protected. Reset — read protection is set. Attempting to set the object causes erasing of the main program. 0xF002 Coils Read protection of the service program. Set —...
Address Type Size Description 0xF207 Input 32-bit Value of the second operand Registers 0xF209 Input 16-bit Index type of the second operand Registers 0xF20A Input 16-bit Value of the second index operand Registers 0xF20B Input 16-bit Type of the third operand Registers 0xF20C Input 32-bit...
Page 130
SMSD-1.5Mus user manual Address Type Size Description 0xF309 Holding 16-bit Index type of the second operand Registers 0xF30A Holding 16-bit Value of the second index operand Registers 0xF30B Holding 16-bit Type of the third operand Registers 0xF30C Holding 32-bit Value of the third operand Registers 0xF30E Holding 16-bit...
Page 131
Address Type Size Description 0xF405 Holding 16-bit 8 bits LSB – Operand 1 type – line 1 of the reading/writing sector Registers 8 bits MSB – Index type of the operand 1 of the reading/writing sector Operand 4 of the line 1 of the reading/writing sector 0xF40E Holding 32-bit Value of the operand 4 of the line 1 of the reading/writing sector...
SMSD-1.5Mus user manual Address Type Size Description Errors 0xE000 Coils Setting the object resets all types of errors that are valid for the current state of the controller. 0xE000 Discrete General error. It is always set when at least one of the types of Inputs errors from 0xE001 to 0xE004 appears.
0x6051 Addressing a jump point in a program or subprogram 0x6031 Addressing of an interruption point 0x6023 End of program Instructions for loops, transitions, subprogram 0x200D Conditional jump - go to the specified program line 0x280D Conditional jump - go to the specified program line with rising edge poll- ing (impulse) CALL 0x200E Calling subprogram...
SMSD-1.5Mus user manual BMOV 0x2038 Block data transfer BMOVP 0x2838 Block data transfer with rising edge polling (impulse) DBMOV 0x3038 Block data transfer, 32-bit instruction DBMOVP 0x3838 Block data transfer, 32-bit instruction with rising edge polling (impulse) FMOV 0x2058 Transferring data to multiple addresses FMOVP 0x2858 Transferring data to multiple addresses with rising edge polling (impulse)
Page 141
DDIV 0x3268 Division of numerical data, 32-bit instruction DDIVP 0x3A68 Division of numerical data, 32-bit instruction with rising edge polling (im- pulse) 0x22E8 Remainder of the division MODP 0x2AE8 Remainder of the division with rising edge polling (impulse) 0x32E8 Remainder of the division, 32-bit instruction DMOD 0x3AE8 Remainder of the division, 32-bit instruction with rising edge polling (im- DMODP...
Data processing ZRST 0x2203 Group reset of operands in a given range ZRSTP 0x2A03 Group reset of operands in a given range with rising edge polling (impulse) Decoder 8 → 256 bit DECO 0x2211 0x2A11 Decoder 8 → 256 bit with rising edge polling (impulse) DECOP Encoder 256 →...
SMSD-1.5Mus user manual DEMUL 0x2257 Multiplication of floating point numbers DEMULP 0x2A57 Multiplication of floating point numbers with rising edge polling (impulse) DEDIV 0x2277 Floating point numbers division DEDIVP 0x2A77 Floating point numbers division with rising edge polling (impulse) DESQR 0x2218 Square root in floating point format DESQRP...
SMSD-1.5Mus user manual AND> 0x4285 Serial contact closed if S1 > S2 DAND> 0x5285 Serial contact closed if S1 > S2, 32-bit instruction AND< 0x42A5 Serial contact closed if S1 < S2 DAND< 0x52A5 Serial contact closed if S1 < S2, 32-bit instruction 0x42C5 Serial contact closed if S1 ≠...
Page 147
HHIZ 0x2267 Deenergize motor phases immediately (the shaft rotates freely) HHIZP 0x2A67 Deenergize motor phases immediately (the shaft rotates freely) with rising edge polling (impulse) SSTOP 0x2287 Decelerate until full stop and switch to hold mode SSTOPP 0x2A87 Decelerate until full stop and switch to hold mode with rising edge polling (impulse) SHIZ 0x22A7 Decelerate until full stop and deenergize motor phases (the shaft rotates...
SMSD-1.5Mus user manual Appendix C. Examples of user programs Example 1. Usage of RUN command ;catch the front of the pulse at the input X0 (button) DMOV D359 ;set minimum speed 8 pps DMOV K120000 D357 ;set maximum speed 120000 pps FMOV K30000 D361...
Page 149
TORQUE ;apply current values FMOV D380 ;no error response, errors reset D382 ;use automatic calculation of start and final speed DMOV D363 ;zero the current position ;turn on the driver initialization bypass condition ;transition mark ;catch the front of the pulse at the input X0 (button) AND&...
SMSD-1.5Mus user manual Example 3. Usage of commands GOUNTIL_SLOWSTOP and RELEASE Using the GOUNTIL_SLOWSTOP and RELEASE commands as an example of moving to the origin position along the positive limit switch (see Fig. 36). Fig. 36 – Move to the origin ;to skip the initialization section, check the condition M0 ;and jump to the line marked P1 M108...
Page 151
;and move on to the second stage ;waiting for the limit switch to open and the motor to stop AND& D371 ;at the second stage ;reset the flag of the second stage DMOV D363 ;and reset the current position, it becomes the origin now ;catch the front of the pulse at the input X1 (button) SSTOP ;stop according to the preset DEC and turn to the holding...
SMSD-1.5Mus user manual Appendix D. Code of the service program “Stepper Motor Speed Control” ;initialization bypass condition M108 ;initialization part D320 ; D320 stores microstepping value OR> D320 OR< D320 D320 D320 D366 ;D0 –the service register for visualization of microstepping D320 ;as the controller doesn’t support microstepping 1/64, AND>...
Page 153
FMOV D367 ;set acceleration, deceleration and constant speed current D370 ;holding current – 50% of work current TORQUE D374 D374 DLD< D322 K250 ;D322, D323 speed set by buttons DOR> D322 K120000 DMOV K250 D322 DMOV D322 DLD< D324 K250 ;D324, D325 speed set by the encoder DOR>...
Page 154
SMSD-1.5Mus user manual M102 AND& D371 SSTOP M109 ;if there was an error and the ERR indicator was on - ;start the timer to turn it off M109 LD<> ANDP DADD D354 DAND> K120000 DMOV K120000 D5 DMOV D322 ANDP DSUB D354 DAND<...
Page 155
DAND< K250 DMOV K250 DAND> K120000 DMOV K120000 D15 DMOV D324 FEND ;end of the main program ;subprogram of setting the speed by the potentiometer M108 D354 AND= DMUL DAND< K250 DMOV K250 DMOV D357 CALL SRET ; subprogram of setting the speed by buttons M108 DMOV D322...
Page 156
SMSD-1.5Mus user manual D353 FMOV D367 D370 TORQUE IRET ;interruption with a period of 100 ms to update the speed M102 D371 CALL P10A0 SPIN IRET 1005 ;interruption from the input IN5 M105 D320 AND= D320 D320 AND= D320 D320 D321 AND= D321...
Page 157
DECO IRET 1004 ;interruption from the input IN4 M104 HHIZ M104 AND& D371 CALL P10A0 SPIN HSTOP IRET 1003 ;interruption from the input IN3 M103 HSTOP M103 AND& D371 CALL P10A0 SPIN IRET 1002 ;interruption from the input IN2 M102 SSTOP M102 AND&...
Page 158
SMSD-1.5Mus user manual AND= D374 SSTOP M107 D374 AND& D371 CALL P10A0 SPIN M107 D374 AND& D371 CALL P10A0 SPIN IRET 2000 ;interruption when a driver error occurs LD& D381 D381 M109 IRET Tallinn Science Park Tehnopol, Phone: + 372 6559914, Akadeemia tee 21/6, 12618, Tallinn, Estonia e-mail: mail@smd.ee url: https://smd.ee...
Appendix E. The lifetime of the fronts of the operands M and Y All of the information below is valid for operands M and Y, both for the leading and trailing edges. Example 1 Consider the lifespan of the leading edge of the operand M0, with guaranteed passage of the start of life point on the next scan.
SMSD-1.5Mus user manual The condition is met at the first scan. The condi- tion is not met at the second scan. The result is D1 = 1. SRET - interruption - existence of a front of the operand Example 2 Consider the lifespan of the leading edge of the operand M0, in the absence of passing the start point of life on the next scan.
Page 161
lifetime of the front M0. - existence of a front of the operand If a single pass between points 7 ... 9 is required, then, for example, the optional relay contact M1 can be used. The program will be changes as below: M108 ZRST ZRST...
Page 162
SMSD-1.5Mus user manual Appendix F. Debugging the user program Debug mode allows the user to: • set four breakpoints for the execution of the user program (breakpoint), • view and edit operands, • pause and resume the execution of the user program. Below is the list of the debugger registers: Address Type Size...
Page 163
Address Type Size Description Breakpoint 2 0x6201 Coils Setting the object turns on the breakpoint 2. User program executing will be suspended at index, which is specified in the Holding Regis- ters 6201h. Holding 0x6201 16-bit Index (number of command line) of the breakpoint 2. Registers Breakpoint 3 0x6202...
Page 164
SMSD-1.5Mus user manual Address Type Size Description Operands monitoring Input 0x6002 32-bit This register contains the value of the operand (if available) parame- Registers terized for reading. The size is set by Coils 6002h. Input 0x6004 16-bit This register contains the signal of the operand (if available) parame- Registers terized for reading.
Need help?
Do you have a question about the SMSD-1.5Modbus ver.3 and is the answer not in the manual?
Questions and answers