Announcement

Collapse
No announcement yet.

Display 16 bit unsigned int on led digits

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

  • Display 16 bit unsigned int on led digits

    Hi everybody!!!

    I have a question: I need to display on led digit object an unsigned int......

    I read the topic where it's implemented the writing for a 32 bit integer, but for my pourpose an unsigned int with 16 bit ( 0 - 65535 ) is more than enough!
    How can i impelment this? My envhironment it's VISI.

    Thank you!


  • #2
    Because of the way ledDigitsDisplay is written it cannot handle unsigned ints.

    Here's an example that uses a modified version that does handle unsigned ints.
    Attached Files
    Mark

    Comment


    • #3
      Hi Mark!!!

      I had to use the led digits definition for a long int ( 32 bit)...

      I used the program released by Doff in this thread: http://forum.4dsystems.com.au/forum/...d-digit-object

      The code works, but i have a problem in the writeToLeddigits function. The follow part of code :

      Code:
          // clear leading figures
          x := left;
          for(i := 0; i < (digits - length); i++)
              img_SetWord(hndl, uSDidx[index], IMAGE_INDEX, 10);
              img_SetWord(hndl, uSDidx[index], IMAGE_XPOS, x) ;
              img_Show(hndl, uSDidx[index]);
              x += width ;
          next
      clear all the digit.....for this reason if i have a led digit object with 8 digit, i display always 0 and not 00000000
      I tried to comment this part of code and i have the 8 zero digit, but if i tried to reset the led digit, the only number that it' s reset it's the first and not the 8 digit.....
      How can i solve?

      Thank you!!!!
      Last edited by tntsei; 30 July 2015, 12:35 AM.

      Comment


      • #4
        Looks like you have your leddigits defined with 'LeadingZero=No'.

        You can change the object and 'paste code'.

        Alternately have a look at the 4 sample calls in the code I posted, the first 2 have leading blanks, the second 2 have leading zeros.
        Mark

        Comment


        • #5
          I don't understand Mark!

          The Object that i have isn't glued....i have defined the function ledDigitsDisplayLong where i have the same code in the thread that i have posted......

          Last edited by tntsei; 30 July 2015, 04:59 PM.

          Comment


          • #6
            Hi Tntsei,

            You could also try this:

            Code:
                // clear leading figures
                x := left;
                for(i := 0; i < (digits - length); i++)
                    img_SetWord(hndl, uSDidx[index], IMAGE_INDEX, 0); // change "10" to "0"
                    img_SetWord(hndl, uSDidx[index], IMAGE_XPOS, x) ;
                    img_Show(hndl, uSDidx[index]);
                    x += width ;
                next

            Let me know if it works for you.

            Regards.

            Doff

            Comment


            • #7
              Hi Doff!!

              Yes!!! Now works how i want!!!!

              Thank you

              Comment

              Working...
              X