Hi, there,
I am new to ARM and just downloaded MDK3.70 demo to try to get Blinky to run on lpc2106.
I set up uvision3, and wired up the schematic in Proteus (7.1), since I already downloaded an almost identical program there - with a .hex file. the program is to flash LEDs linked to P0.0-P0.7. The Proteus simulation, with the pre-made .hex file, worked well.
so I decided to produce my own .hex file in uvision3, see below.
=========code=========== #include <LPC210x.H> /* LPC210x definitions */
void wait (void) { /* wait function */ ; /* only to delay for LED flashes */ }
int main (void) { // unsigned int i; /* Delay var */ // unsigned int j; /* LED var */
PINSEL0=0x00; IODIR = 0xFF; // P0.0..7 defined as Outputs */
while (1) { IOSET=0xff; //?? IOCLR=0xff; } }
========end of code==============
I didn't put the wait() function there for simplicity.
well, uvision did produce a .hex file. I loaded the file to the proteus simulation, and replaced the pre-made .hex. no go. all ports are in high impedance mode and nothing happened.
I would appreciate very much if you can point me in the right direction. I am thinking the problem is likely caused by my uvision not producing the right .hex file (wrong settings somewhere?) but I am not sure where to start.
your help is greatly appreciated. Thanks.
sorry for the messy posting.
I am learning the "pre" tag, :)
#include <LPC210x.H> /* LPC210x definitions */ void wait(void) { int i,dly; for (dly=10;dly>0;dly--) for(i=0;i<50000;i++); } /**************************************************************** *??: main() *??: ??LED? ****************************************************************/ int main(void) { PINSEL0=0x00; //??????GPIO IODIR= 0xff; //????? while(1){ IOSET=0xff; //?? wait(); IOCLR=0xff; } }
not that it is good practice, but don't the behavior of your program change if you declare the loop variables as volatile...?