Announcement

Collapse
No announcement yet.

Keyboard Object Question

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

  • #46
    Hi Eran, using the WriteObject method I created a loop and sent my string one character at a time. It works and is generally a bit faster than the WriteMagicBytes option. Before I decide on a final direction, it would be really good to know if I am doing something wrong with WriteMagicBytes, the fact it works instantly on the first attempt but is then delayed is really frustrating

    Comment


    • #47
      Hi Tim,

      You’re missing an acknowledgment in your magicObject code. You can add the line serout(ACK) ; at the end of your magicObject code. This is an acknowledgment from the display to the Arduino that the Display is done receiving data from the Arduino.

      You can choose either way you want and can always ask for clarifications.

      *Please have a look at the modified version of your magicObject code:


      Code:
      func rMagicObject0(var action, var object, var newVal, var *ptr)
          var  i;
      
          print([CHR]newVal);
          print("\n");
      
          for (i:=0; i<newVal;i++)
            print([CHR]ptr[i]);
          next
      
          print("\n");
      
          serout(ACK) ;    // send back an ACK to command, do this last, otherwise the master may send the
                               // next command which is cannot be started until this is finished.
      
      endfunc
      Thanks and I hope this helps,

      Eran

      Comment


      • #48
        Eran, that's perfect. Tested and working perfectly. What a dope Thank you again for the amazing help and support!

        Comment


        • #49
          Hi Eran, made good progress today thanks to your help with the comms

          Is there a limit to the number of bytes of memory that can be allocated to variables? I ran into a stack overflow error today which was only solved when I reduced the number of bytes of memory I am allocating in my variables section. The good news is that now the comms are nice an slick I won't need to download massive chunks of data but it did alarm me. On compilation the message tells me I am using around 14K (of the 32K) available so far so I though I had plenty of head room left.

          Comment


          • #50
            Hi Tim,

            Stack Overflow usually happens when you’re calling functions recursively without returning.

            You may take a look at these forum threads for more information about stack overflow.
            https://forum.4dsystems.com.au/forum...o-15#post43996
            https://forum.4dsystems.com.au/forum...2057#post22057
            https://forum.4dsystems.com.au/forum...rflow#post4458
            https://forum.4dsystems.com.au/forum...0468#post60468

            You may also change the Stack Size and see if the error’s still there.

            https://forum.4dsystems.com.au/forum...tion#post46574

            If the stack overflow still gets to be an issue, I recommend that you execute your code part-by-part and determine which part results to the error so debugging will be much easier.

            Best Regards,
            Eran

            Comment


            • #51
              Thanks Eran, as ever that's very useful information.

              I don't think I am recursively calling any functions but certainly worth bearing in mind. In my test mode I am declaring a lot of big arrays and the problem occurred when I tried to initialise another 150bytes within my magicObject code. I did move these out to the glabal variables area as I wil need them in other parts of the code and cut back on some of the silly initialisations I was doing and this seemed to help.

              Useful to know I can increase the stack size though

              Thanks again

              Comment


              • #52
                No worries Tim! Glad it helped you.

                Best Regards,
                Eran

                Comment

                Working...
                X