gclib  437
Communications API for Galil controllers and PLCs
clang.md
1 # clang (OS X) {#clang}
2 
3 The following instructions were performed on
4 
5  $ sw_vers
6  ProductName: Mac OS X
7  ProductVersion: 10.10.5
8  BuildVersion: 14F27
9  $ gcc --version
10  Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
11  Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)
12  Target: x86_64-apple-darwin14.5.0
13  Thread model: posix
14 
15 ## Copy Files
16 
17  $ cd ~
18  $ mkdir test
19  $ cd test
20  $ tar -xzf /Applications/gclib/examples/gclib_examples.tar.gz
21  $ cp /Applications/gclib/include/* .
22  $ cp /Applications/gclib/dylib/* .
23  $ ls
24  gclib.0.dylib x_arrays.cpp x_gmotioncomplete.cpp
25  gclib.h x_examples.cpp x_gread_gwrite.cpp
26  gclib_errors.h x_examples.h x_grecord.cpp
27  gclib_record.h x_gcommand.cpp x_nonblocking.cpp
28  gclibo.0.dylib x_ginterrupt.cpp x_programs.cpp
29  gclibo.h x_gmessage.cpp x_simple.c
30 
31 ##
32 
33 ## x_simple.c
34 
35 * In a text editor, open *x_simple.c*. Find the GOpen() call and update the address to match the desired hardware. See the documentation for GOpen() for address formatting options.
36 
37 ### Compile
38 
39  $ gcc -Wall -Werror x_simple.c gclib.0.dylib gclibo.0.dylib -o simple
40 
41 ### Run
42 
43  $ ./simple
44  rc: 0
45  version: 126.108.229
46  rc: 0
47  rc: 0
48  info: 10.1.3.142, DMC4020 Rev 1.2a-BH, 291
49  rc: 0
50  response: 206676.0000
51  :
52 
53 ## x_examples.cpp
54 * In a text editor, open *x_examples.cpp*. Find the GOpen() call and update the address to match the desired hardware. See the documentation for GOpen() for address formatting options. Don't forget `-s ALL` if data records, interrupts, and messages are to be tested.
55 * Find the `#if 0` preprocessor block enclosing the example calls. Change to `#if 1` to run the examples. Comment out the function calls to be avoided. Note some calls attempt to move motors and not all functions are compatible with all Galil products.
56 
57 ### Compile
58 
59  $ g++ x_*.cpp gclib.0.dylib gclibo.0.dylib -o example
60 
61 ### Run
62 
63  $ ./example
64  Library version: 126.108.229
65 
66  10.1.3.142, DMC4020 Rev 1.2a-BH, 291
67 
68  ************************************************************************
69  Example GRead() and GWrite() usage
70  ************************************************************************
71 
72  Read 1 byte(s)
73  :
74  Program test OK.
75 
76  ************************************************************************
77  Example GCommand() usage
78  ************************************************************************
79  Revision report, ^R^V
80  DMC4020 Rev 1.2a-BH
81  :
82 
83  Command Values
84  val is 10
85  val is 11
86  val is 3.1415
87  val is 9.869
88 
89  Command Trimming
90  > 408978.0000
91  :<
92  > 408978.0000<
93  >408978.0000<
94 
95  Receiving Binary Data
96  QR read 155 bytes
97 
98  Error handling
99  QD correctly trapped, not allowed, try GArrayDownload()
100  DL correctly trapped, not allowed, try GProgramDownload()
101 
102  Modifying timeout
103  Burning program...OK
104 
105  ************************************************************************
106  Example GProgramDownload() and GProgramUpload() usage
107  ************************************************************************
108  GProgramDownload() correctly errored. Can't fit with level 3 compression
109  Program Downloaded with compression level 4
110  Uploading program:
111  #A;i=0;i=i+1;i=i+1;i=i+1;i=i+1;i=i+1;i=i+1;i=i+1;i=i+1;i=i+1;i=i+1;i=i+1;i=i+1
112  i=i+1;i=i+1;i=i+1;i=i+1;i=i+1;i=i+1;i=i+1;i=i+1;EN
113 
114  Program executed as expected
115  ************************************************************************
116  Example GArrayDownload(), GArrayUploadFile()
117  GArrayDownloadFile(), and GArrayUpload usage
118  ************************************************************************
119  2.0000, 4.0000, 6.0000, 8.0000, 10.0000, 12.0000, 14.0000, 16.0000, 18.0000, 20.0000
120 
121  2.0000, 1.0000, 3.0000, 5.0000, 10.0000, 12.0000, 14.0000, 16.0000, 18.0000, 20.0000
122 
123  3.0000, 5.0000, 10.0000
124  2.0000, 1.0000, 3.0000, 5.0000, 10.0000, 12.0000, 14.0000, 16.0000, 18.0000, 20.0000
125 
126 
127  ************************************************************************
128  Example GRecord() usage
129  ************************************************************************
130 
131  QR-based data record
132  18358
133  0
134 
135  DR-based data record
136  18462
137  18564
138  18666
139  18768
140  18870
141  18972
142  19074
143  19176
144  19278
145  19380
146  19482
147 
148  QR-based data record with offsets
149  19482
150  19482
151 
152  ************************************************************************
153  Example GMessage() usage
154  ************************************************************************
155  0.0000
156  1.0000
157  2.0000
158  3.0000
159  4.0000
160  5.0000
161  6.0000
162  7.0000
163  8.0000
164  9.0000
165 
166  ************************************************************************
167  Example GInterrupt() usage
168  ************************************************************************
169  "UI 8" executed.
170 
171  ************************************************************************
172  Example GMotionComplete() usage
173  ************************************************************************
174 
175  Position: 0, 0
176  Beginning independent motion... Motion Complete on A
177  Position: 8000, 0
178 
179  Position: 0, 0
180  Beginning vector motion... Motion Complete on vector plane S
181  Position: 6000, 0
182 
183  ************************************************************************
184  Example GMessage non-blocking usage
185  ************************************************************************
186  422902.0000
187 
188 
189  ************************************************************************
190  Example GInterrupt non-blocking usage
191  ************************************************************************
192  F1
193 
194  ************************************************************************
195  Example GRecord non-blocking usage
196  ************************************************************************
197  33786
198 
199 
200  examples.cpp executed OK
201  main() is finished. Press Enter to exit: