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.
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.