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 day! I try debug in Keil simulator simple blinking program for LPC1227. Program run, but in GPIO window fields PIN not changing(0x00). Startup code generated by Keil master. Problem in the program, simulator or startup code? Thank you
part of program:
#define _BV(X) (1<<X) int main(void) { LPC_SYSCON->SYSAHBCLKCTRL |= 0xE001001FUL; LPC_GPIO0->DIR = _BV(4)|_BV(5); LPC_GPIO0->SET = _BV(4)|_BV(5); /* Generate 1ms Ticks */ SysTick_Config(SystemCoreClock / 1000); while(1) {switch (msTicks) { case 500: msTicks = 0; LPC_GPIO0->CLR = _BV(4)|_BV(5); break; case 100: case 200: case 300: LPC_GPIO0->NOT = _BV(4)|_BV(5); break; } __WFI(); } }
oblem in the program, simulator or startup code?
the result from a simulator is just about as satisfying as simulated sex. You always end up asking "is it the simulator or is it my code".
just a note: most simulators are quite goos for e.g. algorithms, but when it comes to I/O they usually lack severely.
Erik
No. Debugging in a simulator will catch a huge number of bugs that are obviously in the own code. If the simulation prunes 80% of the bugs, it has still been a great help since more time will be available for hunting the remaining 20% when the real hardware prototype finally shows up.
And not only that - a bug found in a simulator that you can't easily conclude is a bug in the application code can often be reproduced by a smaller test program that could be run on a real processor even if you don't have the final hardware needed for running the full program.
load it and you will find out YES!
if the problem is only in the simulator, the code will work on the board.
The posts about simulating I/O with erratic results are just too many to ignore
Thanks for answers. I will work with the test board.