XMC 2Go Write Your First Program Guide

download XMC 2Go Write Your First Program Guide

of 16

Transcript of XMC 2Go Write Your First Program Guide

  • 8/10/2019 XMC 2Go Write Your First Program Guide

    1/16

    XMC 2Go Write your first program Guide

    Version 1.0

  • 8/10/2019 XMC 2Go Write Your First Program Guide

    2/16

    Preamble

    Dear valued customer,

    thank you for choosing the XMC 2Go Kit with the XMC1100Microcontroller. Did you enjoy your first experience with the XMC2Go already? And did you get appetite for more? Well, thefollowing content is to give you an introduction how to write yourfirst own program. Have fun!

    Page 22014-02-19 Copyright Infineon Technologies AG 2014. All rights reserved.

  • 8/10/2019 XMC 2Go Write Your First Program Guide

    3/16

    Contents

    Toolchain import the factory default program into DAVE

    Modify the User LED blinking frequency

    Define your own messages send by XMC 2Go

    Page 32014-02-19 Copyright Infineon Technologies AG 2014. All rights reserved.

  • 8/10/2019 XMC 2Go Write Your First Program Guide

    4/16

    Import the factory default program intoDAVE

    The easiest way to write an own program is to take an existingone and to modify it. To do so this guide will use thepreprogrammed XMC_2Go_Initial_Start factory default programas reference.

    Please have DAVE and the J -Link Driver installed as described

    in the XMC 2Go Initial start- up Guide, this is the prerequisiteof the following steps.

    Please download the XMC_2Go_Initial_Start project from theXMC 2Go product website (@ www.infineon.com/xmc-dev )

    Now launch DAVE

    Page 42014-02-19 Copyright Infineon Technologies AG 2014. All rights reserved.

    http://www.infineon.com/xmc-devhttp://www.infineon.com/xmc-devhttp://www.infineon.com/xmc-devhttp://www.infineon.com/xmc-dev
  • 8/10/2019 XMC 2Go Write Your First Program Guide

    5/16

    Import the factory default program intoDAVE - contd

    Go to File, Import and DAVE Project

    Page 52014-02-19 Copyright Infineon Technologies AG 2014. All rights reserved.

  • 8/10/2019 XMC 2Go Write Your First Program Guide

    6/16

    Import the factory default program intoDAVE - contd

    Browse to your local directorywhere XMC_2Go_Initial_Startis stored, click Open andFinish

    Page 62014-02-19 Copyright Infineon Technologies AG 2014. All rights reserved.

  • 8/10/2019 XMC 2Go Write Your First Program Guide

    7/16

    Import the factory default program intoDAVE - contd

    Now the XMC_2Go_Initial_Start project is imported in DAVE

    All relevant information of the XMC_2Go_Initial_Start program iscommented in EasyMain.c. Just go to collapsed view to get tothe EasyMain.c file.

    Page 72014-02-19 Copyright Infineon Technologies AG 2014. All rights reserved.

  • 8/10/2019 XMC 2Go Write Your First Program Guide

    8/16

    Contents

    Toolchain import the factory default program into DAVE

    Modify the User LED blinking frequency

    Define your own messages send by XMC 2Go

    Page 82014-02-19 Copyright Infineon Technologies AG 2014. All rights reserved.

  • 8/10/2019 XMC 2Go Write Your First Program Guide

    9/16

    Modify the User LED blinking frequency contd

    Don't forget to build & compile

    Go to debug for code download

    Page 92014-02-19 Copyright Infineon Technologies AG 2014. All rights reserved.

  • 8/10/2019 XMC 2Go Write Your First Program Guide

    10/16

    Modify the User LED blinking frequency

    The XMC_2Go_Initial_Start program toggle the User LEDs every200 ms. The time base to do the toggling is derived from thesystem timer where a timer tick is generated every 100ms.Hence 2 timer ticks are used setup the 200ms toggle period.

    To change the blinking frequency of the User LEDs means

    nothing but to change the time period for toggling. This can beeasily done by changing the number of timer ticks used to dothe LED toggling in the EasyMain.c file.

    Following illustration shows the toogle period increase from200ms to 400ms.

    Page 102014-02-19 Copyright Infineon Technologies AG 2014. All rights reserved.

  • 8/10/2019 XMC 2Go Write Your First Program Guide

    11/16

    Modify the User LED blinking frequency contd

    Switch to Debug Perspective and hit the run button (Resume).The modified program is running now, watch the change of theUser LED blinking frequency.

    Application Hint:

    The XMC_2Go_Initial_Start sends every 2s messages via UART.Use the same principles as just described to change their send

    frequency. Just modify the TICKS_UART_EVENT value. Page 112014-02-19 Copyright Infineon Technologies AG 2014. All rights reserved.

  • 8/10/2019 XMC 2Go Write Your First Program Guide

    12/16

    Contents

    Toolchain import the factory default program into DAVE

    Modify the User LED blinking frequency

    Define your own messages send by XMC 2Go

    Page 122014-02-19 Copyright Infineon Technologies AG 2014. All rights reserved.

  • 8/10/2019 XMC 2Go Write Your First Program Guide

    13/16

    Define your own messages send by XMC 2Go

    The XMC_2Go_Initial_Start factory default program sends twopredefined messages every 2s in an alternating way. These twomessages can be received and displayed by any terminalprogram.

    The best way to show the messages on a terminal program is a

    recap of the XMC 2Go Initial start- up Guide, using the HTermas terminal program.

    Page 132014-02-19 Copyright Infineon Technologies AG 2014. All rights reserved.

    Predefinedmessages sent

    by XMC 2Go

  • 8/10/2019 XMC 2Go Write Your First Program Guide

    14/16

    Define your own messages send by XMC 2Go contd

    To define your own messages simply change the character string inthe EasyMain.c file.Following illustration shows the message change from

    Visit www.infineon.com/XMC to Wazzup

    Visit www.infineonforums.com XMC 2Go rocks!

    Page 142014-02-19 Copyright Infineon Technologies AG 2014. All rights reserved.

  • 8/10/2019 XMC 2Go Write Your First Program Guide

    15/16

    Define your own messages send by XMC2Go contd

    Build & compile, download and run the modified program asmentioned in the previous section.

    Dont forget to setup your terminal program with the respectiveUART settings as illustrated (recap the XMC 2Go Initial start-up Guide) and watch your own defined messages send by the

    XMC 2Go.

    Page 152014-02-19 Copyright Infineon Technologies AG 2014. All rights reserved.

  • 8/10/2019 XMC 2Go Write Your First Program Guide

    16/16