??? 12/18/06 19:55 Read: times |
#129692 - newbie: offsetting the dptr |
Hi-
I should get this out of the way first: I'm a newbie to 8051/firmware. Now my question. I'm trying to create a fifo of sorts in assembly for the 8051. The goal is to enter N bytes (N less than 128) via hyperterminal/UART, hit enter at any time and have every character you've entered in the order you entered them since the last time you hit enter display in hyperterminal. If you've reached the fifo limit (128 bytes) it will auto display the contents in order. I think this should be REALLY easy, but I'm stuck on one issue - offsetting the dptr. My setup is something like this R0 offset pointer for the hear of the fifo R1 offset pointer for the of the fifo I have a line like this: myfifo: ds 128 UART/hypertermnial interface is all set up and working. I want my pushbyte function to do something like this: pushbyte: mov dptr, #myfifo + R0 movx @dptr, the serial data inc R0 ret I can't figure out how to implement the mov dptr, #myfifo + R0line though. #myfifo is obviously 16 bits and head is only 8. I could write some addition subroutine to do this, but that just seems ugly. I could do a loop of inc dptr with djnz on head, but that too seems ugly. Any ideas for how to do this cleanly? I just want to offset the dptr by some value in a register/wherever. Any help would be much appreciated! Thanks! D |
Topic | Author | Date |
newbie: offsetting the dptr | 01/01/70 00:00 | |
additional info | 01/01/70 00:00 | |
do you have external data memory at all? | 01/01/70 00:00 | |
Exteranal or Internal RAM | 01/01/70 00:00 | |
In response to Jan and Neil | 01/01/70 00:00 | |
MOVX @DPTR,A | 01/01/70 00:00 | |
In response to Jon | 01/01/70 00:00 | |
Indexing | 01/01/70 00:00 | |
In response to Hans | 01/01/70 00:00 | |
Indexing | 01/01/70 00:00 | |
In response to Hans | 01/01/70 00:00 | |
the reason is | 01/01/70 00:00 | |
In response to Russell | 01/01/70 00:00 | |
Be careful who you listen to! | 01/01/70 00:00 | |
movx a,@dptr | 01/01/70 00:00 | |
In response to Neil | 01/01/70 00:00 | |
It Adds | 01/01/70 00:00 | |
?????? | 01/01/70 00:00 | |
oopps no | 01/01/70 00:00 | |
error | 01/01/70 00:00 | |
error | 01/01/70 00:00 | |
movx/movc![]() | 01/01/70 00:00 |