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 02:59
Read: times


 
#137584 - the original 8051 is the problem...
Responding to: ???'s previous message
Russell Bull said:

Rule#1 - get the code working first, then look at optimising.

The way I have it configured when I posted it works, but not to my complete satisfaction.


Looking at your code - there is no evidence of a ring buffer - where are the head and tail pointers?

Address 08h represents my primary pointer which increments every time a new character is received. then DPL of dptr is set to the value stored at 08h.

Later, when I want to use the buffer, I make another pointer equal to the value at 08h.



With a circular (ring) buffer, you don't need flags - you compare the head and tail pointers to see if the buffer is empty,has data avail or full.

I can agree, but again, we want to come out with working code.


Assign symbolic names to ram and bits - makes your code easier to read.

I never thought of that. Thanks.


What is the problem in utilising internal ram? Use R0 or R1 instead of DPTR.

It seems simple, but I only have 128 bytes of RAM, in which the majority of it is given to SFR's and the registers R0 to R7. It seems that I can reliably use addresses 30h to 7Fh.

I want to minimize the logic in the serial routine so that I can have more clock cycles available for other tasks.


push PSW
push ACC
push bank0_R0
mov r0,head_ptr
mov a,SBUF
clr RI
mov @r0,a
inc r0
;
; add in test for end of buffer
;
mov head_ptr,r0
pop bank0_R0
pop ACC
pop PSW
reti

Wont your code overwrite several SFR's?

It doesn't detect when the pointer reaches 7Fh.



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