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.

TM4C1294NCPDT: GPIOPinWrite PM1&PM2 not working.

Part Number: TM4C1294NCPDT


Tool/software:

Hi,

I'm trying to use GPIOPinWrite function on Port M Pins 1 and 2 and the output doesn't change to 1.

ROM_GPIOPinTypeGPIOOutput(GPIO_PORTM_BASE, GPIO_PIN_0);

ROM_GPIOPinTypeGPIOOutput(GPIO_PORTM_BASE, GPIO_PIN_1);

ROM_GPIOPinTypeGPIOOutput(GPIO_PORTM_BASE, GPIO_PIN_2);

and then in another function:

GPIOPinWrite (GPIO_PORTM_BASE, GPIO_PIN_1, 1);   // Not Working

GPIOPinWrite (GPIO_PORTM_BASE, GPIO_PIN_0, 1);   // Working

GPIOPinWrite (GPIO_PORTM_BASE, GPIO_PIN_2, 1);   // Not Working

I don't see any reason for this. 

I really appreciate your help!

Tzipi

  • and then in another function:

    GPIOPinWrite (GPIO_PORTM_BASE, GPIO_PIN_1, 1);   // Not Working

    GPIOPinWrite (GPIO_PORTM_BASE, GPIO_PIN_0, 1);   // Working

    GPIOPinWrite (GPIO_PORTM_BASE, GPIO_PIN_2, 1);   // Not Working

    Your code is not correct. If you want to set PM1 high you need to write as follows. GPIO_PIN_0 is the first bit of the port while GPIO_PIN_1 is the second bit of the port and likewise GPIO_PIN_2 is at the third bit of the port. It is a bit-pack value. 

    GPIOPinWrite (GPIO_PORTM_BASE, GPIO_PIN_1, GPIO_PIN_1);  

    GPIOPinWrite (GPIO_PORTM_BASE, GPIO_PIN_0, GPIO_PIN_0);   

    GPIOPinWrite (GPIO_PORTM_BASE, GPIO_PIN_2, GPIO_PIN_2);  

  • Thank you Charles! 

    This resolved my problem Slight smile

    Another question: if I want to set PM1 to low, how to do it?

    like this

    GPIOPinWrite (GPIO_PORTM_BASE, GPIO_PIN_1, 0);  

    ?

    Thank you!

  • Another question: if I want to set PM1 to low, how to do it?

    like this

    GPIOPinWrite (GPIO_PORTM_BASE, GPIO_PIN_1, 0);  

    That is correct.