#include "inc/lm4f120h5qr.h"
void main(void)
{
unsigned long ulLoop;
SYSCTL_RCGC2_R = 0x00000020; //individual clock gating control reg for specified port (here port f)
GPIO_PORTF_DIR_R = 0x08; //direction register
GPIO_PORTF_DEN_R = 0x08; //data register
GPIO_PORTF_ODR_R = 0x11;//GPIO Open Drain Select for setting as input
GPIO_PORTF_LOCK_R = 0x4C4F434B; //UNLOCK
GPIO_PORTF_CR_R = 0X11; // Set the corresponding bits
GPIO_PORTF_DR2R_R = 0x11;
GPIO_PORTF_PDR_R = 0x11;
while(1)
{
if(GPIO_PORTF_DATA_R & 0x01)
{
GPIO_PORTF_DATA_R &= ~(0x08);
}
else
{
GPIO_PORTF_DATA_R |= (0x08);
for(ulLoop = 0; ulLoop < 50000; ulLoop++);
GPIO_PORTF_DATA_R |= (0x08);
for(ulLoop = 0; ulLoop < 50000; ulLoop++);
}
}
}
↧
anyone help me to program a push buttons on lm4f120h5qr launchpad . im not get any response on my software while i press the push button and struggled for last 3 days and post my code on below.correct me and give some documents
↧