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.

tiva TMc1234 switch program

dear sir,

this is my code and i am not getting proper output just go through my code and assist me...
#include <stdint.h>
#include <stdbool.h>
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "driverlib/sysctl.h"
#include "driverlib/gpio.h"
uint8_t ui8PinData=14;
void (PORTFIntHandler)(void);
int main(void)
{
SysCtlClockSet(SYSCTL_SYSDIV_5|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3);
GPIOIntRegister(GPIO_PORTF_BASE, PORTFIntHandler);
GPIOPinTypeGPIOInput(GPIO_PORTF_BASE,GPIO_PIN_0 | GPIO_PIN_4);
GPIOIntTypeSet(GPIO_PORTF_BASE, GPIO_PIN_0 | GPIO_PIN_4, GPIO_RISING_EDGE);
GPIODirModeGet(GPIO_PORTF_BASE,GPIO_PIN_0 | GPIO_PIN_4);
GPIODirModeSet(GPIO_PORTF_BASE,GPIO_PIN_0 | GPIO_PIN_4,GPIO_DIR_MODE_IN);
GPIOIntEnable(GPIO_PORTF_BASE, GPIO_INT_PIN_0 | GPIO_INT_PIN_4);
}
void PORTFIntHandler(void)
{
while(1)
{
if(GPIOPinRead(GPIO_PORTF_BASE,(GPIO_PIN_0 | GPIO_PIN_4)))
{
GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3, ui8PinData);
SysCtlDelay(2000000);
}
else
GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3, 0x00);
}
}

  • MOHAMMAD NASEER M N said:
    not getting proper output just go through my code and assist me...

    Minus any, "please" - this comes across as a command - does it not?    Can that be good - prove motivating - to your (potential) helpers?

    Have you not a near identical post - presently just "one forum space removed" from this one?   Overloading this forum space may not prove effective & usually is frowned upon.

  • sir,
    i dint get what u replied me ....can u message me in clear ...
    thank u
  • My friend - it will (really) assist you to really read/review the, "Peripheral Library User Guide."

    There - under the GPIO section - you'll find: "GPIOPadConfigSet()" and that function includes the ability to enable, "GPIO_PIN_TYPE_STD_WPU" (or its counterpart) "WPD" - one of which is usually required so that your MCU may "see" a switch closure.    Switch may close to ground or to Vcc - when closing to ground you must use "WPU" - when closing to Vcc - "WPD."

    Have you access to a voltmeter?    You must insure that your switch (really) causes a notable change in the voltage level at the MCU pin.   Be very slow/cautious in probing - best done (away) from the MCU pin - at board's header if possible - to measure and confirm that the switch really does cause a major change in voltage level - at the target MCU pin.

  • thank u sir......for ur continuos support....