Application Notes & Sample Programs:
MDrive Motion Control (MDI)

MDI Application Note 12/6/05 (PDF)  - Eliminating Circulating Currents in the Communications Port (Party Mode)

Multiple MDrive Motion Control System -- 
Party Mode


MDI Motion Control Archive
- Getting Started Guide
- RS-485 Two Wire Communication
- Noise Detection and Shielding
- Selecting a Power Supply
- MDI Sample Programs

MicroLYNX Notes / Programs

Setting Up Your System
Communication Format and Tables
Using Check Sum
Party Mode Sample Codes

In systems with multiple controllers it is necessary to communicate with the control modules using party mode (PY=1) of operation. The MDrive Motion Control nodes in the system are configured in software for this mode of operation by setting the Party Flag (PY) to True (1). It is necessary for all of the nodes in a system to have this configuration selected. When operating in party mode each MDrive Motion Control in the system will need a unique address, or name, to identify it in the system. This is accomplished by using the software command DN, or Device Name. For example, to set the name of an MDrive to "A" you would use the following command: DN=65 or DN="A" (65 is the ASCII decimal equivalent of uppercase A). The factory default name is "!". The asterisk character "*" is used to issue global commands to every device in the system. NOTE: When using the asterisk "*" in Party Mode, typed entries and commands will not be echoed. 

SET UP INSTRUCTIONS
In setting up your system for party operation, the most practical approach is to observe the following steps:

1. Connect first MDrive Motion Control to the Host PC configured for Single Mode Operation.

2. Establish communications and download program if required.

3. Using the command DN, name the MDrive Motion Control. This can be any upper or lower case ASCII character or number 0-9. (DN="A"{enter})

4. Set the party flag PY=1{enter}.

5. Type CTRL+J to activate the Party Mode.

6. Type AS CTRL+J (Save device name and Party Mode).

7. Remove power.

8. Repeat steps 1 through 7 for each additional MDrive in the system.

Figure: Party Mode with Host PC

Figure: Party Mode with Host PC

Data Cable Termination Resistors
Data Cable lengths greater than 15 feet (4.5 meters) are susceptible to signal reflection and/or noise. IMS recommends 120
W termination resistors at both ends of the Data Cables. An example of resistor placement is shown above. For systems with Data Cables 15 feet (4.5 meters) or less, the termination resistors are generally not required.

Back to Top

MDI Communication Format
The following communication formats used by MDrive Motion Control (MDI) units, began with pre-release firmware version 901.034. 

{}        The contents between the {} symbols are transmitted.

{0D}   Hex equivalent for a CR (Carriage Return).

{0A}    Hex equivalent for a LF (Line Feed).

{DN}   Represents the Device Name being sent.

{CS}   Check Sum; {ACK} 06 Hex; {NAK} 15 Hex

EM = Echo Mode;   PY = PartY Mode;   CK= ChecK sum

The word {command} represents the immediate command sent to the MDI.

Command Execution Time (CET) is the time the MDI takes to execute a command. This varies from command to command and usually is in the 1-5 millisecond range.

Parameter setting

Transmission to MDI

MDI initial response

MDI final response

Notes

EM=0 & PY=0 CK=0

{command} {0D}

{command} (echoed back one character at a time as the character is entered)

CET {0D} {0A} >

The last character sent is the prompt >

EM=1 & PY=0 CK=0

{command} {0D}

 

CET {0D} {0A}

The last character sent is the LF

EM=2 & PY=0 CK=0

{command} {0D}

 

 

No response except to PR and L commands

EM=3 & PY=0 CK=0

{command} {0D}

 

CET command
{0D} {0A}

Queued response. The last character sent is the LF.

 

Parameter setting

Transmission to MDI

MDI initial response

 

MDI final response

Notes

EM=0 & PY=1 CK=0

{DN} {command} {0A}

{command} (echoed back one character at a time as the character is entered)

CET {0D} {0A} >

The last character sent is the prompt >

EM=1 & PY=1 CK=0

{DN} {command} {0A}

 

CET {0D} {0A}

The last character sent is the LF

EM=2 & PY=1 CK=0

{DN} {command} {0A}

 

 

No response except to PR and L commands

EM=3 & PY=1 CK=0

{DN} {command} {0A}

 

CET command
{0D} {0A}

Queued response. The last character sent is the LF.

 

Parameter setting

Transmission to MDI

MDI initial response

MDI final response

Notes

EM=0 & PY=0 CK=1

 

{command} {CS} {0D}

{command} (echoed back one character at a time as the character is entered)

CET {ACK} or {NAK} >

The last character sent is the prompt >

EM=1 & PY=0 CK=1

{command} {CS} {0D}

 

CET {ACK} or {NAK}

The last character sent is the ACK or NAK

EM=2 & PY=0 CK=1

{command} {CS} {0D}

 

 

No response except to PR and L commands

EM=3 & PY=0 CK=1

{command} {CS} {0D}

 

CET command {CS} 
{ACK} or {NAK}

Queued response. The last character sent is the ACK or NAK.

 

Parameter setting

Transmission to MDI

MDI initial response

 

MDI final response

Notes

EM=0 & PY=1 CK=1

{DN} {command} {CS} {0A}

{command} (echoed back one character at a time as the character is entered)

CET {ACK} or {NAK} >

The last character sent is the prompt >

EM=1 & PY=1 CK=1

{DN} {command} {CS} {0A}

 

CET {ACK} or {NAK}

The last character sent is the ACK or NAK

EM=2 & PY=1 CK=1

{DN} {command} {CS} {0A}

 

 

No response except to PR and L commands

