| gclib 386 Communications API for Galil controllers and PLCs |

All Data Structures Files Functions Variables Typedefs Macros Pages
MinGW

The following instructions were performed with x86 Minimalist GNU for Windows (MinGW) installed from http://mingw-w64.sourceforge.net/download.php#mingw-builds

For brevity, these instructions assume the default installation location of "C:\Program Files (x86)\Galil\gclib".

## Copy Files

Copy "gclib\examples\mingw" to a convenient, writable location, e.g. "C:\temp". Run `C:\temp\mingw\copy_source.bat` to copy all files.

## x_simple.c

### Edit GOpen() call as necessary

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

- Launch the MinGW terminal, e.g. Start -> All Programs -> MinGW-W64 project -> i686-4.9.1-posix-dwarf-rt_v3-rev3 -> Run Terminal.
- Navigate to the directory with the files above.
- Compile the code.

    C:\temp\mingw\>gcc x_simple.c -L. -lgclibo -lgclib -o simple.exe

### Execute

    C:\temp\mingw>simple.exe
    rc: 0
    version: 85.60.138
    rc: 0
    rc: 0
    info: 10.1.3.17, DMC4020 Rev 1.2b, 291
    rc: 0
    response:  1584328.0000
    :

## x_examples.cpp

### Review and Modify source

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

- Launch the MinGW terminal, e.g. Start -> All Programs -> MinGW-W64 project -> i686-4.9.1-posix-dwarf-rt_v3-rev3 -> Run Terminal.
- Navigate to the directory with the files above.
- Compile the code.

    C:\temp\mingw>g++ *.cpp -L. -lgclibo -lgclib -o examples.exe

### Execute

    C:\temp\mingw>examples.exe
    Library version: 41.35.34

    192.168.0.43, 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
    > 95653016.0000
    :<
    > 95653016.0000<
    >95653016.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=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() and GArrayUpload() usage
    ************************************************************************
    2.0000, 4.0000, 6.0000, 8.0000, 10.0000, 12.0000, 14.0000, 16.0000, 18.000
    0000

    2.0000, 1.0000, 3.0000, 5.0000, 10.0000, 12.0000, 14.0000, 16.0000, 18.000
    0000

    3.0000, 5.0000, 10.0000

    ************************************************************************
    Example GRecord() usage
    ************************************************************************

    QR-based data record
    38564
    393216000

    DR-based data record
    38670
    38772
    38874
    38976
    39078
    39180
    39282
    39384
    39486
    39588
    39690

    QR-based data record with offsets
    39692
    39692

    ************************************************************************
    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: