Announcement

Collapse
No announcement yet.

Custom Digits usage issue

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Custom Digits usage issue

    Hello,

    I am trying to use the custom digits feature without success so far: the initial image with "00" is shown, but ledDigitsDisplay does not seem to work.
    The initial image displayed indicates that the GCI file is likely loaded properly. Extra debug statements also informed me that the loop is actually working, but the display is not updated.

    I am new to Workshop4, so there is probably something obvious I am missing.

    Thanks for your help,

    Worskhop: 4.6.0.20
    Display: Gen4-uLCD-32DT

    Code:
    hndl := file_LoadImageControl("count.dat", "count.gci", 1);
    
    img_Show(hndl, icount); // show all digits at 0, only do this once
    
    i := 0;
    repeat
      ledDigitsDisplay(0, iicount, 0, 2, 1, 36, 0) ;
      i++;
      if ( i > 99 )
        i := 0;
      endif
    pause(1000);
    forever
    Click image for larger version

Name:	RegDigits.bmp
Views:	107
Size:	81.1 KB
ID:	71118

    Attached: full project with BMP file.

  • #2
    Sorry, wrong version of the code (I was playing around, and the one above obviously displays 0).
    Below is the corrected actual version: does NOT work.

    Help will still be very much appreciated.

    Thanks,

    Code:
    hndl := file_LoadImageControl("count.dat", "count.gci", 1);
    
    img_Show(hndl, icount); // show all digits at 0, only do this once
    txt_MoveCursor(6, 0);
    i := 0;
    repeat
      ledDigitsDisplay(i, iicount, 0, 2, 1, 36, 0) ;
      putnum(DEC, i);
      i++;
      if ( i > 99 )
        i := 0;
      endif
      pause(1000);
    forever
    Attached Files

    Comment


    • #3
      OK. I resolved my issue.
      It turns out, I had the file handle variable declared at the top of my main function:
      Code:
      func main()
        var hndl;
      Somehow, removing this single line of code enabled the ledDigitsDisplay to function properly!
      It is obvious after some more careful inspection of the ledDigitsDisplay function: the file handle is not passed in the arguments:
      Code:
      func ledDigitsDisplay(var newval, var index, var left, var Digits, var MinDigits, var WidthDigit, var LeadingBlanks)
      So the function gets a file handle from a global variable hndl. My main function was shadowing it locally, but since the img_Show function is using a file handle as argument, I did not notice anything.

      Sorry for the disruption, but it took me a few hours to figure this one out.
      I guess I will now rewrite ledDigitsDisplay to be actually state less with an extra argument for the file handle ;-)

      L.

      Comment


      • #4
        Hi L,

        I am glad you managed to sort the problem.
        On a side note, you can attach your project by opening your program on Workshop4, selecting File and choose the ZIP project.
        This will zip all the files needed by the application to run.

        Thank you and have a good day!

        Best Regards,
        Kevin

        Comment

        Working...
        X