EM=3 & PY=1 CK=1

{DN} {command} {CS} {0A}

 

CET command {CS} {ACK} or {NAK}

Queued response. The last character sent is the ACK or NAK

Back to Top

Using CHECK SUM
For communication using Check Sum, the following 2 commands demonstrate sending and receiving.

Sending Command

1. Check Sum set to ZERO before first character is sent.

2. All characters (ASCII values) are added to Check Sum, including the Device Name DN (if PY=1), to the end of the command, but not including terminator.

3. Check Sum is 2's complement OR'd with Hex 80 (prevents Check Sum from being seen as Command Terminator).

4. Terminator Sent.  

Example command:

MR (space) 1
77    82    32    49
        Decimal value
4D    52    20    31        Hex

77+82+32+49=240     Add decimal values together

1111 0000 240           Change 240 decimal to binary
0000 1111                   1's complement
0001 0000                   Add 1 [2's complement]
1000 0000                   OR result with 128

1001 000 144              result check sum value


Once the result is reached, add the check sum value of 144 to your string by typing: MR 1 (Alt Key + 0144) (use the symbol of 144 in your string by holding down the Alt key and typing 0144).

Receiving Command

1. Check Sum set to ZERO.

2. All characters are added to Check Sum.

3. When receiving a Command Terminator, the lower 7 bits of the Check Sum should be = to ZERO.

               a) If not ZERO, then command is ignored and NAK echoed.

               b) If ZERO, then ACK is sent instead of CR/LF pair.

4. Responses to PR commands will be Check Summed as above, but the receiving device should NOT respond with ACK or NAK.

Back to Top

Figure: Party Mode with MDrive as Master

MDI Party Mode Sample Codes

  1. Download this segment of code into the first MDrive Motion Control. After downloading the program to the unit, follow the Set Up instructions from the beginning of article. Be sure to set your first unit with the unique address of A (device name is case sensitive). Refer to figure above.

    RC=25         'Run current
    HC=5           'Hold current
    MS=256       'Microstep selection
    A=250000    'Acceleration
    D=250000    'Deceleration
    PG 1             'Enter program mode
    S1=0,0          'Setup I/O 1 as an input low true
    LB SU           'Start program upon power up
    LB AA           'Label program AA
    MR 104400   'Move relative 104400 counts
    H                   'Hold program execution to complete the move
    LB DD            'Label program DD
    BR DD,I1=0    'Branch to DD if I1=0
    PR "Bex 1"     'Print device name B to execute program at address 1
    H 2000           'Hold program execution 2000 milliseconds
    PR "Cex 1"     'Print device name C to execute program at address 1
    H 2000           'Hold program execution 2000 milliseconds
    BR AA            'Branch to label AA
    E
    PG                  'Exit program, return to immediate mode


  2. Download this segment of code into your second MDrive Motion Control. After downloading the program to the unit, follow the previous party mode instructions. Be sure to set your second unit with the unique address of B (device name is case sensitive).

    RC=25            'Run current
    HC=5              'Hold current
    MS=256          'Microstep selection
    A=250000      'Acceleration
    D=250000      'Deceleration
    PG 1               'Enter program mode
    LB BB             'Label program BB
    MR 208000     'Move relative 208000 counts
    H                    'Hold program execution to complete the move
    E
    PG                  'Exit program, return to immediate mode


  3. Download this segment of code into your second MDrive Motion Control. After downloading the program to the unit, follow the previous party mode instructions. Be sure to set your third unit with the unique address of C (device name is case sensitive).

RC=25            'Run current
HC=5              'Hold current
MS=256          'Microstep selection
A=250000      'Acceleration
D=250000      'Deceleration
PG 1               'Enter program mode
LB CC             'Label program CC
MR 300000     'Move relative 300000 counts
H                    'Hold program execution to complete the move
E
PG                  'Exit program, return to immediate mode

Back to Top

 

Questions? Contact IMS applications support:

Western U.S. Region Ph: (760) 966-3162, E-mail: wtech@imshome.com
Eastern U.S. Region Ph: (860) 295-6102, E-mail: etech@imshome.com


IMS Logo Wide

370 N. Main St., P.O. Box 457
Marlborough, CT 06447 U.S.A.
Phone: 860 / 295-6102
Fax: 860 / 295-6107
Email: info@imshome.com

Contact

TECHNICAL SUPPORT (U.S.A.)
Phone: 860 / 295-6102
Fax: 860 / 295-6107
E-mail: etech@imshome.com

IMS ASIA PACIFIC OFFICE
30 Raffles Pl., 23-00 Caltex House
Singapore 048622
Phone: +65 / 6233 / 6846
Fax: +65 / 6233 / 5044
E-mail: wllee@imshome.com

IMS EUROPEAN SALES MGT.
4 Quai Des Etroits
69005 Lyon, France
Phone: +33 / 4 7256 5113
Fax: +33 / 4 7838 1537
E-mail: bmartinez@imshome.com

IMS UK Ltd
.
Sanderson Centre
15 Lees Lane
Gosport,Hampshire, UK  PO12 3UL
Phone: +44 / 0 2392 520775
Fax: +44 / 0 2392 502559
E-mail: mcheckley@imshome.com

U.S.A. SALES OFFICES
Eastern Region 

Phone: 973 / 661-1270
Fax: 973 / 661-1275
E-mail: jroake@imshome.com

Central Region
Phone: 260 / 402-6016
Fax: 419 / 858-0375
E-mail: dwaksman@imshome.com

Western Region
Phone: 602 / 578-7201
E-mail: dweisenberger@imshome.com