tv301sf/db/tv301sf.proto
author uhoppe
Fri, 14 Mar 2014 11:07:56 +0100
changeset 5 069837c56788
parent 4 8a2328d953f0
permissions -rw-r--r--
Add "Macro Pulse length" to pg9520.

# tv301sf.proto   Uwe Hoppe   Fritz-Haber-Institut der MPG   3/2014
#
# Stream Device Protocol for the Agilent TV 301SF Navigator pumping system.

locktimeout = 5000;
outTerminator = CR;
inTerminator = "";
replytimeout = 1500;
readtimeout  = 100;
extrainput   = Ignore;
iWT          = 175;

### Uses "Window Meanings" protocol
# Format <STX>+<ADDR>+<WIN>+<COM>+<DATA>+<ETX>+<CRC>
# Where
#    <ADDR> (Unit address) = 0x80 (for RS 232) 
#    <ADDR> (Unit address) = 0x80 + device number (0 to 31) (for RS 485) 
#    <WIN> (Window) = string of 3 numeric char indicating the window # ( ‘000’ #to ‘999’)
#    <COM> (Command) = 0x30 to read the window, 0x31 to write into the window 
#    <DATA> = an alphanumeric ASCII string with the data to be written into the window. 
#ADDR = $1
RCOM = 0x30;
WCOM = 0x31;

getStartStop { WIN = "000"; #1=default=Start; 0=Stop
                    out STX,$1,$WIN,$RCOM,ETX"%01<xor>";
                    in  STX,$1,$WIN,"%b"ETX"%01<xor>"; 
                    }

setStartStop { WIN = "000"; #1=default=Start; 0=Stop
                    out STX,$1,$WIN,$WCOM,"%d",ETX"%01<xor>";
                    in  STX,$1,ACK,ETX"%01<xor>";
                    @init { wait $iWT; getStartStop; }
                    }                             

getRemote { WIN = "008"; #1=default=Remote; 0=Serial
                    out STX,$1,$WIN,$RCOM,ETX"%01<xor>";
                    in  STX,$1,$WIN,"%b"ETX"%01<xor>";
                    }

setRemote { WIN = "008"; #1=default=Remote; 0=Serial
                    out STX,$1,$WIN,$WCOM,"%d",ETX"%01<xor>";
                    in  STX,$1,ACK,ETX"%01<xor>";
                    @init { wait $iWT; getRemote; }
                    }                             

getRotFreqSetting { WIN = "120";
                    out STX,$1,$WIN,$RCOM,ETX"%01<xor>";
                    in  STX,$1,$WIN,$RCOM,"%6d"ETX"%01<xor>";
                    }

setRotFreqSetting { WIN = "120"; CDATA= "955";
                    out STX,$1,$WIN,$WCOM,"000%u",ETX"%01<xor>";
                    in  STX,$1,ACK,ETX"%01<xor>";
                    @init { wait $iWT; getRotFreqSetting; wait $iWT; }
                    }

getVentValve { WIN = "122"; #1=default=ON=CLOSE; 0=OPEN=OFF
                    out STX,$1,$WIN,$RCOM,ETX"%01<xor>";
                    in  STX,$1,$WIN,"%b"ETX"%01<xor>"; 
                    }

setVentValve { WIN = "122"; #1=default=ON=CLOSE; 0=OPEN=OFF
                    out STX,$1,$WIN,$WCOM,"%d",ETX"%01<xor>";
                    in  STX,$1,ACK,ETX"%01<xor>";
                    @init { wait $iWT; getVentValve; }
                    }                             

getVentValveOperation {  WIN = "125"; #Automatic = 0
                    out STX,$1,$WIN,$RCOM,ETX"%01<xor>";
                    in  STX,$1,$WIN,"%b"ETX"%01<xor>"; 
                    }

setVentValveOperation { WIN = "125"; #Automatic = 0
                    out STX,$1,$WIN,$WCOM,"%d",ETX"%01<xor>";
                    in  STX,$1,ACK,ETX"%01<xor>";
                    @init { wait $iWT; getVentValveOperation; }
                    }                             

getPumpCurrent { WIN = "200";
                    out STX,$1,$WIN,$RCOM,ETX"%01<xor>";
                    in  STX,$1,$WIN,$RCOM,"%6d"ETX"%01<xor>";
                    }

getPumpVoltage { WIN = "201";
                    out STX,$1,$WIN,$RCOM,ETX"%01<xor>";
                    in  STX,$1,$WIN,$RCOM,"%6d"ETX"%01<xor>";
                    }

getPumpPower { WIN = "202";
                    out STX,$1,$WIN,$RCOM,ETX"%01<xor>";
                    in  STX,$1,$WIN,$RCOM,"%6d"ETX"%01<xor>";
                    }

getDrivingFrequency { WIN = "203";
                    out STX,$1,$WIN,$RCOM,ETX"%01<xor>";
                    in  STX,$1,$WIN,$RCOM,"%6d"ETX"%01<xor>";
                    }

getPumpTemperature { WIN = "204";
                    out STX,$1,$WIN,$RCOM,ETX"%01<xor>";
                    in  STX,$1,$WIN,$RCOM,"%6d"ETX"%01<xor>";
                    }

getPumpStatus { WIN = "205";
                    out STX,$1,$WIN,$RCOM,ETX"%01<xor>";
                    in  STX,$1,$WIN,$RCOM,"%6i"ETX"%01<xor>";
                    }

getErrorCode { WIN = "206";
                    out STX,$1,$WIN,$RCOM,ETX"%01<xor>";
                    in  STX,$1,$WIN,$RCOM,"%o"ETX"%01<xor>";
                    }