??? 05/10/09 07:40 Read: times |
#165214 - You are reading the wrong book! Responding to: ???'s previous message |
Johnson Vue said:
I use the Generic 8051 (all Variants) 8051 Based CMOS or NMOS Microcontroller with 32 I/O lines, 2 Timers/Counters, 5 Interrupts/2 Priority Levels, 4K Bytes ROM, 128 Bytes on-chip RAM as a testing platform. I added STARTUP.A51 and XBANKING.A51 into my project. So, you are using the uVision Simulator - not an emulator: http://www.8052.com/faqs/119898 I said:
Where do you think this will return to? I don't know, that is how C is written in the book I am reading. That'll be a book about 'C' programming for PCs and similar systems, then? So I thought it was okay to leave return 0 there. So it's not okay? Not in a (simple) embedded system like this! You have no operating system to return to! Therefore, the behaviour is undefined - most probably, it just keeps running through the entire memory space, trying to execute whatever it finds as instructions, until the program counter eventually reaches FFFF, rolls-over to 0000 - and the whole program starts again from the beginning. This would explain why your program appears to be "slow"! This is the code from my book Again, it must be a PC-type book. That'll be good for you to use on a PC while you learn the 'C' language - but you'll need a different book to apply that in embedded systesm! http://www.keil.com/books/ |
Topic | Author | Date |
Program runs really slow | 01/01/70 00:00 | |
More detail required | 01/01/70 00:00 | |
RE: Andy | 01/01/70 00:00 | |
You are reading the wrong book! | 01/01/70 00:00 | |
program will not compile![]() | 01/01/70 00:00 |