TV_text refresh
I have the attached program that is working awesome except for one thing. Note - it outputs to TV using TV_Text. It refreshes the ADC 10bit value on the first line of the TV. I want to overwrite that every time, which it does. Problems arises when I go above 3 digits (aka >1000) then back down to 3 digits (<1000), it leaves the 4th digit (it does this when it goes to two or one digit too). I can overcome this by clearing the screen, but then the same value appears to blink at a rate of roughly 5-10Hz in a diagonal manner. I know this is due to the clear screen.
Is there a way I can keep it from having the refresh/blinking effect?
-Parsko
BTW - I feel this is my first (real) object. Much thanks to folks here for answering my questions.
Is there a way I can keep it from having the refresh/blinking effect?
-Parsko
BTW - I feel this is my first (real) object. Much thanks to folks here for answering my questions.

Comments
This can either be done by figuring out the value to be displayed and doing the padding, or you can just overwrite each time with 3 spaces at the origin of the number. If you do this·immediately before displaying the value, the blinking should be unnoticable.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
...
Post Edited (Paul Baker) : 7/27/2006 10:45:52 PM GMT
I think I tried that and it didn't work. After having a night to sleep on it, I have determined, that using the existing objects and hardware, there is no diret route. You are right, I could "figure out" what the value is, then adjust accordingly. Not sure how fast that is though. Also not sure how fast I really need this to display right now either...
On another note:
"BS2.SHIFTIN" can be replaced by a "SERIN" command, right? I don't think it's a drag-n-drop situation, but it should work, right? I want to up the clock speed to get faster conversions...
Thanks,
-Parsko
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Truly Understand the Fundamentals and the Path will be so much easier...
PUB JustifyDec(Value,Justify,Size, Filler) | NegFlag, Index, Counter, Offset, PIndex, HoldValue HoldValue := Value 'Hold the value for later resue NegFlag := false 'The Neg flag, needed for later usage as well Counter := 0 'Used to count the # of chars in the output PIndex := 0 'Used to build the output array IF Value < 0 'If it's a neg number -value 'make it a positive -HoldValue 'and make the hold value a positive NegFlag := true 'throw the neg flag for later usage Index := 1_000_000_000 'Max number of digits REPEAT 10 'Repeat the max number of digits IF Value => Index 'Counting values until the loop exits Counter++ RESULT~~ ELSEIF RESULT OR Index == 1 Counter++ Index /= 10 Value := HoldValue 'Reset the value (for later) IF Size <= Counter 'If the value is bigger then the size then just output it and exit Dec(Value) RETURN Offset := Size - Counter 'Determin the number of filler spaces needed IF Justify := 2 'If it's centered, Offset := Offset / 2 'half the number of filler spaces needed IF NegFlag 'If it's a negitive number, subtract 1 from the filler count Offset := Offset - 1 REPEAT Index FROM 0 TO 30 'Max size is 30, so for all 30 TempBuffer[noparse][[/noparse]Index] := 0 'set to null (str print routine uses a null terminated string...) IF (Justify := 1) OR (Justify := 2) 'Only if right or center do we add BEFORE the number REPEAT Index FROM 0 TO Offset 'And we only add the number of filler spaces needed TempBuffer[noparse][[/noparse]Index] := Filler 'by building the array with the filler char PIndex++ 'and incrementing our index into the output array Index := 1_000_000_000 'Reset the max number of digits (we recycle index all over...) IF NegFlag 'If it's a negitive number, add it into the output array TempBuffer[noparse][[/noparse]PIndex++] := "-" REPEAT 10 'This is a duplicate of the counting loop, only this time IF Value => Index 'we're outputing the actual values into the output array TempBuffer[noparse][[/noparse]PIndex++] := (value / Index + "0") Value //= Index RESULT~~ ELSEIF RESULT OR Index == 1 TempBuffer[noparse][[/noparse]Pindex++] := "0" Index /= 10 IF (Justify :=0) OR (Justify :=2) 'Only if it's left or center do we add AFTER the number REPEAT Index FROM 0 TO Offset 'adding only the number of filler spaces needed TempBuffer[noparse][[/noparse]Index] := Filler STR(TempBuffer) 'Now its a null terminated, justified string... use STR to output!Notes:· This code would go into the TV_Text object file, not your application file and, up in the VAR section, add:
BYTE TempBuffer[noparse][[/noparse]30]
Hope this works.· As always, crits and comments on my code are welcome from all.
KK
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Propeller + Hardware - extra bits for the bit bucket =· 1 Coffeeless KaosKidd
·
Ok I looked at your code, and I see you are using the home command, this should've worked, you could try using backspace, though I dont know offhand what the behaviour of baskspacing when you at home position does, alternatively you can try to do the goto commands.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
...
Post Edited (Paul Baker) : 7/28/2006 4:56:59 PM GMT
txt.dec(x) repeat 3 txt.out(" ")This blanks out just the left-over digits when the value displayed is shorter
If you want a routine that right justifies a value in a field of fixed size, try
PUB decFixed(value,width) | i, p, f, a, b, c '' Print a decimal number of fixed width p := @a f~ if value < 0 -value byte[noparse][[/noparse]p++] := "-" i := 1_000_000_000 repeat 10 if value => i byte[noparse][[/noparse]p++] := value / i + "0" value //= i f~~ elseif f or i == 1 byte[noparse][[/noparse]p++] := "0" i /= 10 byte[noparse][[/noparse]p]~ i := strsize(@a) if i < width repeat width - i txt.out(" ") txt.str(@a)But my code gives the option of left,center or right justification and width [noparse];)[/noparse]
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Propeller + Hardware - extra bits for the bit bucket =· 1 Coffeeless KaosKidd
·
Now I have to spend some time with the lady... I have been on such a role this week, I hate to quit now! grrrr.....
-Parsko
Nice solution Mike, quick and elegant.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
...