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/LAUNCHXL-F28069M: How to read a GPIO pin

Part Number: LAUNCHXL-F28069M
Other Parts Discussed in Thread: C2000WARE

Tool/software: Code Composer Studio

How can we configure a GPIO pin as input and how to read the state of that pin (High/Low)?

  • Have you installed C2000Ware and looked at the examples? Have you read the GPIO chapter of the technical reference manual?

    I couldn't find an example that uses a GPIO as an input, but it essentially is this:

        EALLOW;
        // Configure GPIO0 as an input
        GpioCtrlRegs.GPAMUX1.bit.GPIO0 = 0;
        GpioCtrlRegs.GPADIR.bit.GPIO0 = 0;
        EDIS;
    
        // Read value on GPIO0 into variable
        uint16_t pinValue;
        pinValue = GpioDataRegs.GPADAT.bit.GPIO0;

    Whitney

  • Hi

    Thanks for the response. I've tried this and now I'm getting an error as "GpioCtrlRegs not found". What should I do??

  • Are you using C2000Ware? Are you setting up your project according to chapter 3 in the F2806x Firmware Development Package User Guide? It will walk you through what files you need in your project and the different compiler settings you'll need to configure to use the bit field structure header files (like the one that includes GpioCtrlRegs).

    The document I mentioned can be found in C2000Ware_x_xx_xx_xx\device_support\f2806x\docs\F2806x_DEV_USER_GUIDE.pdf

    Whitney