Any suggestions on how to set up a scrolling message buffer?
Don M
Posts: 1,652
in Propeller 1
Here's the setup:
On an lcd screen I select an area that will contain messages. Let's say it starts on line 30 and is 4 lines long. The messages can be up to 40 characters long. Each message is 1 line. I would like the first message to print on line 30, Next message on line 31, then next on line 32 then next on line 33. When the next message comes in I would like to take the message from line 30 and place it on line 31, line 31 to line 32, line 32 to line 33 and the new message on line 30. So as new messages come in they scroll down.
The only way I can think of doing this is by using 5 40 character byte buffers and copying one to the next as messages come in. Does this sound like a feasible way of doing this?
Anyone have any examples?
Thanks. Don
On an lcd screen I select an area that will contain messages. Let's say it starts on line 30 and is 4 lines long. The messages can be up to 40 characters long. Each message is 1 line. I would like the first message to print on line 30, Next message on line 31, then next on line 32 then next on line 33. When the next message comes in I would like to take the message from line 30 and place it on line 31, line 31 to line 32, line 32 to line 33 and the new message on line 30. So as new messages come in they scroll down.
The only way I can think of doing this is by using 5 40 character byte buffers and copying one to the next as messages come in. Does this sound like a feasible way of doing this?
Anyone have any examples?
Thanks. Don
Comments
-- Edit --
Apparently 5 * 40 is not 800
You have five buffers locally. Once the fifth message comes in, you re-write the lcd screen beginning with the second buffer (2, 3, 4, 5). The sixth message get stored into buffer 1 and you re-write the screen using (3, 4, 5, 1). And so on.
Not under-thinking it, and you don't need an extra buffer line unless the screen needs constant refreshing. Once the newest line is received the entire buffer can be written to the screen and the new data can be written on the oldest line.
But is this what you mean by scrolling? Simply adding a new message in at the top and pushing the others down like a stack?
Care to share an example of what you mean?
Yes.
EDIT: here is the compiler listing from BST to show that the compiler will place these message buffers contiguously in order in memory: