We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
hi, im using lpc1768 development board i have written a code for push button when button pressed led should turn on but the led is not responding to button, it is on always even i checked in keil peripherals(ports)it is going inside the if condition without the pin high here is my code
#include "lpc17xx.h" void delay(uint32_t c) { while(c>0) c--; } int main(void) { SystemInit(); LPC_GPIO0->FIODIR |=(1<<4); LPC_GPIO2->FIODIR &= ~(1<<10); while(1) { if(((LPC_GPIO2->FIOPIN >> 10) & 1) == 1) { LPC_GPIO0->FIOSET=0x00000010; delay(10000); } else { LPC_GPIO0->FIOCLR=0x00000010; delay(10000); } } }
my project is on hold because of this please help me out
thank you
"Connection is proper i checked it". But you don't seem to have indicated any voltage levels measured anywhere. And despite me mentioning it, you haven't given any feedback if the voltages measured differs if you keep the reset button pressed or not.
And how are you debugging? On the real hardware? Using what interface? A JTAG adapter? Have you verified that your project doesn't just start the simulator, in which case you can single-step your program as much as you like without a single instruction being sent to - or run on - the hardware where your "properly connected" button and LED are.
And the simulator will not know anything about button presses on the real hardware. And it will not be able to turn on or off any LED on the real hardware.
I have mentioned it multiple times now, but you haven't given one single indication that you are actually able to run any code on real hardware. So right now, the progress is just about zero.