Tuesday, June 19, 2012

ZOC, REXX, Python

ZOC is a powerful terminal emulator and I use it extensively for communicating with the evaluation boards via the serial port (COM port). It's user friendly interface and support for the macro language programming (REXX) makes it easy to use for Silicon bring up and automation.
For more information on the ZOC follow the webpage :
http://www.emtec.com/zoc/

REXX (Restructured Extended Executor) is a free form language with only one data type "character string (classic REXX)". It has very small instruction set.
For more details on the REXX programming, refer to the below web links
http://www.rexxinfo.org/

Combining ZOC, REXX together with Python (PyVisa) makes it even more suitable for automation. Instruments (like power supplies, temperature chambers, oscilloscopes other measurement equipments) that be controlled over the GPIB interface can be controllable using the python VISA module.

E.g. Python module to control E3631A HP (Agilent) power supply via GPIB

# -- gpib.py module ---
import visa;

def gpib_init(ins="GPIB0::5"):
    return visa.instrument(ins)
def clear(ins):
    ins.write("*CLS")

def reset(ins):
    ins.write("*RST")

def set6v(ins,voltage=1.000,current=1.000):
    ins.write("APPLY P6V, {voltage}, {current}".format(voltage=voltage,current=current))

def set25v(ins,voltage=1.000,current=1.000):
    ins.write("APPLY P25V, {voltage}, {current}".format(voltage=voltage,current=current))

def poweron(ins):
    ins.write("OUTPUT:STATE ON")

def poweroff(ins):
    ins.write("OUTPUT:STATE OFF")

#------ end


# E631A_on.py
import gpib
import sys
ins = gpib.gpib_init(sys.argv[1]) # check the VISA address

## start the instrument in Power off, default mode
gpib.set25v(ins,sys.argv[3],1.000)
gpib.set6v(ins,sys.argv[2],1.000)
# Switch on the power supply
gpib.poweron(ins)

# E631A_off.py

import sys
import gpib
## initialize the GPIB
ins = gpib.gpib_init(sys.argv[1]) # check the VISA address from Agilent IO Library
## Power off the instrument
gpib.clear(ins)
gpib.reset(ins)
gpib.poweroff(ins)


# Simple Automation example script in REXX + ZOC commands (test.zrx)

CALL ZocLogging 1
CALL ZocLogname  "Test.log"

/* Power up the device */
vdd6v     = 3.3000
vdd25v     = 12.000
gpib_ad = 'GPIB0::1'


/* Run test 10 times with power cycle */
DO 10
    CALL E3631A_off gpib_ad
    ZocDelay 5
    CALL E3631A_on gpib_ad vdd6v vdd12v
    ZocDelay 12
    CALL test
END
return

/* Actual test commands over the serial port */
test:
    ZocSend "command_1^M"
    ZocDelay 2
    ZocSend "command_2^M"
    ZocDelay 2
return

E3631A_on:
   gpib_ad = arg(1)
   v6      = arg(2)
   v25     = arg(3)
   CALL ZocExec "C:\Python27\python.exe C:\Python27\scripts\E3631A_on.py" gpib_ad v6 v25, 1
   ZocDelay 6
return

E3631A_off:
    gpib_ad = arg(1)
    CALL ZocExec "C:\Python27\python.exe C:\Python27\scripts\E3631A_off.py" gpib_ad, 1
    ZocDelay 2
return


2 comments:

vstcyberpc said...

I am very impressed with your post because this post is very beneficial for me and provide a new knowledge to me
WiFi Hacking Password Crack
TechTool Pro Build Crack
ZOC Terminal Crack
PDF Architect Crack
Folx Pro Crack

Malik Aqib said...

Movienizer Crack
Apple Compressor Crack
ZOC Terminal Crack
Plugin Boutique Scaler Crack
SILKYPIX Developer Studio Crack
DriveDx Crack
Wow, amazing block structure! How long
Have you written a blog before? Working on a blog seems easy.
The overview of your website is pretty good, not to mention what it does.
In the content!