Announcement

Collapse
No announcement yet.

ledDigitDisplay crashes the program, how to debug

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

  • ledDigitDisplay crashes the program, how to debug

    Hello,

    I wrote a program to display LEDDigits and update them once every few seconds. I use the function ledDigitsDisplay() for that and let the IDE create the code for that (using the paste code button). I use this inside a loop which also reads data over serial.
    The problem is that the ledDigitsDisplay() method seems to crash the program. When I write a simple program which only shows increasing numbers it works fine but in my program after updating the numbers 3 times it crashes (display goes blank and unresponsive).
    If I change the number I send over serial the number of times it works changes (for example to 5). So I think there is some overflow or something like that going on. But I can find it and I don't know how to debug it in a way to find it.

    Below you find my code

    Code:
    counter := 0;
        value := 0;
        repeat
            chReceived := serin1();
            if (chReceived > 0)
                // Store character in the buffer
                str_PutByte(pchTextBuffer + counter, chReceived);
                counter += 1;
                if (counter >= messageSize)
                    //str_Printf(&pchTextBuffer, "%2s");
                    //putstr(pchTextBuffer);
                    //putstr("hallo");
                    str_GetC(&pchTextBuffer, &typeS);
                    if (str_FindI(&typeS, "S"))
                        print("jöasdf");
                    endif
                    //putch(typeS);
                    str_GetD(&pchTextBuffer, &value);
                    print(value, "\n");
                    // Speed 1.0 generated 5/14/2019 2:08:39 AM
                    ledDigitsDisplay(value, iRPM+1, 176, 4, 1, 33, 1);
                    //ledDigitsDisplay(value, iSpeed+1, 0, 3, 1, 59, 1);
                    counter := 0;
                endif
            endif
        until (com_Error());

  • #2
    Hi,

    Are you passing an integer value on the 'LedDigit' widget?
    Can you please explain how the values are passed into the Serial? This can help us to further understand your program.

    Best regards,
    Kevin

    Comment


    • #3
      Hi Kevin,

      Yes as far as I know the value parameter is an integer.
      So I send for example the string "S1234" over serial. Then the typeS parameter gets the value "S" and the value parameter gets the value "1234". That works for my code since when I print them it shows the correct values.
      I don't know how to explicitly tell the program that value is an integer.

      Thanks for your help

      Best regards
      Thies

      Comment

      Working...
      X