From: Dominik C. <do...@ca...> - 2006-03-22 17:58:31
|
I have this code with a nested for loop and when I flash the micro it just hangs. On port 2 there are 8 leds, so it should be like a binary counter. If I only have the outer loop it works, but it is too fast, so I only see the MSB blinking. When I load the program with the debugger it crashes. Thanks for the answers. #include "LPC935_936.h" void sys_init( void ) { P2M1 = 0x00; P2M2 = 0x00; } void main(void) { char i,j; char temp = 0; sys_init(); while(1) { for(i = 255; i > 0; i--) { for(j = 5; j > 0; j--); } temp++; P2 = temp; } } |