??? 04/20/07 10:29 Modified: 04/20/07 10:36 Read: times |
#137611 - an alternative Responding to: ???'s previous message |
Mike Stegmaier said:
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.
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 The buffer I want should be at least 16 bytes. Code will need some cleaning, and comments. serisr: push ACC Save registers on stack push DPL push DPH jnb RI,Check_tx We did not receive anything. clr RI mov A,SBUF Get received char in ACCU mov DPH,#80h Buffer is at 08000H, initialise DPH to point at buffer mov DPL,08h DPL is kept in 08h movx @DPTR,A Save received char in buffer inc 08h Bump pointer setb 20h.4 ?????? Check_tx: jnb TI,exit_isr Did we transmit a char? setb 20h.3 yes, set bit ????? clr TI exit_isr: pop DPH All done, restore registers pop DPL pop ACC reti Exit ISR reshuffling some stuff, so it looks more logical (at least to me it does). Renamed some things, and added comments so it is relatively readable. By doing the above I do not claim that this routine will work. I just reformatted and added comments. I still am not sure what 20h.4 and 20h.3 are doing... Sure you need this? regards |
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 |