Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Info
titleRevision Info

This page currently corresponds to the Ns=92 93 revision of the MCode. This revision resides in release R2.3.1213 of pcds_motion.

Note
titleMotors with PCDS MCode Loaded

Any motors with standard PCDS MCode loaded should be purged and reset with the FD command before being loaded with pulse picker MCode. This avoids any interference between variables and code labels.

...

  • If Se<>0, we are likely experiencing a hard reset. In that case:
    • Signal state change to 80 (Hard Reset Initialization)
    • Set Ve (MCode version) to 3 and Pu (Power-Up flag) to 0.
    • Set EL (Encoder lines) to 4096, giving 4096 lines * 4 steps/line = 16384 steps/rev
    • Set MS (Microsteps) to 8, giving 8 uSteps/step * 200 step/rev = 1600 uSteps/rev
    • Set EE (Encoder enabled) to 0, forcing open-loop step mode. Closed-loop mode is too slow because of a 1kHz loop rate.
    • Set S3 (I/O 3 settings) to 16,0,1. This is used for encoder power - sourcing output, active low.
    • Set O3 (Output 3) to 1, turning the encoder on.Set S4 (I/O 4 settings) to 16,0,0. This is used for fan power - sinking power, active low.
    • Set O4 (Output 4) to 1, turning the fan on.Set S13 (I/O 13 settings) to 60,0,0. This is used for input signaling, and makes it available to the input capture trip (interrupt)
    • Set FC (Filter Capture) to 9. This sets a debounce filter on input 13 with a 12.9usec delay time.
    • Set HT (Hold Time) to 5, setting the hold current delay time to 5ms.
    • Set RC (Run Current) to 100, making 100% of current available for movement.
    • Set HC (Holding Current) to 5.
    • Set NE (Numeric Enable) to 0, to prevent errant communications as being interpreted as movement commands.
    • Set Sw (Sweep Distance) to 50 steps.
    • Set Sr (Encoder Sweep Distance) to 512 counts.
    • Reset Dr (Drift) to 0.
    • Reset Dl (Drift limit) to 23.
    • Reset P0 (Open position) to 0.
    • Reset P1 (Positive closed position) to P0+Sw = 512.
    • Reset P2 (Negative closed position) to P0-Sw = -512.
    • Reset N0 (Open encoder position) to 0.
    • Reset N1 (Positive closed encoder position) to N0+Sr.
    • Reset N2 (Negative closed encoder position) to N0-Sr.
    • Pre-load shadow register Cs=C2 (this doesn't actually do anything and may be eliminated in a future revision)
    • Set Ec=1 to turn error checking on.
    • Reset drift violation counters Ud and Ld to 0.
    • Reset Df to 99 (current slit position is unknown)
  • For both hard and soft resets, we do the following
    • Signal state change to 81 (Soft Reset Initialization)
    • Disable any trips (TE=0)
    • Hold for 100ms to let things stabilize.
    • Reset Hb (heartbeat) to 0.
    • Set Se (Mode Select) to 0
    • Goto Mode Select Loop

Mode Select Loop (LB Za)

    • Set O3 (Output 3) to 1, turning the encoder on. This is necessary because O3 is not saved in NVRAM.
    • Set O4 (Output 4) to 1, turning the fan on. This is necessary because O4 is not saved in NVRAM.
    • Goto Mode Select Loop

Mode Select Loop (LB Za)

  • Mode Select Loop START (forever):
    • Signal state change to 0 (Mode Select)
    Mode Select Loop START (forever):
    • Signal state change to 0 (Mode Select)
    • If Se=1, branch to Mode 1: One-Shot
    • If Se=2, branch to Mode 2: Flip-Flop
    • If Se=3, branch to Mode 3: Burst
    • If Se=4, branch to Mode 4: Fast Open
    • If Se=5, branch to Mode 5: Fast Close
    • If Se=7, branch to Mode 7: Home
    • Increment heartbeat
    • Hold for 100ms
  • Mode Select Loop END

...

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="be3c426f9873a8b8-0a78f407-4ddd47b0-961e9dfa-82fc5fd7e6d6ade5dd74217e"><ac:plain-text-body><![CDATA[

Var

Value [step/s(^2)]

[deg/s(^2)]

[rev/s(^2)]

]]></ac:plain-text-body></ac:structured-macro>

VI

5300

1192.5

3.3125

VM

10000

2250

6.25

A

1875000

421880

1171.9

D

1875000

421880

1171.9

...

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="4c0cc9d3ca080361-7410c9c0-46d44f3d-9b428e31-d2cb6ee865800f74fcccd63b"><ac:plain-text-body><![CDATA[

Var

Value [step/s(^2)]

[deg/s(^2)]

[rev/s(^2)]

]]></ac:plain-text-body></ac:structured-macro>

VI

7500

1687.5

3.3125

VM

10000

2250

4.6875

A

1875000

421880

1171.9

D

1875000

421880

1171.9

...

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="a1259fdd6923f55d-a3211b59-497c4ab8-9971920d-bafec744179b2fafd374fd5e"><ac:plain-text-body><![CDATA[

Var

Value [step/s(^2)]

[deg/s(^2)]

[rev/s(^2)]

]]></ac:plain-text-body></ac:structured-macro>

VI

7500

1687.5

3.3125

VM

10000

2250

4.6875

A

1875000

421880

1171.9

D

1875000

421880

1171.9

...

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="d7dbf7d546959329-bc680902-484f46a7-891da57d-16ce203852eec03b6d679c95"><ac:plain-text-body><![CDATA[

Var

Value [step/s(^2)]

[deg/s(^2)]

[rev/s(^2)]

]]></ac:plain-text-body></ac:structured-macro>

VI

640

144

0.4

VM

2560

576

1.6

A

640

144

0.4

D

640

144

0.4

...

The magic offsets are normally stored in IMS NVRAM, but in case they are lost, refer to the table above.

Changelog

Version Ns=

...

93 (pcds_motion R2.3.

...

13)

  • Moved O3 and O4 initializers to run on soft resets as well as on hard resets. This avoids a power-up edge case where, if the motor is powered up with Se=0, the encoder would not power up, making the spindle run haywire upon homing.

...

  • Release version of Ns=91
  • Adjusted default drift limit Dl to 46 encoder counts (~1 degree)
  • Wishlist for next revision:
    • Test realignment subroutine (X7) and add it to every mode change (especially fast open/close modes)
    • Further velocity tuning? We could possibly go faster.

Version Ns=92 (pcds_motion R2.3.12)

  • Release version of Ns=91
  • Adjusted default drift limit Dl to 46 encoder counts (~1 degree)

Version Ns=91 (Non-Release)

...