Zcommand demo


This tutorial demonstrates how to use the ZCOMMAND command to control the relays, lighting, voltage and the motor (which operates the peristaltic pump, the feeder mechanism for powdered food and pellets, and the vibration of the MWP system).

Top

ZCOMMAND control sequence commands


There are 9 different control command operations that can be used within ZCOMMAND. The numbers in the brackets and written between inverted commas “” indicate the operation parameters.

'P' Pause (ms)
'M' Number of motor steps 
'D' Delay between motor steps 
'U' Step mode 
'N' Set light to colour 
'F' Turn light off 
'I' Set light intensity 
'C' Control relay output 
'V' Voltage relay control
'G' GPO control

Individual operations do not have to be separated (e.g., 'M10P500M-10'), but for readability any combination of white space (commas, spaces) or commands can be used (e.g., 'M10, P500 M-10').

All command operations need at least one argument (the number used to operate); some commands use 2 arguments, in which case a '#' character is used to separate them (e.g., 'N3#6').

Top

'Pause' operation command


'P' Pause, to set delay between operations (ms)
  • "P" operation command is used to add a delay in milliseconds between operation commands (e.g., motor movements). It can be used between any of the other parameters below.
Top

Motor operation commands


The built-in motor is a stepper motor and is controlled using the following operation commands within ZCOMMAND.

'M' Number of Motor steps (e.g., 200, -50)
'D' Delay between motor steps (to set motor speed - should not be below 1000) 
'U' Step mode (0-3, for full/half/quarter/eighth step modes)
# ZCOMMAND Motor drive examples
 
ZCOMMAND("D2500 U0 M1000") 
ZCOMMAND("D2500 U1 M1000") 
ZCOMMAND("D2500 U2 M1000") 
ZCOMMAND("D2500 U3 M1000") 
ZCOMMAND("D1000 U0 M2000 P100 M-2000")
  • "M" operation command controls the number of 'steps' the motor rotates. To rotate the motor a full 360 degrees, the number following M would be 200.
  • "D" operation command tells the unit the delay between each step. This is in units of 4.25 µsecs.
  • The "U" operation command tells the unit how large each step should be. The operations available are 0-3. "U0" is a full step, "U1" is a ½ step, "U2" is a ¼step, "U3" is an ⅛ of a step.
    • If the step mode at a full step (U0), and the motor is set to move 200 steps (M200) the motor will rotate a full cycle. If the step mode is set to a ½ step (U1), 400 steps (M400) are required to rotate a full cycle.

For a more in depth tutorial on how to use the motor for vibration assays in the MWP unit, see the Vibration demo page.

Top

Lighting operation commands


'N' Set light to colour (light, RGB code)
'F' Turn light off (light number)
'I' Set light intensity (intensity)
# Test lights using command sequence 
 
ZCOMMAND("N1#7 P100 F1") 
ZCOMMAND("N2#1 P100 F2") 
ZCOMMAND("N3#2 P100 F3")
  • The "N" operation command uses two arguments: the number before the # sets which light is being referred to and the number following sets its colour.
    • The number prior to the # symbol can be 1, 2, or 3 and refers to the CN output the lights are plugged into.
      • CN8 = 1
      • CN7 = 2
      • CN6 = 3
    • The number following the # symbol uses the RGB code in a range of 0-7.
      • 0 = No colour/Off
      • 1 = Red
      • 2 = Green
      • 4 = Blue
    • To create the remaining LED colours, it uses a LED additive model and therefore:
      • 3 = Yellow
      • 5 = Magenta
      • 6 = Cyan
      • 7 = White

NOTE: CN6 only controls the Red and Green (and therefore Yellow).

  • The "F" operation command turns off the light referenced (e.g., F2 turns Light 2 or the lights plugged into CN7 off.
  • An alternative way of turning off the lights within ZCOMMAND is by using a 0 following the # symbol (e.g., "N1#0").

# Intensity control test 
 
LIGHTS(ALL,ON) 
ZCOMMAND("I0 P500 I50 P500 I100 P500 I150 P500 I200 P500 I255 P500") 
LIGHTS(ALL,OFF)
  • The "I" operation command is the light intensity value. It uses a range between 0-255 and affects all LEDs.
  • The command is controlling the current to the LEDs and therefore when using ½ the current (i.e, ~I127), you will have ½ brightness. Using the full current (I255) will result in the brightest level.

NOTE: I0 does not turn the LEDs off completely.

Top

Relay and voltage operation commands


External stimuli can be plugged into one of two socket connections at the back of the unit, CN3 or CN4. By default CN4 is connected to the 12V power supply; whereas CN3 needs to have the power circuit completed. For example, immediately upon plugging in a light source to CN4, the light will be on. If plugged into CN3, the light will need to be switched on using the relay commands within ZCOMMAND.

'C' Control relay output 
'V' Voltage relay control 
# Relays 
ZCOMMAND("C1#1 P250 C1#0 P500") 
ZCOMMAND("C2#1 P250 C2#0 P500") 
# Voltage outputs 
ZCOMMAND("V1#1 P100 V1#0 P500") 
ZCOMMAND("V2#1 P100 V2#0 P500") 
ZCOMMAND("V3#1 P100 V3#0 P500") 
ZCOMMAND("V4#1 P100 V4#0 P500")
  • The "C" operation command uses two arguments: the number before the # sets which relay is being referred to and the number following sets its 'state': on or off.
    • C1 = RELAY1 (CN4)
    • C2 = RELAY2 (CN3)
  • The number following the # symbol is either a value of 1 or 0.
    • 0 = turns relay off
    • 1 = turns relay on

  • The "V" operation command operates in the same manner as the relay operation commands. However, there are 4 voltage levels that can be operated.

For a more in depth tutorial on how to use the relay controls, see the Relay Demo page.

Top