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.

switchstatus in tm4c123gh6pz

Other Parts Discussed in Thread: TM4C123GH6PZ

hi..i'm interfacing one switch status with tm4c123gh6pz by using one GPIO pin(PD6).The switch will give 0v in OFF condition n 2.6v when in ON condition.when i  monitor that switch it always showing high..what is wrong with this???

main()

{

SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN |SYSCTL_XTAL_8MHZ);/*set system clock as 8Mhz*/

SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
GPIOPinTypeGPIOInput(GPIO_PORTD_BASE, GPIO_PIN_6);

while(1)
{

sw_status = (GPIOPinRead(GPIO_PORTD_BASE,GPIO_PIN_6));/*read the switch status*/

if( sw_status == 0x40 )    /*if switch goes high*/
{
adc1 = volts * 0.07022106997;/**/
LCDCM_enWrLCDDgt(adc1,0xc9,4,0);
}
else if(sw_status == 0x00 )     /*if switch goes low*/
{
adc0 = volts * 0.01110370868;/**/
LCDCM_enWrLCDDgt(adc0,0xc9,4,0);

}

}

Thanks in advance