Announcement

Collapse
No announcement yet.

USE "COOL GAUGE" WIDGET WITH GEN4-ULCD-24PT

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

  • USE "COOL GAUGE" WIDGET WITH GEN4-ULCD-24PT

    Hi everyone,

    i'm new in the world of 4D Systems and i'm trying to do a first project with GEN4-ULCD-24PT display.
    I have inserted the "Cool gauge" widget and now i modified the graphic so now i have to write the code part.

    I have to read a frequency from the serial interface and write it into the widget.
    I have already inserted the serial interface code part
    I want to know:
    - What i have to write in the code to make the project with widget work?
    - There is something to declare to initialize the widget?
    - How can i show the frequency values in the widget?

    Also, i have to put a background picture in the screen, behind objects; what can i do to make this? (I have a .png picture)

    I attached a screenshot of my screen project.


    Thank you,
    Daniele



    Click image for larger version  Name:	ScreenShot1.jpg Views:	25 Size:	17.6 KB ID:	70384
    Attached Files
    Last edited by Daniele Utec; 1 day ago.

  • #2
    Have you tried using the Geni-Visi method? That puts all the basic code in and lets you set the event handlers.

    Comment


    • Daniele Utec
      Daniele Utec commented
      Editing a comment
      Hi Alan,

      No, now i'm trying to use it, thank you for the idea.
      Anyway, it's differrent then ViSi, it's a bit difficult use it; i am accustomed to write the code to control all the part and this it's a bit different ahah.


      Thank you,
      Daniele
      Last edited by Daniele Utec; 1 week ago.

  • #3
    Hi Daniele,

    Are you using a host controller to send the data to the display module?
    If yes, then you may refer to this application note: AN-00015 ViSi-Genie Displaying Temperature Values from an Arduino Host

    Or are you reading it from the pins on the display module? We do have an application note which discusses the basics of using pin input and pin output objects for DIABLO16 display modules, please refer to this document: AN-00033 ViSi Genie Pin Input and Output for Diablo16 Display Modules

    However, if you are reading an analog input from the display module, it will be easier if you use the ViSi Environment.
    Still, if you have the PRO version of Workshop4, you can add magic code on your ViSi-Genie project.

    Best Regards,
    Kevin

    Comment


    • Daniele Utec
      Daniele Utec commented
      Editing a comment
      Hi Kevin,

      The display read data from an electronic board.
      - I tried also to use Smart Gauge, but i have to configure it; how can i find all the pictures/images in my pc? There is a folder in C:?

      I have a PRO version and now i tried to add magic code.

      - I have to put also a background picture, how can i do it, to see the picture below of all objects?


      Thank you,
      Daniele
      Last edited by Daniele Utec; 1 week ago.

  • #4
    Hi Daniele,

    - I tried also to use Smart Gauge, but i have to configure it; how can i find all the pictures/images in my pc? There is a folder in C:?
    To be guided further, It is best to check for the Smart Widgets Editor User Guide

    - I have to put also a background picture, how can i do it, to see the picture below of all objects?
    On the Object Inspector, select the Form. In the properties of the 'Form', select an image and change the 'Bgtype' to Image.

    Best Regards,
    Kevin

    Comment


    • Daniele Utec
      Daniele Utec commented
      Editing a comment
      Hi Kevin,

      Thank you for the much help.
      Now i try to do all.


      Thank you,
      Daniele

    • John Kevin
      John Kevin commented
      Editing a comment
      Hi Daniele,

      Sure, no problem. Have fun on your project!

      Best Regards,
      Kevin

  • #5
    Hi everyone,

    I have read some example of Smart Widget in ViSi environment but i didn't found what i'm looking for.
    - How can i connect the data read from my electronic board with the smart gauge so i can see the value in the same widget?

    My project read some registers of an electronic board and show on the display the value of frequency in Hertz.
    My electronic board is an inverter that manage a speed of a motor.

    I'm looking for a function code like "ledDigitsDisplay()" of leddigits widget to write a value on the same widget and his relative code to make the widget work.

    P.S. I don't use ViSi-Genie environment because i will lost all functions i have made in the .INC file to read the serial interface, and i don't know how to insert in that project with ViSi-Genie.


    Thank you,
    Daniele

    Click image for larger version  Name:	ScreenShot2-Smart-Widget.jpg Views:	1 Size:	20.3 KB ID:	70405
    Last edited by Daniele Utec; 1 week ago.

    Comment


    • #6
      Hi Daniele,

      - How can i connect the data read from my electronic board with the smart gauge so i can see the value in the same widget?
      You could use the Serial UART to send and receive the data. Please have a look at section 2.11. Serial Communications Functions of the PICASO_InternalFunctions manual (press F1 on your project).

      I'm looking for a function code like "ledDigitsDisplay()" of leddigits widget to write a value on the same widget and his relative code to make the widget work.
      On the Object Inspector, select the object (e.g. SmartGauge) and click the 'Paste Code'. This will add an additional code to your project.
      Code:
      img_SetWord(hndl, iSmartGauge1, IMAGE_INDEX, frame) ; // where frame is 0 to 100
      img_Show(hndl,iSmartGauge1) ;
      For the SmartGauge, you only need to change the 'frame' to alter its value.

      Here is a simple example of reading the COM port on the display.
      Code:
      var frame;
      var char;
      
      repeat
          char:=serin();
      
          if(char > 0)
              gfx_MoveTo(0,250);
              print("Gauge value: ",char,"  ");
      
              img_SetWord(hndl, iSmartGauge1, IMAGE_INDEX, char) ;
              img_Show(hndl,iSmartGauge1) ;
          endif
      forever
      Best Regards,
      Kevin

      Comment


      • #7
        Hi Kevin,

        Okay, i thought there were other functions to enter into the code similar some example of leddigit widget with #inherit "ledDigitsDisplay.inc".

        I have a problem with the background picture;
        if I insert the background image, all widgets lock and no longer work. If I remove it immediately, everything will work again. I thought the problem was related to "gfx_BGcolour(WHITE) ;" - "gfx_Cls() ;" which colors the display: it's not like that.

        I attached an image of this problem.
        I attached also a .rar folder of my project so you can see my problem of the Background picture.

        Probel of Background


        Thank you,
        Daniele

        Comment


        • John Kevin
          John Kevin commented
          Editing a comment
          Hi,

          Can you try to comment out the Transparency on your main function?
          //gfx_TransparentColour(0x0020);
          //gfx_Transparency(ON);

          Also, to show the background picture you need to show the form:
          img_Show(hndl,iHome) ;

          Best Regards,
          Kevin

        • Daniele Utec
          Daniele Utec commented
          Editing a comment
          Hi Kevin,

          Now it works but the objects are not enabled. If I press Start or Stop they don't change their status. I also tried to enable them explicitly in the repeat loop, but they don't work anyway.


          Thank you,
          Daniele

      • #8
        Hi,

        Try adding this line straight after the show background command eg

        img_Show(hndl,iHome) ;
        img_SetAttributes(hndl, iHome, I_TOUCH_DISABLE); // set to disable touch

        The background may have touch enabled which will be the first in the list and be detected before the buttons.

        Best regards

        Paul

        Comment


        • Daniele Utec
          Daniele Utec commented
          Editing a comment
          Hi Paul,

          Thank you, now it's working well.

          Best Regards,
          Daniele

      • #9
        Hi Daniele,

        Glad that worked out for you. Your GUI is looking good.

        If your Smart gauge shows from 20 to 70 and it's 1 frame = 1 hz then you need to subtract 20 from your Hz value and send that to the Smart gauge, eg

        frame := Hz - 20; // Smartgauge range is 20 to 70 hertz
        img_SetWord(hndl, iSmartGauge1, IMAGE_INDEX, frame) ;
        img_Show(hndl,iSmartGauge1) ;

        Comment


        • Daniele Utec
          Daniele Utec commented
          Editing a comment
          Hi Paul,

          Thank you for your advice.
          I want to ask you if i can put in display a string with "print()" with the same background of other objects, and not black as default.
          I want to show a string with my picture in the background.
          How can i do this?


          Best Regards,
          Daniele

      • #10
        Hi Daniele

        You can turn the background off so that just the text appears on the background.

        You can use this command,

        txt_Opacity(mode) where mode is 0 for transparent and 1 for opaque.

        The problem with this approach is that if you need to change the text that you have printed, the text that was previously drawn will not be erased with a backgound but if the text is static this shouldn't be a problem.

        Please let me know if you need to be able to change the text.

        I hope this helps

        Best regards

        Paul

        Comment


        • #11
          Hi Paul,

          Yes, i found a solution with "StaticText" object. My text don't change fortunately, i don't know i can put it, i forgot it.
          Thank you, anyway.

          I have another work to do:

          I have to do a page called timer in which i modify the work timer.
          The user must enter a number that is the timer. I thought of inserting the "Led Digits" object so i can display the value entered.
          - The question is: how can I get the user to enter any value? With which widget can I do this? Can i insert any value from the same "Led Digits" object?

          I have another problem with this page:
          I have put a background picture also in this page (timer page), but if i put a "Led Digits" object the background of that object is black, i want that is shown my background picture. How can i put trasparency on it?

          I attached a screenshot of this page to understand better the problems.


          Best Regards,
          Daniele

          Click image for larger version

