Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mc4

A program to operate the Newport/Klinger MC-4 4-axis controller for RBS via IEEE-488 (GPIB).

Usage

The program name is mc4gui.exe in Windows or mc4gui in Linux.

After starting the program the following configuration dialog is presented:

Init dialog

Default options should typically work. If you get errors then see Troubleshooting.

The main widget is as follows:

Main widget

To operate the MC4:

  • select the Axis you want to move (X, Y, Z or W)
  • Enter the Set Position and press GO to move the axis. Movement is absolute - you just give the required final position
  • Press READ the get the actual position
  • Press the 2nd READ to get also the Axis status (LimitUp/Down, Moving)
  • Press RESET to reset the origin (0) for the current axis at the current location

Setup

The Klinger MC-4 is connected to a National Instruments ENET100 GPIB controller.

The ENET100 is an ethernet device that can be reached at address 10.0.5.50.

To communicate with ENET100 you have to install the NI GPIB driver v. 17.6 (the last one that supports ENET100).

Currently this has been tested on Windows 7 and 10.

Troubleshooting

If the initial config fails, check the following:

  • MC4 & ENET100 are powered on
  • ENET100 is connected to the lab's ethernet network
  • Use ping 10.0.5.50 to confirm the device is reachable
  • Check that the GPIB cable from ENET100 to MC4 is in place

Installation

To build the program you need

  • The GPIB library NI488.2 from National Instruments
  • Qt5 for the GUI

Build by standard cmake commands

mkdir .build
cd .build
cmake ..
cmake --build .

The project creates 2 executables:

  • mc4: send commands from the command line (experimental - DO NOT USE!)
  • mc4gui: open a GUI widget to control the axes

The GPIB interface programming is based on the example program given on page 11.11 of the Klinger/MC4 manual.

Notes on MC4 IEEE-488 interface

Setup

  • Setting the device address

The dip-switch SW1 at the back side sets the address in binary

Swicth 1 = MSB Switch 5 = LSB

Currently SW1 = 00110 binary = 6

1 = switch Up !!

  • Setting the terminator

The dip switch S3.4 sets the terminator:

  • ON(Up): CR - in C-lang, append an '\r' to the cmd sent to MC4
  • OFF(Down): CR+LF or LF - in C-lang, append an '\r\n' to the cmd sent to MC4

Communication

The control PC sends command strings through the GPIB interface, e.g. "PX1000". This can be done with the GPIB function ibsend

The proper terminator must be appended to the string.

  • Axes

There are 4 axes designated with letters X, Y, Z, W. These are the axes names defined in the Klinger MC4 device manual.

The following commands are implemented in mc4/mc4gui

  • Move absolute

To move axis X to position 1000, the program sends

    PX1000

To move Z to position -500 it sends

    PZ-500
  • Reset axis (set current position to zero)

To reset the X axis the program sends

    AX 

The position of X will become 0

  • Read the position (e.g. of X)

     DX
    
  • Read the status of all axes (position, limits, etc)

    FSFF
    ?
    

GPIB read issue

When the control PC reads from MC4, e.g. with a command

    ibrd(6, buff.data(), 70);

the MC4 response is received correctly.

However, the MC4 starts beeping indicating error codes 2 & 3 on the display.

The source of the error could not be found, however, the current solution for this is:

  • Send another command immediately after the read operation!

This resets the error in MC4 and the beeping stops.

Reading the status

To read the status, 1st we send a command

    FSFF

that tells MC4 to send all info for the 4 axes.

After sending FSFF, the response to a "?" will be a string S with the following form

  • S[0] = '0'
  • S[1]: if (S[1] & 1) then W moving. if (S[1] & 2)->X moving, ...(S[1] & 4)->Y, (S[1] & 8)->Z
  • S[2] = '1'
  • S[3]: if (S[3] & 1) then W limit+, (S[3] & 2)->W limit-, (S[3] & 4)->X limit+, (S[3] & 8)->X limit-
  • S[4] = '2'
  • S[5]: if (S[5] & 1) then Y limit+, (S[5] & 2)->Y limit-, (S[6] & 4)->Z limit+, (S[6] & 8)->Z limit-
  • S[6] = '3'
  • S[7]:

The rest of the string S[8..end] has structure

    W=%f X=%f Y=%f Z=%f

where %f means a number. The numbers are typically integers but in some cases they may have 1 decimal digit.

Additionally, if the MC4 is waiting inside a program (not used now but maybe interesting for other apps) then it will prepend the response to "?" with

  • S[0] = '4'
  • S[1]: the 3 lower bits have some info on wait status

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages