??? 04/19/07 22:03 Read: times |
#137568 - if I could crunch my code... |
This is my code that stores serial port data in 256 bytes of external RAM from address 8000h to 80FFh. I use a ring buffer.
internal ram location 08h contains DPL of the last external ram location that was accessed to write the serial port data. 20h.4 replaces RI and 20h.3 replaces TI. The reason why I replace them is because this routine is in the serial interrupt, and the interrupt cannot be escaped properly until TI and RI are clear. serisr: jnb RI,norecv push ACC clr RI mov A,SBUF push DPL push DPH mov DPTR,#8000h mov DPL,08h movx @DPTR,A pop DPH pop DPL inc 08h setb 20h.4 pop ACC norecv: jnb TI,noxmit setb 20h.3 clr TI noxmit: reti I want to eventually use internal ram as the buffer so that the external ram can be freed for other purposes, and I could possibly save a few processor cycles. Also, I want to be able to guarantee that every single byte that enters the serial port is recognized and used. you can give me -1 for "gimme code" if you want, because I am looking for hints on optimizing this routine and hopefully using internal ram. The buffer I want should be at least 16 bytes. |
Topic | Author | Date |
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 |