Name:	Timer-Page.jpg
Views:	9
Size:	22.7 KB
ID:	70527
          Attached Files

          Comment


          • #12
            Hi Daniele

            You could use the transparency function and turn it on just before you draw the LEDdigits and then off after they are drawn. You can use this command to set the transparency colour,

            gfx_TransparentColour(BLACK);

            and then use,

            gfx_Transparency(ON);

            draw the LEDdigit and then

            gfx_Transparency(OFF);

            after the LEDdigit command

            You will have to make sure the colour of the LEDdigit background matches the transparency colour.

            I hope this helps

            Best regards

            Paul

            Comment


            • Daniele Utec
              Daniele Utec commented
              Editing a comment
              Hi Paul,

              Seems that it work now. But i have a problem with change the form; if i press the button to change the screen/form, the display show both of the form, the first and second;
              - How can i delete the first form after i press the button to go in the second form, to show all the objects in the second form?


              Best Regards,
              Daniele

          • #13
            Hi Daniele,

            If there is a gfx_Cls() command there, it should clear the previous form or transparency is still on. Maybe on the show form routine you should have,

            gfx_Transparency(OFF);
            gfx_Cls();

            Best regards

            Paul

            Comment


            • Daniele Utec
              Daniele Utec commented
              Editing a comment
              Hi Paul,

              Work very well, thank you.
              I have to put in the display a value of time that is important to start the timer, but i have to do this not in the code, the user can put this value.
              To insert the time, how can i do to put a value in Led Digits object or i have to choose another object?


              Thank you,
              Daniele

          • #14
            Hi Daniele

            You could do this by having an increment, decrement button above and below each digit to change the digits to the required time, or use a numeric keypad and text to enter the time.

            Paul

            Comment


            • Daniele Utec
              Daniele Utec commented
              Editing a comment
              Hi Paul,

              If i choose a "Custom Digits" widget to show the timer, how can i place an image to show all the numbers? I mean, how "Custom Digits" widget work?


              Thank you,
              Daniele

          • #15
            Hi Daniele,

            You need to create an image set that has all the digits from 0 to 9 a space and a minus sign. I have attached an image set that will just work for you and this will be the bitmap that you select.

            The characters in the bitmap need to be equally spaced like in the attached example.

            Best regards

            Paul
            Attached Files

            Comment


            • Daniele Utec
              Daniele Utec commented
              Editing a comment
              Hi Paul,

              Where i can find this type of numbers? Can i find something on internet or i have to create it from zero from myself?


              Thank you,
              Daniele
          Working...
          X