Announcement

Collapse
No announcement yet.

Touch Panel

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

  • Touch Panel

    Hello,

    I'm struggling a few days to convert my serial data.
    I send in HEX "D01|38|i01" (4430317c33387c693031) and split this string around the pipeline.

    CMD = D01
    PARM1 = 38
    PARM2 = i01

    But the when i print the value of PARM1 it results in 256.


    #platform "uLCD-32WPTU"
    #inherit "4DGL_16bitColours.fnc"
    #inherit "VisualConst.inc"
    #inherit "DHC01Const.inc"

    #MODE RUNFLASH

    var CMD;
    var PARM1;
    var PARM2;
    var PARM3;

    func getCmd(var serialdata)
    var n2,p2,q2;
    var strings[20]; // splitpoints
    var linebuf[50]; // string buffer for 100 chars

    to(linebuf); putstr(serialdata);
    p2 := str_Ptr(linebuf); // point to line buffer containing string to split
    while(str_GetByte(p2)) // split the line into substrings
    strings[n2++] := p2; // saving pointers to each splitpoint
    if(q2 := str_Find(&p2, "|")) str_PutByte(q2,'\0'); // converting markers to '\0's
    p2 := q2+1;
    wend

    CMD := strings[0];
    PARM1 := strings[1];
    PARM2 := strings[2];
    endfunc //**************************************************************************************************** ****

    func main()
    // Scherm setup Tekst Zwart op witte achtergrond
    gfx_Set(SCREEN_MODE,1) ;
    gfx_BGcolour(WHITE) ;
    txt_FGcolour(BLACK) ;
    txt_BGcolour(WHITE) ;
    gfx_Cls();

    // Kijken of de SD Kaart is geladen anders toon tekst
    var movex;
    if (!(disk:=file_Mount()))
    while(!(disk :=file_Mount()))
    movex++;
    gfx_MoveTo((movex*5),100) ;
    putstr("\n Geen µSD-kaart gevonden!!!!");
    if (movex >= 30)
    movex := 1;
    gfx_Cls();
    endif
    wend
    gfx_Cls();
    endif

    gfx_TransparentColour(0x0020);
    gfx_Transparency(ON);

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


    var serbuffer[80];
    setbaud(BAUD_115200);
    com_Init(serbuffer, 255, 0);

    repeat

    com_Init(serbuffer, 255, 0); // reset buffer
    //serout(0xff); // request data
    pause(300);

    // kijken of er data is van de serial port
    if (com_Count() >= 2)
    putstr(serbuffer);
    getCmd(serbuffer);

    if (str_Find(&CMD,"D01"))// DisplayTermstat
    displayTermostat();
    endif

    endif
    forever
    endfunc //**************************************************************************************************** ****

    func displayTermostat()
    gfx_Cls();
    // Thermometer1 1.0 generated 1/05/2013 17:09:58
    img_SetWord(hndl, iThermometer1, IMAGE_INDEX, PARM1) ; // where frame is 0 to 55 (for a displayed -1 to -1)
    img_SetPosition(hndl,iThermometer1,100,0);
    img_Show(hndl,iThermometer1) ;
    print(PARM1); //<-- returns 256?
    endfunc
    Thanks David,

    //
    pat

  • #2


    It certainly seems the touch panel is faulty.

    Try and get it replaced under warrantly by your local dealer.
    Mark

    Comment

    Working...
    X