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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
04/20/07 14:01
Read: times


 
#137628 - again, I want to "crunch my code"
Responding to: ???'s previous message

Have you actually read any documentation on the 8051?

Yes


You talk about fandamental things as if they're revelations. For example the internal ram - it starts at 0x00 and continues until 0x7f (on a real 8051).

In my situation, it doesnt. The reason is that I will use registers 0 through 7 and I am likely to use the bit registers.
I will use the default bank of zero.

This makes addresses 0h - 7h and addresses 20h through 2Fh not available as scratch ram.

I am likely to use addresses 08h through 1Fh as 1 byte ram slots. I'm already using 08h as a ring buffer pointer.

This leaves me with 30h through 7Fh.

What would really be nice is if I can get a fair amount of bytes from the serial port into the first part of internal RAM, say from 00h to 20h.

The bigger the buffer, the greater chances I have of receiving data and processing it.

A partial answer here might be for me to use register bank 3, but I want to ensure that I have enough bytes. I will try that first to see what happens, and if that doesn't work, then I come back here.


Now, if you want to save some cycles in your ISRs, you can allocate a register bank for exclusive use in your ISR.

Interesting, but that takes bytes away from available ram.


You also have to have your stack in there somewhere also.

I think I will have to omit the use of registers, now that you mention that.


If you're worried about internal ram - just use the external ram! Sure you get a small performance hit - 8051's weren't optimised for handling large memory structures! If you're worried about performance - either drop the baud rate or get a faster cpu!

I'm worried about the serial buffer I have.
As it stands right now, I am safe with a 256 byte buffer in external memory. BUT I want to improve it.

Now I'm thinking of using RAM locations 00h through 17h for the serial buffer and when it is full, it is sent to external RAM.
Would that be slower than what I have now?



Besides, you violate that by having a pointer in 0x08!

Why would having a pointer in 08h violate RAM addresses 30h through 7Fh when that pointer of mine references the low byte of external memory?


Do you expect the serial data to be streaming in without any breaks?

no, but I expect serial data to arrive at random times. That is why I am using a buffer to catch the data, so that it is consistent in the buffer.


Don't create impossible situations for yourself.

That's why I started this thread. I'm trying to make my code more simple.



List of 17 messages in thread
TopicAuthorDate
if I could crunch my code...            01/01/70 00:00      
   Optimisation            01/01/70 00:00      
      the original 8051 is the problem...            01/01/70 00:00      
         Duhh!            01/01/70 00:00      
            again, I want to "crunch my code"            01/01/70 00:00      
               starg with something that works.            01/01/70 00:00      
               Did You Look at Movx @R0 ?            01/01/70 00:00      
                  Thanks (after I tried it LOL)            01/01/70 00:00      
                     data sheet            01/01/70 00:00      
                     Hidden P2 Register?            01/01/70 00:00      
               Simple,but no simpler            01/01/70 00:00      
         Problem?            01/01/70 00:00      
   save a few bytes by using JBC            01/01/70 00:00      
   an alternative            01/01/70 00:00      
   WRONG            01/01/70 00:00      

Back to Subject List