www.beck-ipc.com

GMLib - GM0x - Examples


     Documentation Index

Examples

Beck IPC provides several source code examples as templates for building own customized GM0x applications.

Attention:
For all examples, please change the SIM PIN according to your SIM PIN!
Entering the wrong SIM PIN may result in locking your SIM card!

The examples are part of the archive GM0x_Vxx.zip.
Please note: Even though the examples are named GM01EX_xx, they can be used with the GM01 and the GM02 module.

In addition to the several examples, this archive also contains the subfolder GMLIB.
This directory provides at its subdirectories:

  • Current GM0x library gmlib.lib for the Paradigm C/C++ Beck IPC Edition compiler
  • Current GM0x library include files

Please note: The GMLIB library and include files for the ONE-Workbench are available over the ONE-Workbench online update.
Examples:

  • GM01EX_01
  • GM01EX_02
  • GM01EX_03
  • GM01EX_04
  • GM01EX_05
  • GM01EX_06

  • GM01EX_01: Example for establishing a GPRS connection (values in CHIP.INI)

    GM01Ex_01 is an example program to show how to establish a GPRS connection with the internet. The init values are read from CHIP.INI. The example directory holds a subdirectory called "Image", which holds CHIP.INI examples for the development boards DK60, DB54 and DB240. Please use the CHIP.INI according to your development board and modify the settings for your environment (PIN, PPP GPRS connect string etc.)

    A detailed explanation of GM01Ex_01 can be found in the FB60-GM01 getting started document.


    Top of list
    Index page

    GM01EX_02: Example for establishing a GPRS connection (values in source code)

    The second example GM01Ex_02 is very similar to GM01Ex_01 but the initialization and PPP data is not read from CHIP.INI. They are defined in the source code. Instead of gmInit() the function gmInitExt() is used with the following parameters:

    gmInitParameters myInit =
    { 
      2,  // serial port -> DK60 = FOSSIL_SER2 (2), DB54 = FOSSIL_SER2 (2), DB240 = FOSSIL_UART4 (3)
      0,  // IGN pio -> DK60 = 0, DB54 = 0, DB240 = 31
      1,  // DCD pio -> DK60 = 1, DB54 = 12, DB240 = 24
      17, // Reset state indication pio -> DK60 = 17, DB54 = 2, DB240 = 28
      "", // PIN 
      ""  // PUK
    };
                
    Also gmPPPGPRSOpen is replaced by gmPPPGPRSOpenExt with connection parameters:

    retval = gmPPPGPRSOpenExt(2, "d2", "d2", "AT+CGDCONT=1,\"IP\",\"volume.d2gprs.de\"", "ATD*99***1#", 0, 1);

    Please change all parameters for your hardware (DK60/DB54/DB240) and according to your mobile provider.

    Top of list
    Index page

    GM01EX_03: Example for establishing a GSM connection

    GM01Ex_03 is an example program to show how to establish a GSM connection with the internet.
    It is similar to GM01Ex_02 but does not establish a GPRS connection, but a GSM data connection.

    Please change all parameters for your hardware (DK60/DB54/DB240) and according to your mobile provider.


    Top of list
    Index page

    GM01EX_04: Sending and receiving SMS

    GM01Ex_04 shows how to send and receive short messages (SMS). It checks periodically for new received SMS.
    If the user presses "s" on the console, a SMS will be send to the number defined in smsRecipient.

    Please change all parameters for your hardware (DK60/DB54/DB240) and according to your mobile provider.


    Top of list
    Index page

    GM01EX_05: Installing a SMS callback task

    GM01Ex_05 shows how to install a SMS callback task.This task will periodically check for new SMS.

    Please note that most of the callback calls will be made in the context of the SMS task. Therefore processing should be kept at a minimum in the callback function. The user callback function should set a flag or increase a counter and signal the user application task.

    Please change all parameters for your hardware (DK60/DB54/DB240) and according to your mobile provider.


    Top of list
    Index page

    GM01EX_06: Writing data to SIM/GM0x

    GM01Ex_06 shows demonstrates the storage functions of the GM0x.

    Pressing "d" on the console deletes the 512 Byte storage of the GM0x and SIM phonebook.
    Pressing "w" writes the string "This is a text" to both GM0x and SIM phonebook storage to the offset 100.
    Pressing "r" reads and prints
    14 bytes from offset 100 of the GM0x storage ("is a text") and
    14 bytes from offset 100 of the SIM card ("This is a text")

    In addition:
    Pressing "t" sets and reads the time "09/10/14,02:00:57-08" to the GM0x.

    Please change all parameters for your hardware (DK60/DB54/DB240) and according to your mobile provider.


    Top of list
    Index page