How to replace another value without flicker


+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    Junior Member Abinz's Avatar
    Join Date
    Apr 2020
    Posts
    8
    Thumbs Up
    Received: 0
    Given: 0
    Total Downloaded
    0

    0 Not allowed!

    Default How to replace another value without flicker

    I wish to replace some text value with same line, how can i do the right way.

    Example :

    If Print At 1,1, "Motor Control " then Kontroole
    DelayMS 350 '50

    Kontroole : Print At 1,1 "Motor Stater "

    I need also delay to give few second to appears other text.

    I did like this with a flicker text value.

    Please help and guidance.

    Thanks.
    Ab

  2. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  3. #2
    Fanatical Contributor Tim's Avatar
    Join Date
    Jan 2003
    Posts
    7,748
    Thumbs Up
    Received: 51
    Given: 96
    Total Downloaded
    1.32 GB

    0 Not allowed!

    Default Re: How to replace another value without flicker

    Can you clarify your code please?

    What do you mean by "If Print At 1,1, "Motor Control..... "

    You cannot test a print statement
    Tim

  4. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  5. #3
    Prolific Poster John Drew's Avatar
    Join Date
    Feb 2002
    Posts
    2,886
    Thumbs Up
    Received: 91
    Given: 34
    Total Downloaded
    4.60 GB

    0 Not allowed!

    Default Re: How to replace another value without flicker

    Ab,
    It seems that you may be clearing the screen in between print statements. I don't do that. I either write a whole line or using the print coordinates just print over the same space. This last strategy means the next print may need to be padded with spaces to clear old data.
    John
    Last edited by John Drew; 20th May 2020 at 00:05.

  6. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  7. #4
    Junior Member Abinz's Avatar
    Join Date
    Apr 2020
    Posts
    8
    Thumbs Up
    Received: 0
    Given: 0
    Total Downloaded
    0

    0 Not allowed!

    Default Re: How to replace another value without flicker

    Tim & John,
    Thank you for a reply.

    I trying do like these.
    Print At 1,1, "Motor Control " 'This line to appears first time value
    Cls 'Clear text
    DelayMS 150 'Wait for a second
    Print At 1,1, "Motor Stater " 'Then show this value
    Print At 1,2, "Motor Variable " 'Then show this value line 2

    I still have a flicker text.

    Actually in another compiler I did like below is working.
    const char msg1[] = "Motor Control ";
    const char msg2[] = "Star Up ";
    const char msg3[] = "Motor Stater ";
    const char msg4[] = "Motor Vibrate ";




    char msg[20];




    char *CopyConst2Ram(char *dest, const char *src) {
    char *d ;


    d = dest;
    for(;*dest++ = *src++asm clrwdt;


    return d;
    }


    void main() {


    Lcd_Init();
    Lcd_Cmd(_LCD_CURSOR_OFF);
    Lcd_Cmd(_LCD_CLEAR);
    Lcd_Out(1,1,CopyConst2Ram(msg, msg1));
    Lcd_Out(2,1,CopyConst2Ram(msg, msg2));
    Lcd_Cmd(_LCD_CLEAR);
    Lcd_Out(1,1,CopyConst2Ram(msg, msg3));
    Lcd_Out(2,1,CopyConst2Ram(msg, msg4));


    }
    }

    Thanks.
    Ab

  8. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  9. #5
    Junior Member Abinz's Avatar
    Join Date
    Apr 2020
    Posts
    8
    Thumbs Up
    Received: 0
    Given: 0
    Total Downloaded
    0

    0 Not allowed!

    Default Re: How to replace another value without flicker

    Quote Originally Posted by John Drew View Post
    Ab,
    It seems that you may be clearing the screen in between print statements. I don't do that. I either write a whole line or using the print coordinates just print over the same space. This last strategy means the next print may need to be padded with spaces to clear old data.
    John
    John,
    Can you please give me a sample as well as your way...please.


    Thanks.
    Ab

  10. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  11. #6
    Prolific Poster joesaliba's Avatar
    Join Date
    Sep 2004
    Posts
    2,560
    Thumbs Up
    Received: 76
    Given: 33
    Total Downloaded
    6.56 GB

    0 Not allowed!

    Default Re: How to replace another value without flicker

    You are seeing a flicker because you are using the CLS before the Delayms: -

    Change to: -

    Code:
    Print At 1,1, "Motor Control " 'This line to appears first time value
    DelayMS 150 'Wait for a second
    Cls 'Clear text
    Print At 1,1, "Motor Stater " 'Then show this value
    Print At 1,2, "Motor Variable " 'Then show this value line 2
    or as John suggested: -

    Code:
    Print At 1,1, "Motor Control   " 'This line to appears first time value
    DelayMS 150 'Wait for a second
    Print At 1,1, "Motor Stater    " 'Then show this value
    Print At 1,2, "Motor Variable  " 'Then show this value line 2
    Note the spaces to create a print 16 character in length so you overwrite the previous print.
    Regards

    Joseph

  12. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  13. #7
    Senior Member Stephen Moss's Avatar
    Join Date
    Jan 2006
    Posts
    540
    Thumbs Up
    Received: 32
    Given: 7
    Total Downloaded
    3.87 GB

    0 Not allowed!

    Default Re: How to replace another value without flicker

    I think John and Joseph have the part of the solution, I generally don't use CLS with an Alphanumeric display as I rarely need the display entirely clear of text, I normally just overwrite what is on the screen.

    When both lines of text have data and you want to change the data on one line and clear the other, i.e. changing from...
    Line 1: Motor Starter
    Line 2: Motor Variable
    to
    Line 1: Motor Control
    Line 2:

    then writing
    CLS
    Print at 1,1, "Motor Control"

    may make sense at it could be faster than...
    Print at 1,1, "Motor Control "
    Print at 2,1, "----------------"
    (where dashes are spaces)

    However when changing from ...
    Line 1: Motor Control
    Line 2:
    to
    Line 1: Motor Starter
    Line 2: Motor Variable

    Using the CLS command first may be less efficient than just overwriting the line, so instead of...
    Print at 1,1, "Motor Control"
    DelayMS 150
    CLS
    Print at 1,1, "Motor Starter "
    Print at 2,1, "Motor Variable "
    you just use as Joseph indicated...
    Print at 1,1, "Motor Control"
    DelayMS 150
    Print at 1,1, "Motor Starter "
    Print at 2,1, "Motor Variable "

    But to do that as Joseph indicated you have to pad out all your text to 16 characters to ensure all existing text on a line is overwritten.

    That said it may be your DelayMS code that is more of a problem, or a combination of the two.
    Your comment says "Wait 1 second" but for a 1 second delay your code should be DelayMS 1000 as 1000mS = 1 second. At 150mS I would be surprised if you noticed the "Motor Control " text at all, and even then it would only be a brief flicker before it is overwritten by "Motor Starter". So try increasing your DelayMS value and see what effect that has.

  14. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  15. #8
    Fanatical Contributor top204's Avatar
    Join Date
    Feb 2002
    Posts
    3,589
    Thumbs Up
    Received: 339
    Given: 162
    Total Downloaded
    1.99 GB

    0 Not allowed!

    Default Re: How to replace another value without flicker

    The advice given is correct.

    On Hitachi LCD chipsets, the Cls command sent to the LCD must have a delay after it to give time for the LCD's chipset to reset things. So the compiler's Cls command has a 30ms delay after sending the command to the LCD.

    The Cls command and delays between clearing the screen will always cause flickers, so it is better to overwrite the entire line. Or you can create a Procedure with the Print command then Rep to overwrite the LCD with blank characters and this will be faster than sending the Cls command to the LCD. For example:

    Code:
    '-------------------------------------------------------------------------------------------
    ' Clear a line on the LCD
    ' Input     : pLine holds the line to clear
    ' Output    : None
    ' Notes     : Uses less memory than sending a line of spaces to the LCD
    '
    Proc LCD_ClearLine(pLine As Byte)
        Print At pLine, 1, Rep " "\16   ' Clear a line using the Rep function of a blank character
    EndProc
    Or create a meta-macro or procedure that sends the low-level Cls command to the LCD and a small delay after it. The delay can be altered to make sure the LCD performs the command. The Hitachi chipset has been copied so much, each type has a different requirement so the 10ms in the procedure may be enough, or even a smaller delay:

    Code:
    '------------------------------------------------------------------------------
    ' Clear the LCD's screen
    ' Input     : None
    ' Output    : None
    ' Notes     : None
    '
    $define LCD_Cls() Print $FE, $01: DelayMS 10

  16. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  17. #9
    Prolific Poster joesaliba's Avatar
    Join Date
    Sep 2004
    Posts
    2,560
    Thumbs Up
    Received: 76
    Given: 33
    Total Downloaded
    6.56 GB

    0 Not allowed!

    Default Re: How to replace another value without flicker

    I usually use CLS at the beginning of the code, and then I pad out all text to clear text or overwrite.

    I learned that this way if I need to add / edit something to a line is more quick.
    Regards

    Joseph

  18. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  19. #10
    Junior Member Abinz's Avatar
    Join Date
    Apr 2020
    Posts
    8
    Thumbs Up
    Received: 0
    Given: 0
    Total Downloaded
    0

    0 Not allowed!

    Default Re: How to replace another value without flicker

    There all,
    I trying as well as your guidance above, all those doesn't working, i still see my lcd is flicker.

    Also, i trying Top204 to add, as you know i am beginner in Proton, i still not able where to place those to right place, could be this will work, so Top204..., can you please give me a sample as well your method :

    Print At 1,1, "Motor Control " 'This line to appears first time value
    Cls 'Clear text
    DelayMS 150 'Wait for a second
    Print At 1,1, "Motor Stater " 'Then show this value
    Print At 1,2, "Motor Variable " 'Then show this value line 2

    Proc LCD_ClearLine(pLine As Byte) Print At pLine, 1, Rep " "\16 ' Clear a line using the Rep function of a blank characterEndProc

    '------------------------------------------------------------------------------' Clear the LCD's screen' Input : None' Output : None' Notes : None'$define LCD_Cls() Print $FE, $01: DelayMS 10

    Thanks,
    Ab

  20. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  21. #11
    Fanatical Contributor Tim's Avatar
    Join Date
    Jan 2003
    Posts
    7,748
    Thumbs Up
    Received: 51
    Given: 96
    Total Downloaded
    1.32 GB

    0 Not allowed!

    Default Re: How to replace another value without flicker

    CLS is time consuming and only needed at the beginning of your code unless you need to clear all the screen

    Do not print every 150ms (1 second is 1000ms) 2 - 3 hz is max eg 500ms - 330ms

    If you need to print a line that is say up to 3 chars long do the maths to figure out how many chars it is if you have only 3 chars to work with else pad it out afterwards with a few spaces

    eg Print at 1,1 dec Value1," "
    Tim

  22. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  23. #12
    Senior Member SimonJA's Avatar
    Join Date
    Mar 2006
    Posts
    842
    Thumbs Up
    Received: 14
    Given: 16
    Total Downloaded
    1.03 GB

    0 Not allowed!

    Default Re: How to replace another value without flicker

    Also you can use the Dec modifiers to print a fixed number of digits:

    Print at 1,1 Dec3 myByte

    So you know you'll always be overwriting the previous value plus it's handy if you want a few different numbers on the same line without them jumping around.

  24. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  25. #13
    Prolific Poster joesaliba's Avatar
    Join Date
    Sep 2004
    Posts
    2,560
    Thumbs Up
    Received: 76
    Given: 33
    Total Downloaded
    6.56 GB

    0 Not allowed!

    Default Re: How to replace another value without flicker

    Abinz,

    Can you post a working code and please say what you are expecting from the code? Maybe that way we can work it out better.
    Regards

    Joseph

  26. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  27. #14
    Junior Member Abinz's Avatar
    Join Date
    Apr 2020
    Posts
    8
    Thumbs Up
    Received: 0
    Given: 0
    Total Downloaded
    0

    0 Not allowed!

    Default Re: How to replace another value without flicker

    Hello All,
    I trying to follow as your but i have an flicker,

    Dim Value1 As Word
    Dim Value2 As Word
    Dim Value3 As Word
    Dim Value4 As Word
    Dim Value5 As Word


    Print At 1,1, Value1, "Motor Control " 'This line to appears first time value
    DelayMS 950 'Wait for a second
    'DelayMS 10 'Wait for a second
    Print At 1,1, Value2, "Motor Stater " 'Then show this value
    Print At 2,2, "Motor Variable " 'Then show this value line 2
    Print At 1,1, Value1, "Motor Control " 'This line to appears first time value
    DelayMS 950 'Wait for a second
    'DelayMS 10 'Wait for a second
    Print At 1,1, Value1, "Motor Stater " 'Then show this value, HERE TO TRY TO REPLACE BY Value1
    Print At 2,2, "Motor Variable " 'Then show this value line 2
    Print At 1,1, Value1, "Motor Control " 'This line to appears first time value
    DelayMS 950 'Wait for a second
    Print At 1,1, Value2, "" 'This line to appears first time value
    Print At 1,1, Value2, " " 'This line to appears first time value
    DelayMS 10 'Wait for a second
    Print At 1,1, Value3, "Motor Stater " 'Then show this value, HERE TO TRY TO REPLACE BY Value1
    Print At 2,2, "Motor Variable " 'Then show this value line 2
    [/QUOTE]

    I adding a dec then I seen it a number (0).
    My first Print is working fine, but in this part I get a flicker, i think that is looping the flow.

    Thanks
    Ab

  28. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  29. #15
    Prolific Poster RGV250's Avatar
    Join Date
    Aug 2005
    Posts
    2,363
    Thumbs Up
    Received: 29
    Given: 7
    Total Downloaded
    1.16 GB

    0 Not allowed!

    Default Re: How to replace another value without flicker

    Hi,
    Change the DelayMS 10 at the end as this will not help. Also you will need to have a delay at the end or it will be overwritten straight away.

    Bob
    Last edited by RGV250; 21st May 2020 at 13:22.

  30. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. Replace existing async with sync
    By towlerg in forum The Lounge
    Replies: 8
    Last Post: 2nd February 2019, 10:10
  2. Replace Label with String
    By SimonJA in forum Proton 24
    Replies: 8
    Last Post: 18th January 2018, 20:37
  3. How to replace potentiometer with PS2 Joystick ?
    By Mentcleer in forum Proton Plus Compiler v3
    Replies: 4
    Last Post: 16th February 2017, 12:56
  4. Search and replace
    By Mark Rodgers in forum Proton Plus Compiler v3
    Replies: 1
    Last Post: 20th February 2006, 11:16
  5. [SOLVED !] Find/Replace trouble
    By Mark Rodgers in forum Mecanique - IDE
    Replies: 3
    Last Post: 6th November 2004, 09:02

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts