PHYWE XR4.0 driver for LabVIEW™ V1.2 14414

PHYWE XR4.0 driver for LabVIEW™ V1.2
PHYWE Systeme GmbH & Co. KG
Robert-Bosch-Breite 10
D-37079 Göttingen
Phone
Fax
E-mail
14414-62
Operating instructions
+49 (0) 551 604-0
+49 (0) 551 604-107
info@phywe.de
Phywe Systeme GmbH & Co. KG, PHYWE XR4.0 driver for LabVIEW™
End user license agreement
Copyright (c) 2012, PHYWE Systeme GmbH & Co. KG. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
following conditions are met:
•
•
•
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other materials provided with the distribution.
Neither the name of the PHYWE Systeme GmbH & Co. KG nor the names of its contributors may be
used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
LabVIEW™ is a trademark of National Instruments. Neither PHYWE Systeme GmbH & Co. KG, nor any software
programs or other goods or services offered by PHYWE Systeme GmbH & Co. KG, are affiliated with, endorsed
by, or sponsored by National Instruments.
The LabVIEW XRAY driver consists of 3 layers:
•
UART communication layer : implements the low level UART communication
init_device.vi : This VI initialises the device. This includes setting up the UART communication (baud
rate, parity, ...) and retrieving device information like device type and serial number. The input terminals
only need to be wired if other values than the default ones are needed. To minimize the amount of wiring
needed further on, the handle for UART communication, which needs to be passed to other communication VI's, is stored globally.
UART_write.vi : This VI sends a byte array over the UART interface and returns the reply (if there is one
within 25ms). As mentioned above, the handle (the reference to the UART communication channel) is
stored globally in order to avoid excessive wiring.
UART_read.vi : This VI returns the bytes available on the communication interface.
reset_device.vi : This VI resets the UART device
close_device.vi : This VI closes the communication with the XRAY device and purges the corresponding handle.
1
www.phywe.com, © All rights reserved
14414-62 / 1912
! Make sure to close the reference before closing VI's or it may become impossible to reconnect to the device ! If
that's the case, close LabVIEW completely.
•
XRAY communication layer: implements the XRAY communication protocol which translates device functionality to byte arrays which can be sent over the UART interface and interprets the reply from the device.
send_command.vi : This VI takes as inputs a command (or send mode), and if necessary a device parameter and/or data (in byte format). This is then formatted into a suitable byte array to be sent over the
UART interface and the reply is interpreted and checked for consistency. The response mode depends
on the command that was sent and if communication with the device was OK or not. Where appropriate,
data out contains the requested data (still formatted as a byte array).
•
XRAY top level layer: implements top level XRAY functions (or modes). For most applications, this is the
only layer the programmer needs (apart from the init_device.vi and close_device.vi).
read_device_parameter.vi : This VI is used to read a device parameter such as the goniometer mode,
door status etc. The reply is parsed and interpreted to the right datatype. Because an output terminal can
only be one datatype the result is typecasted into a variant and should therefore be typecasted to the
right datatype by the user afterwards. For the list of datatypes of each items, see Table 1. It is recommended to use the typecast_device_parameter.vi in conjunction with an instance of the XRAY status
cluster for automatic typecasting of all variables.
write_device_parameter.vi : This VI is used to write a new value to a device parameter. The input ‘device parameter in’ is a list of those device parameters which can be set programatically. The parameter
value input terminal is a variant. Make sure to wire the correct datatype for the device parameter you
want to write. For the list of datatypes of each items, see Table 1.
Warning ! : the VI automatically coerces out of range input values to the range allowed by the device !
Data request Typ B.vi : This VI performs a single update of the 5 measurement channels and formats
the reply into a cluster with 5 properly named and scaled output channels.
measurement start.vi : This VI sends a command to start a measurement series. To be used in conjunction with the measurement_listen.vi and measurement_stop.vi (see example3.vi).
measurement listen.vi : This VI sends a command to listen to replies during a measurement series. It
should be placed in a while loop. The output ‘remaining bytes out ’ should be wired back to the input ‘remaining bytes in’ through a shift register. Each time a new reading is received the corresponding output
is TRUE and the output‘ last reading’ contains the result. The output ‘measurement stopped ?’ is TRUE if
the device sent back a STOP message. To be used in conjunction with the measurement_start.vi and
measurement_stop.vi (see example3.vi).
measurement stop.vi : This VI sends a command to stop a measurement series. To be used in conjunction with the measurement_listen.vi and measurement_start.vi (see example3.vi).
command_autocalibration.vi : starts the autocalibration procedure
command_light_ON_OFF.vi : switches the light ON or OFF (boolean input)
command_speaker_ON_OFF.vi : switches the speaker ON or OFF (boolean input)
command_XRAY_ON_OFF.vi : switches the X-rays ON or OFF (boolean input)
2
www.phywe.com, © All rights reserved
14414-62 / 1912
Table 1 : Device parameter list :
This table describes all device parameters, their datatype and range, and a description of their meaning.
Description
Hardware version
Firmware version
Deviceclass
High voltage
Current
Door status
Tube status
R/W
R
R
R
R/W
R/W
R
R
Change status
Tube on/off
Light on/off
speaker on/off
Goniometer start angle
R
R
R
R
R/W
Goniometer stop angle
unit
kV
mA
bytes minimum
1
0
2
0
1
2
0
1
0
1
0
1
0
Goniometer increment
Goniometer position
R/W
R
2
2
0
0
GM voltage
GM gate time
Device operating hours
Tube operating hours
Date
R/W
V
R/W sec
R hours
R hours
R/W
2
2
4
4
4
100
0,5
0
0
600
100,0
4,295E+09
4,295E+09
Time
R/W
4
Goniometer mode
R/W
1
0
4
Serial Number Date
Serial Number
Goniometer status
R
R
R
2
4
1
111
0
0
1299
4,295E+09
1
R/W
2
Fix angle
0
0
0
0
0
R/W
°
2
0
R
°
1
0
35,00
1,00
1
7
/
1
1
1
Max. Stop
Value
Max. Stop
Value
Based on the
goniometer
position
10,0
5
Max. Stop value
°
4
1
1
1
2
maximum
255
655,35
data type
string
string
U8
SGL
SGL
Boolean
U8
32 Boolean
Boolean
Boolean
Boolean
SGL
SGL
SGL
SGL
SGL
string
info
XB
0= open, 1= close
0= not ube
1= Mo
2= Fe
3= Cu
4= W
5= Co
6= Ag
7= NN (not used)
see example
0= Tube Off, 1= Tube on
0= Off, 1= On
0= Off, 1= On
SGL
SGL
SGL
U8
string
string
U32
Boolean
0= right outer
1= right middle
2= right
3= left
4= left middle
5= left outer
Byte 3= Year (high)
Byte 2= Year (low)
Byte 1= Month
Byte 0= Day
Byte 3= Hours
Byte 2= Minutes
Byte 1= seconds
Byte 0= not used
0= 1:2 coupling
1= fix Crystal angle
2= fix detector angle
4= Goniometer not used
0211= 02.2011
0= no Goniometer
1= Goniometer detected
SGL
3
www.phywe.com, © All rights reserved
14414-62 / 1912
Timer mode
Start delay
Timer value
Crystal type
R/W
R/W
R/W
R/W
sec
sec
1
2
2
1
0
1
1
0
1
36000
36000
4
Boolean
U16
U16
U8
0= On, 1= Off
0= LiF
1= KBr
2= NaCl 100
3= NaCl 110
4= NaCl 111
To maximize programming efficiency type definitions were created were possible (subfolder typedefs). When
changing a type defenition, all instances of that type will automatically be updated without the need for rewiring
any connections or relinking subVI’s.
channels cluster : describes the data type of the cluster of the 5 measurement channels
device parameters : describes the drop-down control with all possible device parameters
receive modes : describes the different receive modes which the device can return
XRAY status cluster : describes a cluster with the entire device status
change status cluster : describes an array of 32 boolean items that reflect the device parameters that
change since the last update
4
www.phywe.com, © All rights reserved
14414-62 / 1912