Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
03/18/07 20:32
Read: times


 
#135218 - try this
Responding to: ???'s previous message
M. Astiz said:
Hi Mike,

The program runs in an infinite loop, changing the value of the ports. As I said before, it runs fine when using P1, for example.

Mikel

What you need to understand with microcontrollers with flash is that there is a limited amount of memory on the chip.

Once it exceeds that, some chips go ahead and read the external memory.

The reason why I suggested an endless loop at the end of your code is so that the micro won't go to external memory.

If it ran fine when you used P1, then there is something attached to P1 that is causing your program to jump to a valid location.

First, you need to determine the amount of EEPROM your microcontroller has (for storing code). I'll call this the code space.

Then make sure your code size is equal to or less than the code space. If your code is even one byte over, then this can cause problems. It is OK to have fewer bytes of code.

Now, make sure you terminate your code like I described, or at least have the microcontroller jump to a lower address.

For example, Make your code something like this:


start:
--code goes here--
section1:
--more code goes here--
ljmp section1


or make it like this:


start:
--code goes here--
--more code goes here--
section1:
ljmp section1


this can be good too:


start:
--code goes here--
--more code goes here--
ljmp start


BUT disasters can happen if your jump statement is not completely within code space.

For example, if at byte 7999 you started the ljump command, and your code rom space is exactly 8000 bytes (0 to 7999), then you will be in trouble, because in code, LJMP number is expressed as:

02, num1,num2

where num1 is the high byte of number, and the num2 is the low byte. (unless it is reversed)

but the important thing to note is that if this instruction started at byte 7999, then it will process LJMP, not the number, because the ljmp code is at byte 7999, and num1 and num2 will be unrecognized because there isn't byte 8000 and byte 8001 in code space.

think of it as storing a 3MB file on a floppy. It just can't be done on a floppy.

If you still have trouble, then I will guess that your code space is corrupt. In other words, your flash rom (or eeprom) is broken.

List of 29 messages in thread
TopicAuthorDate
Unable to use P0 and P2            01/01/70 00:00      
   How do you detect that it's ignored?            01/01/70 00:00      
      Philips 80C52            01/01/70 00:00      
         Re: 80xxx            01/01/70 00:00      
         External memory?            01/01/70 00:00      
            Re: External memory?            01/01/70 00:00      
               Check the datasheet!            01/01/70 00:00      
                  More information            01/01/70 00:00      
                     80C52            01/01/70 00:00      
                        I think it does have internal ROM            01/01/70 00:00      
                           oops!            01/01/70 00:00      
         ICE or Eprom Emulator ?            01/01/70 00:00      
            It is an in-circuit emulator            01/01/70 00:00      
   my assumption            01/01/70 00:00      
      I'm afraid it can't be            01/01/70 00:00      
         There's a special "once" mode ... for emulators            01/01/70 00:00      
         try this            01/01/70 00:00      
            Re: try this            01/01/70 00:00      
               My guess            01/01/70 00:00      
                  Read the datasheets and read the posts, Mike            01/01/70 00:00      
            How is all this supposed to help?            01/01/70 00:00      
               It has code space...            01/01/70 00:00      
                  Where did you get that nonsense, Mike?            01/01/70 00:00      
   My conclusion:            01/01/70 00:00      
      What has it to do with the original question?            01/01/70 00:00      
   I do not know your emulator, but            01/01/70 00:00      
      My conclusion (and thanks for everyone)            01/01/70 00:00      
         then why not say so            01/01/70 00:00      
         Emulator            01/01/70 00:00      

Back to Subject List