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.
Good morning guys,
I have got a problem with LPC2148. I am using PORT0 as GPIO pins. The program runs fine in the simulator but there is nothing when i port the hex on the board.
Here is the code:
#include<lpc214x.h> #include "delay.h"
void main() { PINSEL0=0x00000000; IODIR0=0xffffffff;
while(1) { IOPIN0=0xffffffff; delay(500); IOPIN0=0x00000000; delay(500); } }
delay is nothing but come commands running during that time. Simulator shows good behaviour of delay functions.
I have checked on "Use Memory layout from the target dialog". But still no output. Am i doing something wrong in the code. or should i take care of something else too? Please help.
What, exactly, does that mean?
What tests, exactly, have you done?
What results were you expecting from those tests?
What results did you actually get?
What have you done to investigate/explain any discrepancy/ies?
www.catb.org/.../smart-questions.html
Try increasing the delay from nothing.
Sorry for the inconvenience.
It means that when i port the hex file on the LPC2148 board, the leds which are connected to PORT0 of the development board(LPC2148) does not blink but the Status of PORT0 pins change accordingly in the simulator.
1.What test,exactly, you have done? I have not done any major tests except tried using PORT1 of LPC2148 instead of PORT0. But this is did not change anything.
2. What result were you expecting? I was expecting the Leds to switch ON for 500 milliseconds and switch off for 500 milliseconds.
3. What results did you get? The PORT pins are not getting high and low as expected. The PINS are not even getting high. There is only sync current which is making the Leds high at very low intensity.
4. What have you done to investigate the dependencies?
I have cross-checked every register and the data i am giving them.
I hope that now i have stated the problem clearly.
Is there a possibility that The actual frequency of the development is as high as 60Mhz and i am programming it at some low frequency(May be at 12Mhz). If that is the case, how do i change the XTAL frequency in keil?
So are you sure that delay(500) actually gives you a delay of 500ms?
Are the LEDs wired correctly?
Have you single-stepped the code to see if the LED state changes after the IOPIN0 assignments?
"Is there a possibility that The actual frequency of the development is as high as 60MHz"
There doesn't seem to be anything in your code that configures the speed, so it will be running at whatever default the chip uses - see the Datasheet and/or User Manual for details.
Andy - it isn't uncommon that the startup file configures the CPU frequency from settings specified using Keil's Configuration Wizard.
I haven't checked what Keil do for new projects, but for projects created with uVision 3, you don't have any clock code in main() - the startup file takes care of the PLL and the peripherial clock divisors for NXP LPC21xx projects.
Anyway - any project where the delay time is much too short will result in port pins toggling so fast that the LED:s will just glow at 50% intensity. Our eyes can't see if they blink with 50% duty cycle.
hey, I have a fix for you. I was stuck at same place for about a week. its not a problem with delay element or your IC. its about your compiler settings. Steps to fix it: 1: open keil. 2: open flash from top menu. 3: click on configure flash tools. 4: go on to linker. 5: check the first three boxes. Now your code should work just fine. hope this helps!