Buffered Video Output?
Philldapill
Posts: 1,283
I've done a few projects where the RCA TV connection is how I figure out what's going on. My beef with this whole thing is the constant flicker when the screen updates. What I do, is I clear the screen by doing TV.out(0), then write my stuff to it, then when I update, I repeat the process. I'm guessing the flicker comes in when I clear the screen so 1 frame is blank, then I write my data and then there is text on the screen.
What I have in mind, is modifying the TV_Text object, so that you can write to a buffer and get everything laid out, THEN tell it when to flip it, instead of clearing the whole thing each time. This way, I think it reduce flicker drastically.
Has this been done???
What I have in mind, is modifying the TV_Text object, so that you can write to a buffer and get everything laid out, THEN tell it when to flip it, instead of clearing the whole thing each time. This way, I think it reduce flicker drastically.
Has this been done???
Comments
Generally, if you're modifying large areas of the screen (changing the layout effectively), you're better off clearing the screen and repainting it from scratch.
Post Edited (Mike Green) : 12/10/2008 8:58:07 PM GMT
Text.str(string(1,"Hello everyone ") 'with spaces here because the post self edits them out
Then to update the same line,
Text.str(string(1,"Hello everyone is here ")
Presto no flicker.
While you can do it with a buffer, it will greatly increase your memory needs.
Post Edited (Erik Friesen) : 12/10/2008 8:43:07 PM GMT
I agree with you phil, you should be able to prevent the tv driver from flipping buffers while you're doing your update, then allow it to continue when you're done. This drives me nuts too. What we need is a tv.SuspendFlip method and a subsequent tv.ResumeFlip. Then we could pause the flipping (it would continue to update from the forward buffer while we do our writes to the back buffer.
This needs to be done in the TV.spin file, but my asm is nowhere near what it needs to be to make it happen.
I've heard of a method of writing something, and when you need to change it, backing up to a particular position, blanking the predefined area out with spaces, then re-writing to that same position. This still creates flicker because of the frame that gets flipped with the blank spaces, then back with text. Memory isn't an issue in this project... I'm running some ADC's, and PWM, and not much more besides the TV object.
It's not clear to me whether he means that the graphics driver does the buffering or the tv.spin driver itself. There is mention of a "field" and a "superfield" in tv.spin, though I'm not sure if those are the buffers or not.
Here's a spin only idea...
In Tv_text.spin, add a new buffer (word screen2[noparse][[/noparse]screensize]) and new method called printBufferd(c)
-have it write to screen2
pri print(c)
screen2[noparse][[/noparse]row * cols + col] := (color << 1 + c & 1) << 10 + $200 + c & $FE
if ++col == cols
newline
and then use a longmove to replace screen with screen2.
[noparse][[/noparse]EDIT]
Thanks for the clarification Mike. Do you think the screen2 buffer idea would work?
No attempt is made to synchonize the copy operation to the vertical sync, either. This has the disadvantage that a dynamic frame capture could show partly old contents and partly new contents. It has the advantage that throughput is enhanced for rapidly-changing content.
Note that no changes appear on the screen until either the character SHOSCR is sent or the public method showscreen is called.
-Phil
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
'Just a few PropSTICK Kit bare PCBs left!
Post Edited (Phil Pilgrim (PhiPi)) : 12/10/2008 10:51:27 PM GMT
Thanks
OBC
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
New to the Propeller?
Getting started with a Propeller Protoboard?
Check out: Introduction to the Proboard & Propeller Cookbook 1.4
Updates to the Cookbook are now posted to: Propeller.warrantyvoid.us
Got an SD card connected? - PropDOS
This is exactly what I was thinking of. I can't believe it's been in my library for so long and I forgot about it. Perfect.
The attachment is a bit overexposed; haven't yet gotten exposures proper for this LCD display; backlight greys the background too much. Is nice to 'see' the headings in color now.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Harley Shanko
Again, I can't thank you enough. I've replaced this as the TV object in my project and wow.... I love seeing numbers change on my screen with no flicker. I'm starting to get a little bleary-eyed from joy.
Thank you.
I could do this myself, but if it's already been done, I should save time. Any thoughts?
Yes, this is easy to do. If the "digits" argument to decn is negative, the output is padded with leading zeroes instead of blanks. So to print a value x as dd.ddd, do this:
The absolute value operator in the second decn permits this to work with negative as well as positive numbers.
-Phil
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
'Just a few PropSTICK Kit bare PCBs left!
-Phil
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
'Just a few PropSTICK Kit bare PCBs left!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·"I have always wished that my computer would be as easy to use as my telephone.· My wish has come true.· I no longer know how to use my telephone."
- Bjarne Stroustrup
Basically, I created a window with the following string...
text.str(string(DEFWIN,1,1,1,40,1,USEWIN,1,CHGCLR,3)) ' top title bar
but this created a window one line down from the top of the screen. I tried
text.str(string(DEFWIN,1,0,1,40,1,USEWIN,1,CHGCLR,3)) ' top title bar
but the "0" is not allowed in a string!
Well, after a little several tries, here's how I fixed it...
text.str(string(DEFWIN,1,1))
text.out(0)
text.str(string(40,1,USEWIN,1,CHGCLR,2)) ' top title bar
Strings in Spin use the C convention of ending strings with a zero byte. This has the effect of terminating a string early if you try to embed a zero byte in the middle. The compiler is supposed to catch it. Your "solution" is the only way to include a zero value in an output stream.
There's also an alternate to CLS which can be used in strings: CLRW, which has the value $1e.
In retrospect, having two such "zero" substitutes is a bit kludgy, and I really should try to come up with something better. Also, I need to update these objects to include the constant definitions, rather than relying on the demo programs to define them.
-Phil
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
'Just a few PropSTICK Kit bare PCBs left!