| gclib 1.35.5 Communications API for Galil controllers and PLCs |

gcc (Linux)

The following instructions were performed on

    $ uname -a
    Linux localhost.localdomain 3.17.4-301.fc21.x86_64 #1 SMP Thu Nov 27 19:09:10 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
    $ g++ --version
    g++ (GCC) 4.9.2 20150212 (Red Hat 4.9.2-6)

# Copy Files

    $ mkdir test
    $ cd test
    $ tar -xzf /usr/share/doc/gclib/src/gclib_examples.tar.gz
    $ ls
    x_arrays.cpp    x_gcommand.cpp    x_gmotioncomplete.cpp  x_programs.cpp
    x_examples.cpp  x_ginterrupt.cpp  x_gread_gwrite.cpp     x_simple.c
    x_examples.h    x_gmessage.cpp    x_grecord.cpp

# x_simple.c

- 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.

## Compile

    $ gcc -Wall -Werror x_simple.c -lgclib -lgclibo -o simple

## Run

    $ ./simple
    rc: 0
    version: 85.60.131
    rc: 0
    rc: 0
    info: 10.1.3.17, DMC4020 Rev 1.2b, 291
    rc: 0
    response:  179340166.0000
    :

# x_examples.cpp

- 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.
- 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.

## Compile

    $ g++ x_*.cpp -lgclib -lgclibo -o example

## Run

$./example Library version: 85.60.131

10.1.3.17, DMC4020 Rev 1.2b, 291

Example GRead() and GWrite() usage

Read 155 QR bytes.

Example GCommand() usage

Revision report, ^R^V DMC4020 Rev 1.2b :

Command Values val is 10 val is 11 val is 3.1415 val is 9.869

Command Trimming > 179798738.0000 :< > 179798738.0000< >179798738.0000<

Receiving Binary Data QR read 155 bytes

Error handling QD correctly trapped, not allowed, try GArrayDownload() DL correctly trapped, not allowed, try GProgramDownload()

Modifying timeout Burning program...OK

Example GProgramDownload() and GProgramUpload() usage

GProgramDownload() correctly errored. Can't fit with level 3 compression Program Downloaded with compression level 4 Uploading program: #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 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

Program executed as expected

Example GArrayDownload(), GArrayUploadFile() GArrayDownloadFile(), and GArrayUpload usage

2.0000, 4.0000, 6.0000, 8.0000, 10.0000, 12.0000, 14.0000, 16.0000, 18.0000, 20.0000

2.0000, 1.0000, 3.0000, 5.0000, 10.0000, 12.0000, 14.0000, 16.0000, 18.0000, 20.0000

3.0000, 5.0000, 10.0000 2.0000, 1.0000, 3.0000, 5.0000, 10.0000, 12.0000, 14.0000, 16.0000, 18.0000, 20.0000

Example GRecord() usage

QR-based data record 36100 6000

DR-based data record 36204 36306 36408 36510 36612 36714 36816 36918 37020 37122 37224

QR-based data record with offsets 37224 37224

Example GMessage() usage

0.0000 1.0000 2.0000 3.0000 4.0000 5.0000 6.0000 7.0000 8.0000 9.0000

Example GInterrupt() usage

"UI 8" executed.

Example GMotionComplete() usage

Position: 0, 0 Beginning independent motion... Motion Complete on A Position: 8000, 0

Position: 0, 0 Beginning vector motion... Motion Complete on vector plane S Position: 6000, 0

examples.cpp executed OK main() is finished. Press Enter to exit: