Sunday, May 03, 2020

GPIB - using the ICS 4896

You can get one of this devices out of the usual "junk" site for around 60 Eur, pretty useless if you think you can use it a a serial to GPIB because it's only a "collector" of 4 serial interfaces and placing the data on a GPIB bus. You will be better suited for the same with a regular dual or quad serial card or even the usb to serial adapters unless you already have a GPIB interface card.

I got one unit thinking that eventual I could use it also as a converter/interface of serial to GPIB, no, I should have read the specs first! Anyhow might be useful eventually one day to get multiple serial data simultaneously on the GPIB bus.

Reference picture of the device:


This was also the device that took me more time to make it work with the National Instruments GPIP board from this post on Linux.

The main code/graphical interface in python is this one (getICS4896S1.py):

=========
 #!/usr/bin/python
import Tkinter as tk
import time
import Gpib
import subprocess
inst = Gpib.Gpib("ics")

counter = 0
line = []

def counter_label(label):
  def count():
    global counter
    counter += 1
    p = subprocess.Popen("/home/rmartins/soft/ics_serial/getonelineS1.py", stdout=subprocess.PIPE, shell=True)
    (output, err) = p.communicate()
    p_status = p.wait()
    label.config(text=output)
    label.after(100, count)
  count()


root = tk.Tk()
root.title("    ICS 4896 reading from S1    ")
label = tk.Label(root, fg="green")
label.pack()
counter_label(label)
button = tk.Button(root, text='Stop', width=45, command=root.destroy)
button.pack()
root.mainloop()
=========

It will call the following script (/home/rmartins/soft/ics_serial/getonelineS1.py) to get one line from the first serial:

=========
#!/usr/bin/python
import time
import Gpib
import sys
inst = Gpib.Gpib("ics")
exception = 0

line = []
def count(instrument):
    global exception
    try:
     result = inst.read(1)
     if result == "\n":
      print(''.join(line))
      exception = 1
      return exception
     else:
      line.append(result)      
    except: expection = 2
while True:
 if exception == 1: exit()
 count(1)

=========

The "ics" instrument definition used on the previous code is this one on /usr/local/etc/gpib.conf:

=========
device {
        minor = 0       /* minor number for interface board this device is connected to */
        name = "ics"    /* device mnemonic */
        pad = 4         /* The Primary GPIB Address */
        sad = 97        /* Secondary Address for Serial 1 */

        eos = 0xa       /* EOS Byte */
        set-reos = no /* Terminate read if EOS */
        set-bin = no /* Compare EOS 8-bit */
}


=========


Here's an example output of the code on the top window and "minicom" on lower window, computer serial (with minicom) connected to the first serial on the ICS 4896 where I wrote the string "10.002E-2V" to appear on the ICS device:



 You could do similar on command line using "ibterm" (from gpib Linux driver package)



Hope it helps.

Have fun!



2 comments:

Anonymous said...

Are you interested in selling the ICS 4896?

Ricardo - CT2GQV said...

Hello,
Not at the moment, you can still get them on the "flee bay", anyhow prices inflated for what it's worth.
What was the application you wanted to make, probably there will be easier methods?