From 3f24916905c7321b7e6e7d8a8045f8a67c711052 Mon Sep 17 00:00:00 2001 From: rivers Date: Tue, 18 May 2010 23:20:03 +0000 Subject: [PATCH] Add notes about how to convert strings to byte arrays in IDL and SPEC git-svn-id: https://subversion.xor.aps.anl.gov/synApps/areaDetector/trunk@10996 dc6c5ff5-0b8b-c028-a01f-ffb33f00fc8b --- documentation/areaDetectorDoc.html | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/documentation/areaDetectorDoc.html b/documentation/areaDetectorDoc.html index 5a7903d..7c0c1fb 100755 --- a/documentation/areaDetectorDoc.html +++ b/documentation/areaDetectorDoc.html @@ -386,8 +386,26 @@ = UCHAR. This removes the 40 character restriction string lengths that arise if an EPICS "string" PV is used. MEDM allows one to edit and display such records correctly. EPICS clients will typically need to convert such long strings from a string to - an integer or byte array before sending the path name to EPICS. This is easy to - do in clients like SPEC, Matlab, and IDL. + an integer or byte array before sending the path name to EPICS. In IDL this is done as follows: +
+      ; Convert a string to a null-terminated byte array and write with caput
+      IDL> t = caput('13PS1:TIFF1:FilePath', [byte('/home/epics/scratch'),0B])
+      ; Read a null terminated byte array 
+      IDL> t = caget('13PS1:TIFF1:FilePath', v)
+      ; Convert to a string 
+      IDL> s = string(v) 
+      
+ In SPEC this is done as follows: +
+      array _temp[256]
+      # Setting the array to "" will zero-fill it
+      _temp = ""
+      # Copy the string to the array.  Note, this does not null terminate, so if array already contains
+      # a longer string it needs to first be zeroed by setting it to "".
+      _temp = "/home/epics/scratch"
+      epics_put("13PS1:TIFF1:FilePath", _temp)
+      
+

Note that for parameters whose values are defined by enum values (e.g NDDataType,