This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS/TM4C123GH6PM: How to read on board Switch using Interrupts.

Part Number: TM4C123GH6PM

Tool/software: Code Composer Studio

Hey, guys I am completely new to using Tiva C series.

Could you please suggest a way to read on-board switches in  TM4C123GH6PM using Interrupts and to count the number of times the switch is pressed.

Thank you.

  • Suhas,

    Did you download and install Tivaware? If not, that's the first thing you need to do.

    Then, in the /examples folder, you will find some simple and proven examples which show interrupts running. Also, there are examples for configuring GPIO's.

    In the /docs folder you will find a lot of PDF files. Start by looking at the larger file, that has UG on the name (User Guide). Look at the GPIO chapter, which shows a lot of useful functions to configure and read the pins, and also look at the system control / interrupts chapter for that part.

    As for "counting how many times the switch was pressed", I assume you know basic C programming, correct?

    Bruno

  • Suhas Raju said:
    I am completely new to using Tiva C series ... (seek) to read on-board switches ... using Interrupts 

    In general - the edited (reduced) quote (above) nicely describes your objective - but for your:

    • experience level/comfort" w/non TM4C MCUs
    • programming skill in general.    

    Both would prove helpful - would they not?     (lack of such forces one to, "assume.")

    Friend Bruno has provided a neat "launch base" for your effort - yet "many" arrive here w/similar questions - suggesting that this vendor needs to enhance & better promote their "beginner guide" efforts.    (such guides are available - yet scattered - thus (needlessly) challenging to discover - and for (never explained) reasons - not directly accessible from this forum!)      (SO wrong - and strange - that!)

    At times it proves wise to "tweak or modify" user goals - in your case I believe your "desire for interrupts" adds great complexity - and occurs "too soon" - for one "completely new to TM4C!"

    There is a key design concept called "KISS" - which enforces great focus & discipline upon such efforts - and guides (most) to, "Speeded, Eased, & Enhanced" results.    KISS argues against any "premature introduction" of complexity - which the (unexplained) "quest for interrupts" - surely presents.     Interrupts prove difficult for most here to, "wrap their heads around" - contain many nuances which require "time & effort" to recognize, abide by & appreciate - and most importantly - prove "Not required" for you to "read on-board switches."     In fact - your introduction of "interrupts" (by far) - presents the greatest "peril" to your project.

    KISS compliant procedure would see you - far more quickly & easily - achieve your goal (without) use of interrupts!     Such yields the fastest & most efficient (real) learning.    Only once that's been achieved - should the 'battle-ground" move to "interrupt's arena."     (be advised that the "lions" there - are especially fierce...)