1
package com.sun.electric.tool.simulation.test;
6
* Created on March 18, 2004
7
* Copyright (c) 2004,2005 by Sun Microsystems, Inc.
16
public class HP81250 extends Equipment {
18
String s = new String("null");
20
String handle = new String();
22
/** Creates a new instance of HP81250 */
23
public HP81250(String name) {
27
void init(String _handle) {
30
//s = s.substring(0,s.length()-1);
31
System.out.println("dvt idn " + s);
32
try { Thread.sleep(100); } catch (InterruptedException _) { }
37
write(":dvt:instrument:handle:create? " + handle + ", \"DSR\",\"DSRA\"");
39
System.out.println("successfully created handle " + s);
40
try { Thread.sleep(100); } catch (InterruptedException _) { }
43
void run(boolean state) {
45
write(":_" + handle + ":sgen:glob:init:cont ON");
47
write(":_" + handle + ":sgen:glob:init:cont OFF");
48
try { Thread.sleep(300); } catch (InterruptedException _) { }
50
//write(":_"+handle+":sgen:glob:init:cont?");
51
//s = read(200).trim();
52
//System.out.println("system state " + s);
53
//Infrastructure.waitSeconds(.1f);
57
write(":dvt:inst:hand:list?");
59
//s = s.substring(0,s.length()-1);
60
System.out.println("list of handles " + s);
61
try { Thread.sleep(100); } catch (InterruptedException _) { }
64
void load_setting(String setting_name) {
66
String actualSetting = new String();
67
while (!actualSetting.equals(setting_name.toUpperCase())) {
68
//write(":dvt:mmem:setting:import _"+handle+", \"" + setting_name +
70
write(":_" + handle + ":mmem:setting:load \"" + setting_name
72
try { Thread.sleep(100); } catch (InterruptedException _) { }
73
String acSt = get_setting();
74
actualSetting = acSt.substring(1, acSt.length() - 1);
75
//System.out.println(actualSetting + " " + setting_name);
77
//System.out.println(actualSetting);
80
String get_setting() {
81
write(":_" + handle + ":mmem:sett:name?");
83
//System.out.println("setting " + s);
84
try { Thread.sleep(100); } catch (InterruptedException _) { }
88
void countConnector() {
89
write(":_" + handle + ":conf:cgr1:mod?");
92
System.out.println("number of modules " + s);
95
Integer iObj = new Integer(s);
97
for (int i = 1; i <= (iObj.intValue()); i++) {
98
//find out how many connectors
99
write(":_" + handle + ":conf:cgr1:mod" + i + ":conn?");
100
s = read(200).trim();
101
System.out.println("module number " + i + " has " + s
103
try { Thread.sleep(100); } catch (InterruptedException _) { }
106
}//end countConnector
108
void setFreq(int f) {
109
write(":_" + handle + ":sgen:global:freq " + f + "e6");
110
write(":_" + handle + ":sgen:global:mux 4");
111
try { Thread.sleep(100); } catch (InterruptedException _) { }
112
write(":_" + handle + ":sgen:global:freq?");
113
s = read(200).trim();
114
//System.out.println("freq set to " + s);
117
void createSetting(String setting_name) {
120
write(":_" + handle + ":mmem:sett:new");
122
//create 3 ports, 1 data, 2 clock, one terminal under each port
123
write(":_" + handle + ":sgen:pdat1:app \"INPUT_PORT\",1,\"data\",ELEC");
124
write(":_" + handle + ":sgen:PPUL1:app \"INPUT_PORT\",1,\"pulse\",ELEC");
125
write(":_" + handle + ":sgen:PPUL2:app \"INPUT_PORT\",1,\"pulse\",ELEC");
127
//connect connectors to terminals
128
write(":_" + handle + ":sgen:conn:pdat1:term1:to (@0102004)");
129
write(":_" + handle + ":sgen:conn:ppul1:term1:to (@0103002)");
130
write(":_" + handle + ":sgen:conn:ppul2:term1:to (@0103001)");
132
//set the voltage levels
133
write(":_" + handle + ":mod2:conn4:volt:high 1.8");
134
write(":_" + handle + ":mod3:conn2:volt:high 1.8");
135
write(":_" + handle + ":mod3:conn1:volt:high 1.8");
138
write(":_" + handle + ":mod2:conn4:dig:sign:format NRZ");
139
write(":_" + handle + ":mod3:conn2:dig:sign:format RZ");
140
write(":_" + handle + ":mod3:conn1:dig:sign:format RZ");
143
write(":_" + handle + ":mod2:conn4:pulse:dcycle 10");
144
write(":_" + handle + ":mod3:conn2:pulse:dcycle 30");
145
write(":_" + handle + ":mod3:conn1:pulse:dcycle 30");
147
//global parameters period and segment resolution
148
write(":_" + handle + ":sgen:global:period 40e-9");
149
write(":_" + handle + ":sgen:global:mux 4");
152
write(":_" + handle + ":sgen:pdat1:mux 2.5E-1");
153
write(":_" + handle + ":cgr1:mod3:conn2:mux 1");
154
write(":_" + handle + ":cgr1:mod3:conn1:mux 1");
156
write(":_" + handle + ":sgen:pdat1:mux?");
157
String s = read(200).trim();
158
System.out.println("mux " + s);
160
//switch on the terminals
161
write(":_" + handle + ":mod2:conn4:outp on");
162
write(":_" + handle + ":mod3:conn2:outp on");
163
write(":_" + handle + ":mod3:conn1:outp on");
168
+ ":SGEN:GLOB:SEQ (3.0,\"\",(SEQ,(LOOP4,0,20,\"00\",(BLOCK,0,16,0,\"00\",(),PAUSE0,0,0)),\"\",(BLOCK,0,16,0,\"00\",(),\"REFRESHCLK\",0,0),\"\",(LOOP5,0,INF,\"00\",(BLOCK,0,16,0,\"00\",(),PAUSE0,0,0))))");
171
+ ":SGEN:GLOB:SEQ:EVEN (3.0,(\"\",0,(('x','xxxxxxxx','xx',IGNORE))),(\"\",0,(('x','xxxxxxxx','xx',IGNORE))),(\"\",0,(('x','xxxxxxxx','xx',IGNORE))),(\"\",0,(('x','xxxxxxxx','xx',IGNORE))),(\"\",0,(('x','xxxxxxxx','xx',IGNORE))),(\"\",0,(('x','xxxxxxxx','xx',IGNORE))),(\"\",0,(('x','xxxxxxxx','xx',IGNORE))),(\"\",0,(('x','xxxxxxxx','xx',IGNORE))),(\"\",0,(('x','xxxxxxxx','xx',IGNORE))),(\"\",0,(('x','xxxxxxxx','xx',IGNORE))))");
172
write(":_" + handle + ":SGEN:GLOB:SEQ:PCON 0");
175
write(":_" + handle + ":mmem:sett:save \"" + setting_name + "\"");
179
void switchConnector(String mod, String conn, String state) {
180
write(":_" + handle + ":mod" + mod + ":conn" + conn + ":outp " + state
182
//Infrastructure.waitSeconds(.1f);
183
}//end switchConnector
185
void getConnectorStat() {
186
write(":_" + handle + ":sgen:glob:conn?");
187
String s = read(200).trim();
188
System.out.println("connector stat " + s);
189
}//end getConnectorStat
191
void destroyHandle() {
192
//write(":_" +handle+":sgen:glob:init:cont OFF");
193
//Infrastructure.waitSeconds(.1f);
195
write("dvt:instrument:handle:destroy _" + handle + "");
196
System.out.println("stopped");
197
write(":dvt:instrument:handle:list?");
198
String s = read(200).trim();
199
System.out.println("handles left " + s);
201
try { Thread.sleep(100); } catch (InterruptedException _) { }
204
private void stepThruRefresh() {
209
private void checkConnectors() {
212
load_setting("try2");
214
switchConnector("3", "1", "on");
215
switchConnector("3", "2", "on");
218
switchConnector("3", "1", "off");
219
switchConnector("3", "2", "off");
223
public static void main(String args[]) {
224
//boolean onlyKill = false;
225
boolean onlyKill = true;
227
HP81250 bert = new HP81250("hp81250");
228
bert.init("HANDLEA");
230
* if(!onlyKill) { //dont use this
231
* bert.load_setting("c:\\81250\\settings\\try_load");
232
* //bert.countConnector(); bert.start(); bert.list();
233
* bert.load_setting("try2"); //for(int i=0; i <3; i++) //{
234
* bert.run(true); //GPIB.waitFor(0.1f); bert.run(false); //
235
* GPIB.waitFor(0.1f); bert.run(true); bert.run(false); //}//end for
236
* //bert.createSetting("code"); //stepThruRefresh(); //int count=1;
237
* //while(count==1) //stepThruRefresh();
241
* else bert.destroyHandle();
243
bert.destroyHandle();