Announcement

Collapse
No announcement yet.

4D-ViSi program (gauges, led digits)

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

  • 4D-ViSi program (gauges, led digits)

    Hello, I have a µLCD-32PT(GFX) and I am trying to do a Temperature Controller and other functions for my Car, using the OBD II port in order to get the data. For temperature I am using the graphic analog meter, and digital meter (gauges) and both are working pretty good. Now I want to add "Led Digits", but went I paste the code for Led digits... // leddigits1 generated 28/11/2011 3:33:12
    img_Show(hndl, ileddigits1); // show all digits at 0, only do this once
    ledDigitsDisplay(temp, ileddigits1+1, 108, 4, 0, 30, 0 ) ;

    ... and when I try to compile this code, I get this error:

    Error: 'ledDigitsDisplay' not found (line 75 file:temp3.4DG)
    Error: context error for unknown 'ledDigitsDisplay' (line 75 file:temp3.4DG)
    Notice: check that the function called via pointer 'ledDigitsDisplay' requires 7 arguments (line 75 file:temp3.4DG)
    2 errors
    0 warnings
    1 notice

    This is my entire code:
    *************************************************************************
    #platform "uLCD-32PT_GFX2"

    #inherit "4DGL_16bitColours.fnc"

    #inherit "VisualConst.inc"

    #inherit "Temp3Const.inc"

    var x,y; // Variables para coordenadas de Touch Screen
    var *Ihndl; // Variable para verificar estado de la uSD

    func main()

    var temp;
    var combuf[2];
    var disk, hndl ;

    txt_BGcolour(BLACK);
    txt_Set(TEXT_OPACITY, 1); // Fija algunas propiedades de texto:
    txt_Set(TEXT_COLOUR, GREENYELLOW);
    txt_Set(FONT_SIZE , FONT3);
    txt_Set(TEXT_BOLD, ON);
    txt_Set(TEXT_UNDERLINED, ON);


    setbaud(BAUD_9600);
    com_Init(combuf, 2, 0);


    if (!(disk:=file_Mount()))
    while(!(disk :=file_Mount()))
    putstr("uSD no montada...");
    pause(200);
    gfx_Cls();
    pause(200);
    wend
    endif

    gfx_TransparentColour(0x0020);
    gfx_Transparency(ON);

    hndl := file_LoadImageControl("Temp3.dat", "Temp3.gci", 1); // Carga la imagen "Temp1"

    gfx_Set(SCREEN_MODE,LANDSCAPE) ; // Define la orientación de la pantalla.


    temp == 0; // Inicializamos la variable para la Temperaura.
    temp := serin();

    pause(500);

    repeat // Inicio de ciclo infinito.

    temp := serin();

    if(temp>149) // Si la variable es igual a 150 o mayor, entonces...
    temp:=150; // la variable siempre será 150, para que no se desborde.
    endif

    pause(200); // pausa obligatoria para lectura del buffer del puerto serial.

    txt_MoveCursor(13, 6); // Mueve el cursor a la posición indicada.
    print ("Tmp: ", [DEC] temp," oC "); // Escribimos el valor de la variable Temp.

    img_SetWord(hndl, 0x0, IMAGE_INDEX, temp); // carga la imagen correspondiente
    img_Show(hndl, 0x0); //

    // gauge1 generated 27/11/2011 21:11:59
    img_SetWord(hndl, igauge1, IMAGE_INDEX, temp); // where numx is 0 to 100
    img_Show(hndl, igauge1);

    // leddigits1 generated 28/11/2011 3:33:12
    img_Show(hndl, ileddigits1); // show all digits at 0, only do this once
    ledDigitsDisplay(temp, ileddigits1+1, 108, 4, 0, 30, 0 ) ;

    forever

    endfunc

    ************************************************************


    What can I do? what's the diference between PICASO-GFX and PICASO-GFX2 chips? I should buy the picaso-GFX2 and replace it in my µLCD-32PT(GFX) ???


    Thank you guys.

  • #2


    When you use LEDDigits you need to inherit "LedDigitsDisplay.INC"
    Mark

    Comment


    • #3


      Thank you!... now I have no errors at all.

      Comment


      • #4


        [img width=234 height=174]http://www.conexionelectronica.com/images/stories/temp.jpg[/img]This is the result.:
        I am sending the temperature value via RS232 (PIC16F877A) to uLCD-32PT. The code is as follow:

        #platform "uLCD-32PT_GFX2"
        #inherit "4DGL_16bitColours.fnc"
        #inherit "VisualConst.inc"
        #inherit "Temp5Const.inc"
        #inherit "LedDigitsDisplay.INC"

        var x,y; // Variables para coordenadas de Touch Screen
        var *Ihndl; // Variable para verificar estado de la uSD

        func main()

        var temp, freq1;
        var combuf[2];

        setbaud(BAUD_9600);
        com_Init(combuf, 2, 0);

        if (!(disk:=file_Mount()))
        while(!(disk :=file_Mount()))
        putstr("uSD no montada...");
        pause(200);
        gfx_Cls();
        pause(200);
        wend
        endif

        gfx_TransparentColour(0x0020);
        gfx_Transparency(ON);

        hndl := file_LoadImageControl("Temp5.dat", "Temp5.gci", 1);

        gfx_Set(SCREEN_MODE,LANDSCAPE) ;

        temp == 0; // Inicializamos la variable para la Temperaura.
        freq1 == 0;

        repeat


        temp := serin();
        freq1 := freq1 + 1;

        if(freq1==8)
        freq1 := 0;

        // leddigits1 generated 29/11/2011 18:00:24
        img_Show(hndl, ileddigits1); // show all digits at 0, only do this once
        ledDigitsDisplay(temp, ileddigits1+1, 64, 3, 2, 70, 0 ) ;
        endif

        if(temp>149) // Si la variable es igual a 150 o mayor, entonces...
        temp:=150; // la variable siempre será 150.
        endif

        pause(200); // pausa obligatoria para lectura del buffer del puerto serial.

        img_SetWord(hndl, 0x0, IMAGE_INDEX, temp); // carga la imagen
        img_Show(hndl, 0x0);

        // gauge1 generated 27/11/2011 21:11:59
        img_SetWord(hndl, igauge1, IMAGE_INDEX, temp);
        img_Show(hndl, igauge1);

        forever


        endfunc


        And thats all... for now. [img width=234 height=174]http://4d.websitetoolbox.com/images/boards/smilies/thumb.gif[/img]

        Comment

        Working...
        X